Skip to content

create_snapmirror_policy async

create_snapmirror_policy(
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    file_system_id: Optional[FileSystemId] = None,
    storage_virtual_machine_id: Optional[StorageVirtualMachineId] = None,
    name: Optional[SnapmirrorPolicyName] = None,
    snapshot_copy_mode: Optional[SnapmirrorPolicySnapshotCopyMode] = None,
    retention_rules: Optional[SnapmirrorPolicyRetentionRules] = None,
    transfer_schedule: Optional[SnapmirrorTransferScheduleName] = None,
    network_compression_enabled: Optional[Flag] = None,
    throttle_in_kbps: Optional[ThrottleInKbps] = None,
    tags: Optional[Tags] = None,
) -> CreateSnapmirrorPolicyResponse

Creates a SnapMirror policy for an Amazon FSx for NetApp ONTAP file system or storage virtual machine (SVM). A SnapMirror policy defines how the SnapMirror relationships that use the policy replicate data, including which snapshots to transfer, the maximum number of snapshots to retain on the destination volume, and when to transfer data.

The CreateSnapmirrorPolicy operation returns while the SnapMirror policy's lifecycle state is still CREATING. You can check the SnapMirror policy creation status by calling the DescribeSnapmirrorPolicies operation.

Parameters:

  • file_system_id (Optional[FileSystemId], default: None ) –

    Specifies the ID of the Amazon FSx for NetApp ONTAP file system on which to create the SnapMirror policy. You must specify either a FileSystemId or a StorageVirtualMachineId, but not both.

  • storage_virtual_machine_id (Optional[StorageVirtualMachineId], default: None ) –

    Specifies the ID of the SVM on which to create the SnapMirror policy. You must specify either a FileSystemId or a StorageVirtualMachineId, but not both.

  • name (Optional[SnapmirrorPolicyName], default: None ) –

    Specifies the name of the SnapMirror policy.

  • snapshot_copy_mode (Optional[SnapmirrorPolicySnapshotCopyMode], default: None ) –

    Specifies which snapshots SnapMirror transfers to the destination volume:

    • COPY_ALL_SOURCE_SNAPSHOTS – SnapMirror copies all snapshots of the source volume to the destination volume on a transfer. You can't specify RetentionRules along with this property.

    • COPY_LATEST_SOURCE_SNAPSHOT – SnapMirror copies the latest snapshot of the source volume to the destination volume on a transfer. You can't specify RetentionRules along with this property.

    • NO_CREATE_SNAPSHOT_ON_SOURCE – SnapMirror doesn't create a snapshot on the source volume at beginning of an update or resync operation. You must specify RetentionRules along with this property.

    If you don't specify a SnapshotCopyMode, SnapMirror creates a new snapshot of the source volume and copies it, along with any snapshots that match RetentionRules, to the destination volume on a transfer. RetentionRules is optional.

  • retention_rules (Optional[SnapmirrorPolicyRetentionRules], default: None ) –

    Specifies the rules that determine which snapshots SnapMirror retains on the destination volume, based on their SnapMirror labels.

  • transfer_schedule (Optional[SnapmirrorTransferScheduleName], default: None ) –

    Specifies the name of the ONTAP schedule that determines when SnapMirror transfers data.

  • network_compression_enabled (Optional[Flag], default: None ) –

    Specifies whether SnapMirror compresses data when it transfers the data over the network. This value defaults to false.

  • throttle_in_kbps (Optional[ThrottleInKbps], default: None ) –

    Specifies the maximum bandwidth, in kilobytes per second (KBps), that SnapMirror uses to transfer data. A value of 0 means that the bandwidth is unlimited.

Raises:

  • BadRequest –

    A generic error indicating a failure with a client request.

  • FileSystemNotFound –

    No Amazon FSx file systems were found based upon supplied parameters.

  • IncompatibleParameterError –

    The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.

  • InternalServerError –

    A generic error indicating a server-side failure.

  • ServiceLimitExceeded –

    An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.

  • StorageVirtualMachineNotFound –

    No FSx for ONTAP SVMs were found based upon the supplied parameters.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_fsx/_services/async_f_sx.py
