# Module `netapp_ontap.resources.cloud_target`

Copyright © 2022 NetApp Inc. All rights reserved.

## Retrieving a collection of cloud targets

The cloud targets GET API retrieves all cloud targets defined in the cluster.

## Creating cloud targets

The cluster administrator tells ONTAP how to connect to a cloud target. The following pre-requisites must be met before creating an object store configuration in ONTAP. A valid data bucket or container must be created with the object store provider. This assumes that the user has valid account credentials with the object store provider to access the data bucket. The ONTAP node must be able to connect to the object store. This includes: - Fast, reliable connectivity to the object store. - An inter-cluster LIF (logical interface) must be configured on the cluster. ONTAP verifies connectivity prior to saving this configuration information. - If SSL/TLS authentication is required, then valid certificates must be installed. - FabricPool license (required for all object stores except SGWS).

## Deleting cloud targets

If a cloud target is used by an aggregate, then the aggregate must be deleted before the cloud target can be deleted.

## Classes

`class CloudTarget (*args, **kwargs)`

  Allows interaction with CloudTarget objects on the host

  Initialize the instance of the resource.

  Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

      MyResource(name='foo').name == 'foo'

  ## Args

  `*args`
    Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
  `**kwargs`
    each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

  ### Ancestors

  - Resource

  ### Static methods

  `def count_collection(*args, connection: HostConnection = None, **kwargs) -> int`

    Fetch a count of all objects of this type from the host.

    This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

    ## Returns

    On success, returns an integer count of the objects of this type. On failure, returns -1.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

  `def delete_collection(*args, records: Iterable[_ForwardRef('CloudTarget')] = None, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Deletes the cloud target specified by the UUID. This request starts a job and returns a link to that job.

    ### Related ONTAP commands

    - `storage aggregate object-store config delete`

    ### Learn more

    - `DOC /cloud/targets`

    Delete all objects in a collection which match the given query.

    All records on the host which match the query will be deleted.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to delete the collection of bars for a particular foo, the foo.name value should be passed.
    `records`
      Can be provided in place of a query. If so, this list of objects will be deleted from the host.
    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be deleted.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def find(*args, connection: HostConnection = None, **kwargs) -> Resource`

    Retrieves the collection of cloud targets in the cluster.

    ### Related ONTAP commands

    - `storage aggregate object-store config show`

    ### Learn more

    - `DOC /cloud/targets`

    Find an instance of an object on the host given a query.

    The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A `Resource` object containing the details of the object or None if no matches were found.

    ## Raises

    `NetAppRestError`: If the API call returned more than 1 matching resource.

  `def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]`

    Retrieves the collection of cloud targets in the cluster.

    ### Related ONTAP commands

    - `storage aggregate object-store config show`

    ### Learn more

    - `DOC /cloud/targets`

    Fetch a list of all objects of this type from the host.

    This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `max_records`
      The maximum number of records to return per call
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  `def patch_collection(body: dict, *args, records: Iterable[_ForwardRef('CloudTarget')] = None, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Updates the cloud target specified by the UUID with the fields in the body. This request starts a job and returns a link to that job.

    ### Related ONTAP commands

    - `storage aggregate object-store config modify`

    ### Learn more

    - `DOC /cloud/targets`

    Patch all objects in a collection which match the given query.

    All records on the host which match the query will be patched with the provided body.

    ## Args

    `body`
      A dictionary of name/value pairs to set on all matching members of the collection. The body argument will be ignored if records is provided.
    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to patch the collection of bars for a particular foo, the foo.name value should be passed.
    `records`
      Can be provided in place of a query. If so, this list of objects will be patched on the host.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def post_collection(records: Iterable[_ForwardRef('CloudTarget')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> Union[List[CloudTarget], NetAppResponse]`

    Creates a cloud target.

    ### Required properties

    - `name` - Name for the cloud target.
    - `owner` - Owner of the target: fabricpool, snapmirror.
    - `provider_type` - Type of cloud provider: AWS_S3, Azure_Cloud, SGWS, IBM_COS, AliCloud, GoogleCloud, ONTAP_S3.
    - `server` - Fully qualified domain name of the object store server. Required when `provider_type` is one of the following: SGWS, IBM_COS, AliCloud.
    - `container` - Data bucket/container name.
    - `access_key` - Access key ID if `provider_type` is not Azure_Cloud and `authentication_type` is key.
    - `secret_password` - Secret access key if `provider_type` is not Azure_Cloud and `authentication_type` is key.
    - `azure_account` - Azure account if `provider_type` is Azure_Cloud.
    - `azure_private_key` - Azure access key if `provider_type` is Azure_Cloud.
    - `cap_url` - Full URL of the request to a CAP server for retrieving temporary credentials if `authentication_type` is cap.
    - `svm.name` or `svm.uuid` - Name or UUID of SVM if `owner` is snapmirror.
    - `snapmirror_use` - Use of the cloud target if `owner` is snapmirror: data, metadata.

    ### Recommended optional properties

    - `authentication_type` - Authentication used to access the target: key, cap, ec2_iam, gcp_sa, azure_msi.
    - `ssl_enabled` - SSL/HTTPS enabled or disabled.
    - `port` - Port number of the object store that ONTAP uses when establishing a connection.
    - `ipspace` - IPspace to use in order to reach the cloud target.
    - `use_http_proxy` - Use the HTTP proxy when connecting to the object store server.

    ### Default property values

    - `authentication_type`
    - ec2_iam - if running in Cloud Volumes ONTAP in AWS
    - gcp_sa - if running in Cloud Volumes ONTAP in GCP
    - azure_msi - if running in Cloud Volumes ONTAP in Azure
    - key - in all other cases.
    - `server`
    - s3.amazonaws.com - if `provider_type` is AWS_S3
    - blob.core.windows.net - if `provider_type` is Azure_Cloud
    - storage.googleapis.com - if `provider_type` is GoogleCloud
    - `ssl_enabled` - true
    - `port`
    - 443 if `ssl_enabled` is true
    - 80 if `ssl_enabled` is false and `provider_type` is not SGWS
    - 8084 if `ssl_enabled` is false and `provider_type` is SGWS
    - `ipspace` - Default
    - `certificate_validation_enabled` - true
    - `ignore_warnings` - false
    - `check_only` - false
    - `use_http_proxy` - false
    - `server_side_encryption`
    - none - if `provider_type` is ONTAP_S3
    - sse_s3 - if `provider_type` is not ONTAP_S3
    - `url_style`
    - path_style - if `provider_type` is neither AWS_S3 nor AliCloud
    - virtual_hosted_style - if `provider_type` is either _AWS_S3 or _AliCloud__

    ### Related ONTAP commands

    - `storage aggregate object-store config create`

    ### Learn more

    - `DOC /cloud/targets`

    Send this collection of objects to the host as a creation request.

    ## Args

    `records`
      A list of `Resource` objects to send to the server to be created.
    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to create a bar for a particular foo, the foo.name value should be passed.
    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

    ## Returns

    A list of `Resource` objects matching the provided
    `type` `which` `have` `been` `created` `by` `the` `host` `and` `returned.` `This` `is` `_not_`
    `the` `same` `list` `that` `was` `provided`, `so` `to` `continue` `using` `the` `object`, `you`

    should save this list. If poll is set to False, then a `NetAppResponse` object is returned instead.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  ### Methods

  `def delete(self, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse`

    Deletes the cloud target specified by the UUID. This request starts a job and returns a link to that job.

    ### Related ONTAP commands

    - `storage aggregate object-store config delete`

    ### Learn more

    - `DOC /cloud/targets`

    Send a deletion request to the host for this object.

    ## Args

    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def get(self, **kwargs) -> NetAppResponse`

    Retrieves the cloud target specified by the UUID.

    ### Related ONTAP commands

    - `storage aggregate object-store config show`

    ### Learn more

    - `DOC /cloud/targets`

    Fetch the details of the object from the host.

    Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def patch(self, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse`

    Updates the cloud target specified by the UUID with the fields in the body. This request starts a job and returns a link to that job.

    ### Related ONTAP commands

    - `storage aggregate object-store config modify`

    ### Learn more

    - `DOC /cloud/targets`

    Send the difference in the object's state to the host as a modification request.

    Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.

    ## Args

    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def post(self, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse`

    Creates a cloud target.

    ### Required properties

    - `name` - Name for the cloud target.
    - `owner` - Owner of the target: fabricpool, snapmirror.
    - `provider_type` - Type of cloud provider: AWS_S3, Azure_Cloud, SGWS, IBM_COS, AliCloud, GoogleCloud, ONTAP_S3.
    - `server` - Fully qualified domain name of the object store server. Required when `provider_type` is one of the following: SGWS, IBM_COS, AliCloud.
    - `container` - Data bucket/container name.
    - `access_key` - Access key ID if `provider_type` is not Azure_Cloud and `authentication_type` is key.
    - `secret_password` - Secret access key if `provider_type` is not Azure_Cloud and `authentication_type` is key.
    - `azure_account` - Azure account if `provider_type` is Azure_Cloud.
    - `azure_private_key` - Azure access key if `provider_type` is Azure_Cloud.
    - `cap_url` - Full URL of the request to a CAP server for retrieving temporary credentials if `authentication_type` is cap.
    - `svm.name` or `svm.uuid` - Name or UUID of SVM if `owner` is snapmirror.
    - `snapmirror_use` - Use of the cloud target if `owner` is snapmirror: data, metadata.

    ### Recommended optional properties

    - `authentication_type` - Authentication used to access the target: key, cap, ec2_iam, gcp_sa, azure_msi.
    - `ssl_enabled` - SSL/HTTPS enabled or disabled.
    - `port` - Port number of the object store that ONTAP uses when establishing a connection.
    - `ipspace` - IPspace to use in order to reach the cloud target.
    - `use_http_proxy` - Use the HTTP proxy when connecting to the object store server.

    ### Default property values

    - `authentication_type`
    - ec2_iam - if running in Cloud Volumes ONTAP in AWS
    - gcp_sa - if running in Cloud Volumes ONTAP in GCP
    - azure_msi - if running in Cloud Volumes ONTAP in Azure
    - key - in all other cases.
    - `server`
    - s3.amazonaws.com - if `provider_type` is AWS_S3
    - blob.core.windows.net - if `provider_type` is Azure_Cloud
    - storage.googleapis.com - if `provider_type` is GoogleCloud
    - `ssl_enabled` - true
    - `port`
    - 443 if `ssl_enabled` is true
    - 80 if `ssl_enabled` is false and `provider_type` is not SGWS
    - 8084 if `ssl_enabled` is false and `provider_type` is SGWS
    - `ipspace` - Default
    - `certificate_validation_enabled` - true
    - `ignore_warnings` - false
    - `check_only` - false
    - `use_http_proxy` - false
    - `server_side_encryption`
    - none - if `provider_type` is ONTAP_S3
    - sse_s3 - if `provider_type` is not ONTAP_S3
    - `url_style`
    - path_style - if `provider_type` is neither AWS_S3 nor AliCloud
    - virtual_hosted_style - if `provider_type` is either _AWS_S3 or _AliCloud__

    ### Related ONTAP commands

    - `storage aggregate object-store config create`

    ### Learn more

    - `DOC /cloud/targets`

    Send this object to the host as a creation request.

    ## Args

    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class CloudTargetSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)`

  The fields of the CloudTarget object

  ### Ancestors

  - netapp_ontap.resource.ResourceSchema
  - marshmallow.schema.Schema
  - marshmallow.base.SchemaABC

  ### Class variables

  `access_key GET POST PATCH`

    Access key ID for AWS_S3 and other S3 compatible provider types.

  `authentication_type GET POST PATCH`

    Authentication used to access the target. SnapMirror does not yet support CAP. Required in POST.

    Valid choices:

    - key
    - cap
    - ec2_iam
    - gcp_sa
    - azure_msi
  `azure_account GET POST PATCH`

    Azure account

  `azure_private_key POST PATCH`

    Azure access key

  `cap_url GET POST PATCH`

    This parameter is available only when auth-type is CAP. It specifies a full URL of the request to a CAP server for retrieving temporary credentials (access-key, secret-pasword, and session token) for accessing the object store.

    Example: https://123.45.67.89:1234/CAP/api/v1/credentials?agency=myagency&mission=mymission&role=myrole

  `certificate_validation_enabled GET POST PATCH`

    Is SSL/TLS certificate validation enabled? The default value is true. This can only be modified for SGWS, IBM_COS, and ONTAP_S3 provider types.

  `cluster GET POST PATCH`

    The cluster field of the cloud_target.

  `container GET POST`

    Data bucket/container name. For FabricLink, a wildcard character "*" can also be specified to indicate that all the buckets in an SVM can use the same target information. However, for containers other than ONTAP, an exact name should be specified.

    Example: bucket1

  `ipspace GET POST`

    The ipspace field of the cloud_target.

  `links GET`

    The links field of the cloud_target.

  `name GET POST PATCH`

    Cloud target name

  `owner GET POST`

    Owner of the target. Allowed values are FabricPool, SnapMirror or S3_SnapMirror. A target can be used by only one feature.

    Valid choices:

    - fabricpool
    - snapmirror
    - s3_snapmirror
  `port GET POST PATCH`

    Port number of the object store that ONTAP uses when establishing a connection. Required in POST.

  `provider_type GET POST`

    Type of cloud provider. Allowed values depend on owner type. For FabricPool, AliCloud, AWS_S3, Azure_Cloud, GoggleCloud, IBM_COS, SGWS, and ONTAP_S3 are allowed. For SnapMirror, the valid values are AWS_S3 or SGWS. For FabricLink, AWS_S3, SGWS, S3_Compatible, S3EMU, LOOPBACK and ONTAP_S3 are allowed.

  `secret_password POST PATCH`

    Secret access key for AWS_S3 and other S3 compatible provider types.

  `server GET POST PATCH`

    Fully qualified domain name of the object store server. Required on POST. For Amazon S3, server name must be an AWS regional endpoint in the format s3.amazonaws.com or s3-.amazonaws.com, for example, s3-us-west-2.amazonaws.com. The region of the server and the bucket must match. For Azure, if the server is a "blob.core.windows.net" or a "blob.core.usgovcloudapi.net", then a value of azure-account followed by a period is added in front of the server.

  `server_side_encryption GET POST PATCH`

    Encryption of data at rest by the object store server for AWS_S3 and other S3 compatible provider types. This is an advanced property. In most cases it is best not to change default value of "sse_s3" for object store servers which support SSE-S3 encryption. The encryption is in addition to any encryption done by ONTAP at a volume or at an aggregate level. Note that changing this option does not change encryption of data which already exist in the object store.

    Valid choices:

    - none
    - sse_s3
  `snapmirror_use GET POST PATCH`

    Use of the cloud target by SnapMirror.

    Valid choices:

    - data
    - metadata
  `ssl_enabled GET POST PATCH`

    SSL/HTTPS enabled or not

  `svm GET POST PATCH`

    The svm field of the cloud_target.

  `url_style GET POST PATCH`

    URL style used to access S3 bucket.

    Valid choices:

    - path_style
    - virtual_hosted_style
  `use_http_proxy GET POST PATCH`

    Use HTTP proxy when connecting to the object store.

  `used GET`

    The amount of cloud space used by all the aggregates attached to the target, in bytes. This field is only populated for FabricPool targets. The value is recalculated once every 5 minutes.

  `uuid GET`

    Cloud target UUID