Skip to content

create_volume async

create_volume(
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    volume_type: Optional[VolumeType] = None,
    name: Optional[VolumeName] = None,
    ontap_configuration: Optional[CreateOntapVolumeConfiguration] = None,
    tags: Optional[Tags] = None,
    open_zfs_configuration: Optional[CreateOpenZFSVolumeConfiguration] = None,
) -> CreateVolumeResponse

Creates an FSx for ONTAP or Amazon FSx for OpenZFS storage volume.

Parameters:

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.

  • MissingVolumeConfiguration –

    A volume configuration is required for this operation.

  • 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.

  • UnsupportedOperation –

    The requested operation is not supported for this resource or API.

  • 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_volume(
    self,
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    client_request_token: Optional[
        "capo_fsx.types.client_request_token.ClientRequestToken"
    ] = None,
    volume_type: Optional["capo_fsx.types.volume_type.VolumeType"] = None,
    name: Optional["capo_fsx.types.volume_name.VolumeName"] = None,
    ontap_configuration: Optional[
        "capo_fsx.types.create_ontap_volume_configuration.CreateOntapVolumeConfiguration"
    ] = None,
    tags: Optional["capo_fsx.types.tags.Tags"] = None,
    open_zfs_configuration: Optional[
        "capo_fsx.types.create_open_zfs_volume_configuration.CreateOpenZFSVolumeConfiguration"
    ] = None,
) -> "capo_fsx.types.create_volume_response.CreateVolumeResponse":
    """<p>Creates an FSx for ONTAP or Amazon FSx for OpenZFS storage volume.</p>

    Args:
        volume_type: <p>Specifies the type of volume to create; <code>ONTAP</code> and <code>OPENZFS</code> are the only valid volume types.</p>
        name: <p>Specifies the name of the volume that you're creating.</p>
        ontap_configuration: <p>Specifies the configuration to use when creating the ONTAP volume.</p>
        open_zfs_configuration: <p>Specifies the configuration to use when creating the OpenZFS volume.</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.missing_volume_configuration.MissingVolumeConfiguration: <p>A volume configuration is required for this operation.</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.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</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_volume_request.CreateVolumeRequest]",
    ) -> AsyncOperationResponse[
        "capo_fsx.types.create_volume_response.CreateVolumeResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.create_volume

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

    def _redact_output(
        output: "capo_fsx.types.create_volume_response.CreateVolumeResponse",
    ) -> dict[str, Any]:
        import capo_fsx.types.create_volume_response

        return capo_fsx.types.create_volume_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateVolume", redact_output=_redact_output),
    )
    input_: capo_fsx.types.create_volume_request.CreateVolumeRequest = {}
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if volume_type is not None:
        input_["volume_type"] = volume_type
    if name is not None:
        input_["name"] = name
    if ontap_configuration is not None:
        input_["ontap_configuration"] = ontap_configuration
    if tags is not None:
        input_["tags"] = tags
    if open_zfs_configuration is not None:
        input_["open_zfs_configuration"] = open_zfs_configuration

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