SecurityAgent / Client / create_integration

create_integration

SecurityAgent.Client.create_integration(**kwargs)

Creates a new integration with a third-party provider, such as GitHub, for code review and remediation.

See also: AWS API Documentation

Request Syntax

response = client.create_integration(
    provider='GITHUB'|'GITLAB'|'BITBUCKET'|'CONFLUENCE',
    input={
        'github': {
            'code': 'string',
            'state': 'string',
            'organizationName': 'string',
            'targetUrl': 'string',
            'installationId': 'string'
        },
        'gitlab': {
            'accessToken': 'string',
            'targetUrl': 'string',
            'tokenType': 'PERSONAL'|'GROUP',
            'groupId': 'string'
        },
        'bitbucket': {
            'installationId': 'string',
            'workspace': 'string',
            'code': 'string',
            'state': 'string'
        },
        'confluence': {
            'installationId': 'string',
            'code': 'string',
            'state': 'string',
            'siteUrl': 'string'
        }
    },
    integrationDisplayName='string',
    kmsKeyId='string',
    tags={
        'string': 'string'
    },
    privateConnectionName='string'
)
Parameters:
  • provider (string) –

    [REQUIRED]

    The integration provider. Currently, only GITHUB is supported.

  • input (dict) –

    [REQUIRED]

    The provider-specific input required to create the integration.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: github, gitlab, bitbucket, confluence.

    • github (dict) –

      The GitHub-specific input for creating an integration.

      • code (string) – [REQUIRED]

        The OAuth authorization code received from GitHub.

      • state (string) – [REQUIRED]

        The CSRF state token for validating the OAuth flow.

      • organizationName (string) –

        The name of the GitHub organization to integrate with.

      • targetUrl (string) –

        The HTTPS URL of a self-hosted GitHub Enterprise Server instance. Omit this value for GitHub.com.

      • installationId (string) –

        The installation identifier provided by GitHub Enterprise Server on the install callback. Required for GitHub Enterprise Server integrations and ignored for GitHub.com.

    • gitlab (dict) –

      The configuration for a GitLab integration.

      • accessToken (string) – [REQUIRED]

        The GitLab access token used to authenticate. This can be a personal access token or a group access token.

      • targetUrl (string) –

        The HTTPS URL of a self-managed GitLab instance. Omit this value for GitLab SaaS (gitlab.com).

      • tokenType (string) – [REQUIRED]

        The type of GitLab access token provided in accessToken.

      • groupId (string) –

        The identifier of the GitLab group. Required when tokenType is group and ignored for personal tokens.

    • bitbucket (dict) –

      The configuration for a Bitbucket integration.

      • installationId (string) – [REQUIRED]

        The Atlassian installation identifier, available from the Atlassian administration console.

      • workspace (string) – [REQUIRED]

        The Bitbucket workspace slug that identifies the workspace to integrate, for example acme-corp.

      • code (string) – [REQUIRED]

        The OAuth 2.0 authorization code returned from the consent redirect.

      • state (string) – [REQUIRED]

        The CSRF state token echoed back from the OAuth redirect.

    • confluence (dict) –

      The configuration for a Confluence integration.

      • installationId (string) – [REQUIRED]

        The Atlassian installation identifier, available from the Atlassian administration console.

      • code (string) – [REQUIRED]

        The OAuth 2.0 authorization code returned from the consent redirect.

      • state (string) – [REQUIRED]

        The CSRF state token echoed back from the OAuth redirect.

      • siteUrl (string) – [REQUIRED]

        The Confluence Cloud site URL, for example https://mysite.atlassian.net.

  • integrationDisplayName (string) –

    [REQUIRED]

    The display name for the integration.

  • kmsKeyId (string) – The identifier of the AWS KMS key to use for encrypting data associated with the integration.

  • tags (dict) –

    The tags to associate with the integration.

    • (string) –

      Key for a resource tag.

      • (string) –

        Value for a resource tag.

  • privateConnectionName (string) – The name of an active private connection used to reach a self-hosted provider instance over private networking. Specify this when the instance is not publicly reachable.

Return type:

dict

Returns:

Response Syntax

{
    'integrationId': 'string'
}

Response Structure

  • (dict) –

    • integrationId (string) –

      The unique identifier of the created integration.

Exceptions

  • SecurityAgent.Client.exceptions.ResourceNotFoundException

  • SecurityAgent.Client.exceptions.InternalServerException

  • SecurityAgent.Client.exceptions.ValidationException

  • SecurityAgent.Client.exceptions.ConflictException

  • SecurityAgent.Client.exceptions.ThrottlingException

  • SecurityAgent.Client.exceptions.AccessDeniedException