Skip to content

get_space_credentials_for_organization

get_space_credentials_for_organization(
    context: SpaceCredentialRequestContext,
    credential_type: OrganizationCredentialType,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
) -> GetSpaceCredentialsForOrganizationOutput

Returns temporary credentials for a space in an organization member account. The credentials are valid for one hour. The caller must be the organization's management account or a delegated administrator with access to the target space. The target account must be an active member of the same organization as the domain, and the space must already exist.

Parameters:

Raises:

Examples:

Get space credentials for an organization member account The following example returns temporary, space-scoped AWS credentials for an existing space in an organization member account, selected by spaceId. The credentials are valid for one hour, as reflected by the expiration timestamp. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.get_space_credentials_for_organization(context={'spaceId': 'a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d'}, credential_type='SPACE_OPERATION')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def get_space_credentials_for_organization(
    self,
    context: "capo_cloudwatchomni.types.space_credential_request_context.SpaceCredentialRequestContext",
    credential_type: "capo_cloudwatchomni.types.organization_credential_type.OrganizationCredentialType",
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
) -> "capo_cloudwatchomni.types.get_space_credentials_for_organization_output.GetSpaceCredentialsForOrganizationOutput":
    """Returns temporary credentials for a space in an organization member account. The credentials are valid for one hour. The caller must be the organization's management account or a delegated administrator with access to the target space. The target account must be an active member of the same organization as the domain, and the space must already exist.

    Args:
        context: Context for credential resolution.
        credential_type: Selects which member-account credential to return. Set this to SPACE_OPERATION.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get space credentials for an organization member account
        The following example returns temporary, space-scoped AWS credentials for an existing space in an organization member account, selected by spaceId. The credentials are valid for one hour, as reflected by the expiration timestamp. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.get_space_credentials_for_organization(context={'spaceId': 'a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d'}, credential_type='SPACE_OPERATION')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.get_space_credentials_for_organization_input.GetSpaceCredentialsForOrganizationInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.get_space_credentials_for_organization_output.GetSpaceCredentialsForOrganizationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.get_space_credentials_for_organization

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.get_space_credentials_for_organization.get_space_credentials_for_organization(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_cloudwatchomni.types.get_space_credentials_for_organization_output.GetSpaceCredentialsForOrganizationOutput",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.get_space_credentials_for_organization_output

        return capo_cloudwatchomni.types.get_space_credentials_for_organization_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetSpaceCredentialsForOrganization", redact_output=_redact_output
        ),
    )
    input_: capo_cloudwatchomni.types.get_space_credentials_for_organization_input.GetSpaceCredentialsForOrganizationInput = {
        "context": context,
        "credential_type": credential_type,
    }

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