Skip to content

create_integration

create_integration(
    integration_type: IntegrationType,
    name: str,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    credential: Optional[IntegrationCredential] = None,
    integration_attributes: Optional[StringMap] = None,
    role_arn: Optional[str] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[str] = None,
) -> CreateIntegrationOutput

Creates an integration with a third-party provider. Returns the integration identifier and its initial status; when the provider requires interactive consent, an authorization URL is returned for the user to complete setup.

Parameters:

  • integration_type (IntegrationType) –

    The type of third-party provider to integrate with.

  • name (str) –

    The name for the new integration; unique within the account.

  • credential (Optional[IntegrationCredential], default: None ) –

    The credential used to authenticate with the third-party provider.

  • integration_attributes (Optional[StringMap], default: None ) –

    Provider-specific attributes to associate with the integration.

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

    The Amazon Resource Name of the IAM role assumed to access the integration.

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

    Tags to apply to the integration at creation time (Tagris tag-on-create).

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

    Idempotency token for safe retries. Retrying with the same token returns the original integration instead of creating a duplicate.

Raises:

Examples:

Create an AWS integration The following example creates an AWS_INTEGRATION named my-aws-integration, authorized by an IAM role. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.create_integration(integration_type='AWS_INTEGRATION', name='my-aws-integration', role_arn='arn:aws:iam::123456789012:role/service-role/CloudWatchIntegrationRole', client_token='b3f8c7d6-5b4a-4c3d-9e2f-1a0b2c3d4e5f')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def create_integration(
    self,
    integration_type: "capo_cloudwatchomni.types.integration_type.IntegrationType",
    name: str,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    credential: Optional[
        "capo_cloudwatchomni.types.integration_credential.IntegrationCredential"
    ] = None,
    integration_attributes: Optional[
        "capo_cloudwatchomni.types.string_map.StringMap"
    ] = None,
    role_arn: Optional[str] = None,
    tags: Optional["capo_cloudwatchomni.types.tag_map.TagMap"] = None,
    client_token: Optional[str] = None,
) -> "capo_cloudwatchomni.types.create_integration_output.CreateIntegrationOutput":
    """Creates an integration with a third-party provider. Returns the integration identifier and its initial status; when the provider requires interactive consent, an authorization URL is returned for the user to complete setup.

    Args:
        integration_type: The type of third-party provider to integrate with.
        name: The name for the new integration; unique within the account.
        credential: The credential used to authenticate with the third-party provider.
        integration_attributes: Provider-specific attributes to associate with the integration.
        role_arn: The Amazon Resource Name of the IAM role assumed to access the integration.
        tags: Tags to apply to the integration at creation time (Tagris tag-on-create).
        client_token: Idempotency token for safe retries. Retrying with the same token returns the original integration instead of creating a duplicate.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        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:
        Create an AWS integration
        The following example creates an AWS_INTEGRATION named my-aws-integration, authorized by an IAM role. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.create_integration(integration_type='AWS_INTEGRATION', name='my-aws-integration', role_arn='arn:aws:iam::123456789012:role/service-role/CloudWatchIntegrationRole', client_token='b3f8c7d6-5b4a-4c3d-9e2f-1a0b2c3d4e5f')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.create_integration_input.CreateIntegrationInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.create_integration_output.CreateIntegrationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_integration

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

    def _redact_input(
        input_: "capo_cloudwatchomni.types.create_integration_input.CreateIntegrationInput",
    ) -> dict[str, Any]:
        import capo_cloudwatchomni.types.create_integration_input

        return capo_cloudwatchomni.types.create_integration_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateIntegration", redact_input=_redact_input),
    )
    input_: capo_cloudwatchomni.types.create_integration_input.CreateIntegrationInput = {
        "integration_type": integration_type,
        "name": name,
    }
    if credential is not None:
        input_["credential"] = credential
    if integration_attributes is not None:
        input_["integration_attributes"] = integration_attributes
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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