Skip to content

create_snapshot_policy

create_snapshot_policy(
    *,
    config_overrides: Optional[FSxClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    file_system_id: Optional[FileSystemId] = None,
    storage_virtual_machine_id: Optional[StorageVirtualMachineId] = None,
    name: Optional[SnapshotPolicyName] = None,
    enabled: Optional[Flag] = None,
    schedules: Optional[SnapshotPolicyScheduleList] = None,
    tags: Optional[Tags] = None,
) -> CreateSnapshotPolicyResponse

Creates a snapshot policy for an Amazon FSx for NetApp ONTAP file system or storage virtual machine (SVM). A snapshot policy defines the schedules on which ONTAP automatically creates snapshots of the volumes that use the policy, and the maximum number of snapshots to retain for each schedule.

The CreateSnapshotPolicy operation returns while the snapshot policy's lifecycle state is still CREATING. You can check the snapshot policy creation status by calling the DescribeSnapshotPolicies 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 snapshot 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 snapshot policy. You must specify either a FileSystemId or a StorageVirtualMachineId, but not both.

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

    Specifies the name of the snapshot policy.

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

    Specifies whether the snapshot policy is enabled. This value defaults to true.

  • schedules (Optional[SnapshotPolicyScheduleList], default: None ) –

    Specifies the schedules on which ONTAP creates snapshots for the snapshot policy.

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/f_sx.py
def create_snapshot_policy(
    self,
    *,
    config_overrides: Optional[FSxClientConfig] = 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.snapshot_policy_name.SnapshotPolicyName"] = None,
    enabled: Optional["capo_fsx.types.flag.Flag"] = None,
    schedules: Optional[
        "capo_fsx.types.snapshot_policy_schedule_list.SnapshotPolicyScheduleList"
    ] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
) -> "capo_fsx.types.create_snapshot_policy_response.CreateSnapshotPolicyResponse":
    """<p>Creates a snapshot policy for an Amazon FSx for NetApp ONTAP file system or storage virtual machine (SVM). A snapshot policy defines the schedules on which ONTAP automatically creates snapshots of the volumes that use the policy, and the maximum number of snapshots to retain for each schedule.</p> <p>The <code>CreateSnapshotPolicy</code> operation returns while the snapshot policy's lifecycle state is still <code>CREATING</code>. You can check the snapshot policy creation status by calling the DescribeSnapshotPolicies operation.</p>

    Args:
        file_system_id: <p>Specifies the ID of the Amazon FSx for NetApp ONTAP file system on which to create the snapshot 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 snapshot 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 snapshot policy.</p>
        enabled: <p>Specifies whether the snapshot policy is enabled. This value defaults to <code>true</code>.</p>
        schedules: <p>Specifies the schedules on which ONTAP creates snapshots for the snapshot policy.</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.
    """

    def _handler(
        req: "OperationRequest[capo_fsx.types.create_snapshot_policy_request.CreateSnapshotPolicyRequest]",
    ) -> OperationResponse[
        "capo_fsx.types.create_snapshot_policy_response.CreateSnapshotPolicyResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_snapshot_policy

        output, http_response = (
            capo_fsx._operations.aws_simba_api_service_v20180301.create_snapshot_policy.create_snapshot_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSnapshotPolicy")
    )
    input_: capo_fsx.types.create_snapshot_policy_request.CreateSnapshotPolicyRequest = {}
    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 enabled is not None:
        input_["enabled"] = enabled
    if schedules is not None:
        input_["schedules"] = schedules
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output