Skip to content

create_profile async

create_profile(
    name: Name,
    *,
    config_overrides: Optional[AsyncCloudExtensionsClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[Description_256] = None,
    extension_defaults: Optional[ExtensionDefaults] = None,
    tags: Optional[TagMap] = None,
) -> CreateProfileOutput

Creates a new profile. The profile name must be unique within the account.

Parameters:

  • name (Name) –

    The name of the profile. Must be unique within the account.

  • description (Optional[Description_256], default: None ) –

    A human-readable description of the profile's purpose or target environment.

  • extension_defaults (Optional[ExtensionDefaults], default: None ) –

    Default values used by the extensions in this profile. These can be overridden at the profile entry level.

  • tags (Optional[TagMap], default: None ) –

    Tags to assign to the profile.

Raises:

Source code in docs_src/capo_cloudextensions/_services/async_cloud_extensions.py
async def create_profile(
    self,
    name: "capo_cloudextensions.types.name.Name",
    *,
    config_overrides: Optional[AsyncCloudExtensionsClientConfig] = None,
    client_token: Optional[
        "capo_cloudextensions.types.client_token.ClientToken"
    ] = None,
    description: Optional[
        "capo_cloudextensions.types.description_256.Description_256"
    ] = None,
    extension_defaults: Optional[
        "capo_cloudextensions.types.extension_defaults.ExtensionDefaults"
    ] = None,
    tags: Optional["capo_cloudextensions.types.tag_map.TagMap"] = None,
) -> "capo_cloudextensions.types.create_profile_output.CreateProfileOutput":
    """Creates a new profile. The profile name must be unique within the account.

    Args:
        name: The name of the profile. Must be unique within the account.
        description: A human-readable description of the profile's purpose or target environment.
        extension_defaults: Default values used by the extensions in this profile. These can be overridden at the profile entry level.
        tags: Tags to assign to the profile.

    Raises:
        capo_cloudextensions.errors.access_denied_exception.AccessDeniedException: The caller does not have permission to perform the operation.
        capo_cloudextensions.errors.internal_server_exception.InternalServerException: The service couldn't process the request because of an internal error. Retry with capped exponential backoff and jitter.
        capo_cloudextensions.errors.throttling_exception.ThrottlingException: The request rate exceeded a limit. Retry with capped exponential backoff and jitter.
        capo_cloudextensions.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource.
        capo_cloudextensions.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: The request would exceed a service quota for the account.
        capo_cloudextensions.errors.validation_exception.ValidationException: The request was malformed or contained invalid parameter values.
        capo_cloudextensions.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudextensions.types.create_profile_input.CreateProfileInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudextensions.types.create_profile_output.CreateProfileOutput"
    ]:
        import capo_cloudextensions._operations.control_plane.create_profile

        (
            output,
            http_response,
        ) = await capo_cloudextensions._operations.control_plane.create_profile.async_create_profile(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudextensions.types.create_profile_input.CreateProfileInput",
    ) -> dict[str, Any]:
        import capo_cloudextensions.types.create_profile_input

        return capo_cloudextensions.types.create_profile_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_cloudextensions.types.create_profile_output.CreateProfileOutput",
    ) -> dict[str, Any]:
        import capo_cloudextensions.types.create_profile_output

        return capo_cloudextensions.types.create_profile_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateProfile",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_cloudextensions.types.create_profile_input.CreateProfileInput = {
        "name": name
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if extension_defaults is not None:
        input_["extension_defaults"] = extension_defaults
    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