async def create_snapmirror_policy(
    self,
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    file_system_id: Optional["capo_fsx.types.file_system_id.FileSystemId"] = None,
    storage_virtual_machine_id: Optional[
        "capo_fsx.types.storage_virtual_machine_id.StorageVirtualMachineId"
    ] = None,
    name: Optional[
        "capo_fsx.types.snapmirror_policy_name.SnapmirrorPolicyName"
    ] = None,
    snapshot_copy_mode: Optional[
        "capo_fsx.types.snapmirror_policy_snapshot_copy_mode.SnapmirrorPolicySnapshotCopyMode"
    ] = None,
    retention_rules: Optional[
        "capo_fsx.types.snapmirror_policy_retention_rules.SnapmirrorPolicyRetentionRules"
    ] = None,
    transfer_schedule: Optional[
        "capo_fsx.types.snapmirror_transfer_schedule_name.SnapmirrorTransferScheduleName"
    ] = None,
    network_compression_enabled: Optional["capo_fsx.types.flag.Flag"] = None,
    throttle_in_kbps: Optional[
        "capo_fsx.types.throttle_in_kbps.ThrottleInKbps"
    ] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
) -> "capo_fsx.types.create_snapmirror_policy_response.CreateSnapmirrorPolicyResponse":
    """<p>Creates a SnapMirror policy for an Amazon FSx for NetApp ONTAP file system or storage virtual machine (SVM). A SnapMirror policy defines how the SnapMirror relationships that use the policy replicate data, including which snapshots to transfer, the maximum number of snapshots to retain on the destination volume, and when to transfer data.</p> <p>The <code>CreateSnapmirrorPolicy</code> operation returns while the SnapMirror policy's lifecycle state is still <code>CREATING</code>. You can check the SnapMirror policy creation status by calling the DescribeSnapmirrorPolicies operation.</p>

    Args:
        file_system_id: <p>Specifies the ID of the Amazon FSx for NetApp ONTAP file system on which to create the SnapMirror policy. You must specify either a <code>FileSystemId</code> or a <code>StorageVirtualMachineId</code>, but not both.</p>
        storage_virtual_machine_id: <p>Specifies the ID of the SVM on which to create the SnapMirror policy. You must specify either a <code>FileSystemId</code> or a <code>StorageVirtualMachineId</code>, but not both.</p>
        name: <p>Specifies the name of the SnapMirror policy.</p>
        snapshot_copy_mode: <p>Specifies which snapshots SnapMirror transfers to the destination volume:</p> <ul> <li> <p> <code>COPY_ALL_SOURCE_SNAPSHOTS</code> – SnapMirror copies all snapshots of the source volume to the destination volume on a transfer. You can't specify <code>RetentionRules</code> along with this property.</p> </li> <li> <p> <code>COPY_LATEST_SOURCE_SNAPSHOT</code> – SnapMirror copies the latest snapshot of the source volume to the destination volume on a transfer. You can't specify <code>RetentionRules</code> along with this property.</p> </li> <li> <p> <code>NO_CREATE_SNAPSHOT_ON_SOURCE</code> – SnapMirror doesn't create a snapshot on the source volume at beginning of an update or resync operation. You must specify <code>RetentionRules</code> along with this property.</p> </li> </ul> <p>If you don't specify a <code>SnapshotCopyMode</code>, SnapMirror creates a new snapshot of the source volume and copies it, along with any snapshots that match <code>RetentionRules</code>, to the destination volume on a transfer. <code>RetentionRules</code> is optional.</p>
        retention_rules: <p>Specifies the rules that determine which snapshots SnapMirror retains on the destination volume, based on their SnapMirror labels.</p>
        transfer_schedule: <p>Specifies the name of the ONTAP schedule that determines when SnapMirror transfers data.</p>
        network_compression_enabled: <p>Specifies whether SnapMirror compresses data when it transfers the data over the network. This value defaults to <code>false</code>.</p>
        throttle_in_kbps: <p>Specifies the maximum bandwidth, in kilobytes per second (KBps), that SnapMirror uses to transfer data. A value of <code>0</code> means that the bandwidth is unlimited.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.file_system_not_found.FileSystemNotFound: <p>No Amazon FSx file systems were found based upon supplied parameters.</p>
        capo_fsx.errors.incompatible_parameter_error.IncompatibleParameterError: <p>The error returned when a second request is received with the same client request token but different parameters settings. A client request token should always uniquely identify a single request.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.service_limit_exceeded.ServiceLimitExceeded: <p>An error indicating that a particular service limit was exceeded. You can increase some service limits by contacting Amazon Web Services Support.</p>
        capo_fsx.errors.storage_virtual_machine_not_found.StorageVirtualMachineNotFound: <p>No FSx for ONTAP SVMs were found based upon the supplied parameters.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_fsx.types.create_snapmirror_policy_request.CreateSnapmirrorPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_fsx.types.create_snapmirror_policy_response.CreateSnapmirrorPolicyResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_snapmirror_policy

        (
            output,
            http_response,
        ) = await capo_fsx._operations.aws_simba_api_service_v20180301.create_snapmirror_policy.async_create_snapmirror_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSnapmirrorPolicy")
    )
    input_: capo_fsx.types.create_snapmirror_policy_request.CreateSnapmirrorPolicyRequest = {}
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if file_system_id is not None:
        input_["file_system_id"] = file_system_id
    if storage_virtual_machine_id is not None:
        input_["storage_virtual_machine_id"] = storage_virtual_machine_id
    if name is not None:
        input_["name"] = name
    if snapshot_copy_mode is not None:
        input_["snapshot_copy_mode"] = snapshot_copy_mode
    if retention_rules is not None:
        input_["retention_rules"] = retention_rules
    if transfer_schedule is not None:
        input_["transfer_schedule"] = transfer_schedule
    if network_compression_enabled is not None:
        input_["network_compression_enabled"] = network_compression_enabled
    if throttle_in_kbps is not None:
        input_["throttle_in_kbps"] = throttle_in_kbps
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output