Skip to content

create_agent_space async

create_agent_space(
    name: AgentSpaceName,
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    description: Optional[Description] = None,
    locale: Optional[Locale] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    client_token: Optional[str] = None,
    tags: Optional[Tags] = None,
    preferences: Optional[AgentSpacePreferences] = None,
) -> CreateAgentSpaceOutput

Creates a new AgentSpace with the specified name and description. Duplicate space names are allowed.

Parameters:

  • name (AgentSpaceName) –

    The name of the AgentSpace.

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

    The description of the AgentSpace.

  • locale (Optional[Locale], default: None ) –

    The locale for the AgentSpace, which determines the language used in agent responses.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The ARN of the AWS Key Management Service (AWS KMS) customer managed key that's used to encrypt resources.

  • client_token (Optional[str], default: None ) –

    Client-provided token to ensure request idempotency. When the same token is provided in subsequent calls, the same response is returned within a 8-hour window.

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

    Tags to add to the AgentSpace at creation time.

  • preferences (Optional[AgentSpacePreferences], default: None ) –

    The preferences to configure on the agent space. Preferences not provided take their default values.

Raises:

Source code in docs_src/capo_devops_agent/_services/async_dev_ops_agent.py
async def create_agent_space(
    self,
    name: "capo_devops_agent.types.agent_space_name.AgentSpaceName",
    *,
    config_overrides: Optional[AsyncDevOpsAgentClientConfig] = None,
    description: Optional["capo_devops_agent.types.description.Description"] = None,
    locale: Optional["capo_devops_agent.types.locale.Locale"] = None,
    kms_key_arn: Optional["capo_devops_agent.types.kms_key_arn.KmsKeyArn"] = None,
    client_token: Optional[str] = None,
    tags: Optional["capo_devops_agent.types.tags.Tags"] = None,
    preferences: Optional[
        "capo_devops_agent.types.agent_space_preferences.AgentSpacePreferences"
    ] = None,
) -> "capo_devops_agent.types.create_agent_space_output.CreateAgentSpaceOutput":
    """<p>Creates a new AgentSpace with the specified name and description. Duplicate space names are allowed.</p>

    Args:
        name: <p>The name of the AgentSpace.</p>
        description: <p>The description of the AgentSpace.</p>
        locale: <p>The locale for the AgentSpace, which determines the language used in agent responses.</p>
        kms_key_arn: <p>The ARN of the AWS Key Management Service (AWS KMS) customer managed key that's used to encrypt resources.</p>
        client_token: <p>Client-provided token to ensure request idempotency. When the same token is provided in subsequent calls, the same response is returned within a 8-hour window.</p>
        tags: <p>Tags to add to the AgentSpace at creation time.</p>
        preferences: <p>The preferences to configure on the agent space. Preferences not provided take their default values.</p>

    Raises:
        capo_devops_agent.errors.access_denied_exception.AccessDeniedException: <p>Access to the requested resource is denied due to insufficient permissions.</p>
        capo_devops_agent.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_devops_agent.errors.content_size_exceeded_exception.ContentSizeExceededException: <p>This exception is thrown when the content size exceeds the allowed limit.</p>
        capo_devops_agent.errors.internal_server_exception.InternalServerException: <p>This exception is thrown when an unexpected error occurs in the processing of a request.</p>
        capo_devops_agent.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters provided in the request are invalid.</p>
        capo_devops_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_devops_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed the service quota limit.</p>
        capo_devops_agent.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Please slow down and try again.</p>
        capo_devops_agent.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_devops_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_devops_agent.types.create_agent_space_input.CreateAgentSpaceInput]",
    ) -> AsyncOperationResponse[
        "capo_devops_agent.types.create_agent_space_output.CreateAgentSpaceOutput"
    ]:
        import capo_devops_agent._operations.dev_ops_agent.create_agent_space

        (
            output,
            http_response,
        ) = await capo_devops_agent._operations.dev_ops_agent.create_agent_space.async_create_agent_space(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_devops_agent.types.create_agent_space_input.CreateAgentSpaceInput",
    ) -> dict[str, Any]:
        import capo_devops_agent.types.create_agent_space_input

        return capo_devops_agent.types.create_agent_space_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_devops_agent.types.create_agent_space_output.CreateAgentSpaceOutput",
    ) -> dict[str, Any]:
        import capo_devops_agent.types.create_agent_space_output

        return capo_devops_agent.types.create_agent_space_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateAgentSpace",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_devops_agent.types.create_agent_space_input.CreateAgentSpaceInput = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if locale is not None:
        input_["locale"] = locale
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags
    if preferences is not None:
        input_["preferences"] = preferences

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