# -*- coding: utf-8 -*- #
# Copyright 2025 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This file is autogenerated and should not be edited by hand.
# AUTOGEN_CLI_VERSION: HEAD
- release_tracks:
  - GA
  auto_generated: true
  help_text:
    brief: Create a connection resource
    description: |
      Create a connection resource.
    examples: |-
      To create a GitHub connection named `my-connection` in `us-central1` run:

      $ {command} my-connection --github-config-app=developer-connect --github-config-authorizer-credential-oauth-token-secret-version=projects/my-project/secrets/my-oauth-token/versions/1 --github-config-app-installation-id=12345 --location=us-central1
  arguments:
    params:
    - group:
        mutex: true
        help_text: |-
          Arguments for the connection config.
        params:
        - group:
            api_field: connection.githubConfig
            required: false
            help_text: |-
              Configuration for connections to github.com.
            params:
            - arg_name: github-config-app
              api_field: connection.githubConfig.githubApp
              required: true
              help_text: |-
                The GitHub Application that was installed to the GitHub user or
                organization.
              choices:
              - arg_value: developer-connect
                enum_value: DEVELOPER_CONNECT
                help_text: |-
                  The Developer Connect GitHub Application.
              - arg_value: firebase
                enum_value: FIREBASE
                help_text: |-
                  The Firebase GitHub Application.
            - group:
                api_field: connection.githubConfig.authorizerCredential
                required: false
                help_text: |-
                  Represents an OAuth token of the account that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: github-config-authorizer-credential-oauth-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the OAuth token that authorizes
                    the connection. Format: `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.githubConfig.authorizerCredential.oauthTokenSecretVersion: '{__relative_name__}'
                  required: true
            - arg_name: github-config-app-installation-id
              api_field: connection.githubConfig.appInstallationId
              required: false
              repeated: false
              type: long
              help_text: |-
                GitHub App installation id.
        - group:
            api_field: connection.githubEnterpriseConfig
            required: false
            help_text: |-
              Configuration for connections to an instance of GitHub Enterprise.
            params:
            - arg_name: github-enterprise-config-host-uri
              api_field: connection.githubEnterpriseConfig.hostUri
              required: true
              repeated: false
              help_text: |-
                The URI of the GitHub Enterprise host this connection is for.
            - arg_name: github-enterprise-config-app-id
              api_field: connection.githubEnterpriseConfig.appId
              required: false
              repeated: false
              type: long
              help_text: |-
                ID of the GitHub App created from the manifest.
            - arg_name: github-enterprise-config-private-key-secret-version
              help_text: |-
                SecretManager resource containing the private key of the GitHub App,
                formatted as `projects/*/secrets/*/versions/*`.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.githubEnterpriseConfig.privateKeySecretVersion: '{__relative_name__}'
              required: false
            - arg_name: github-enterprise-config-webhook-secret-version
              help_text: |-
                SecretManager resource containing the webhook secret of the GitHub App,
                formatted as `projects/*/secrets/*/versions/*`.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.githubEnterpriseConfig.webhookSecretSecretVersion: '{__relative_name__}'
              required: false
            - arg_name: github-enterprise-config-app-installation-id
              api_field: connection.githubEnterpriseConfig.appInstallationId
              required: false
              repeated: false
              type: long
              help_text: |-
                ID of the installation of the GitHub App.
            - group:
                api_field: connection.githubEnterpriseConfig.serviceDirectoryConfig
                required: false
                help_text: |-
                  ServiceDirectoryConfig represents Service Directory configuration for a
                  connection.
                params:
                - arg_name: github-enterprise-config-service-directory
                  help_text: |-
                    The Service Directory service name.
                    Format:
                    projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_locations_namespaces_services
                  resource_method_params:
                    connection.githubEnterpriseConfig.serviceDirectoryConfig.service: '{__relative_name__}'
                  required: true
            - arg_name: github-enterprise-config-ssl-ca-certificate
              api_field: connection.githubEnterpriseConfig.sslCaCertificate
              required: false
              repeated: false
              help_text: |-
                SSL certificate to use for requests to GitHub Enterprise.
        - group:
            api_field: connection.gitlabConfig
            required: false
            help_text: |-
              Configuration for connections to gitlab.com.
            params:
            - arg_name: gitlab-config-webhook-secret-version
              help_text: |-
                SecretManager resource containing the webhook secret of a GitLab project,
                formatted as `projects/*/secrets/*/versions/*`. This is used to validate
                webhooks.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.gitlabConfig.webhookSecretSecretVersion: '{__relative_name__}'
              required: true
            - group:
                api_field: connection.gitlabConfig.readAuthorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: gitlab-config-read-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.gitlabConfig.readAuthorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.gitlabConfig.authorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: gitlab-config-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.gitlabConfig.authorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
        - group:
            api_field: connection.gitlabEnterpriseConfig
            required: false
            help_text: |-
              Configuration for connections to an instance of GitLab Enterprise.
            params:
            - arg_name: gitlab-enterprise-config-host-uri
              api_field: connection.gitlabEnterpriseConfig.hostUri
              required: true
              repeated: false
              help_text: |-
                The URI of the GitLab Enterprise host this connection is for.
            - arg_name: gitlab-enterprise-config-webhook-secret-version
              help_text: |-
                SecretManager resource containing the webhook secret of a GitLab project,
                formatted as `projects/*/secrets/*/versions/*`. This is used to validate
                webhooks.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.gitlabEnterpriseConfig.webhookSecretSecretVersion: '{__relative_name__}'
              required: true
            - group:
                api_field: connection.gitlabEnterpriseConfig.readAuthorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: gitlab-enterprise-config-read-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.gitlabEnterpriseConfig.readAuthorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.gitlabEnterpriseConfig.authorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: gitlab-enterprise-config-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.gitlabEnterpriseConfig.authorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.gitlabEnterpriseConfig.serviceDirectoryConfig
                required: false
                help_text: |-
                  ServiceDirectoryConfig represents Service Directory configuration for a
                  connection.
                params:
                - arg_name: gitlab-enterprise-config-service-directory
                  help_text: |-
                    The Service Directory service name.
                    Format:
                    projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_locations_namespaces_services
                  resource_method_params:
                    connection.gitlabEnterpriseConfig.serviceDirectoryConfig.service: '{__relative_name__}'
                  required: true
            - arg_name: gitlab-enterprise-config-ssl-ca-certificate
              api_field: connection.gitlabEnterpriseConfig.sslCaCertificate
              required: false
              repeated: false
              help_text: |-
                SSL Certificate Authority certificate to use for requests to GitLab
                Enterprise instance.
        - group:
            api_field: connection.bitbucketDataCenterConfig
            required: false
            help_text: |-
              Configuration for connections to an instance of Bitbucket Data Center.
            params:
            - arg_name: bitbucket-data-center-config-host-uri
              api_field: connection.bitbucketDataCenterConfig.hostUri
              required: true
              repeated: false
              help_text: |-
                The URI of the Bitbucket Data Center host this connection is for.
            - arg_name: bitbucket-data-center-config-webhook-secret-version
              help_text: |-
                SecretManager resource containing the webhook secret used to verify webhook
                events, formatted as `projects/*/secrets/*/versions/*`. This is used to
                validate webhooks.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.bitbucketDataCenterConfig.webhookSecretSecretVersion: '{__relative_name__}'
              required: true
            - group:
                api_field: connection.bitbucketDataCenterConfig.readAuthorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: bitbucket-data-center-config-read-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.bitbucketDataCenterConfig.readAuthorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.bitbucketDataCenterConfig.authorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: bitbucket-data-center-config-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.bitbucketDataCenterConfig.authorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.bitbucketDataCenterConfig.serviceDirectoryConfig
                required: false
                help_text: |-
                  ServiceDirectoryConfig represents Service Directory configuration for a
                  connection.
                params:
                - arg_name: bitbucket-data-center-config-service-directory
                  help_text: |-
                    The Service Directory service name.
                    Format:
                    projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_locations_namespaces_services
                  resource_method_params:
                    connection.bitbucketDataCenterConfig.serviceDirectoryConfig.service: '{__relative_name__}'
                  required: true
            - arg_name: bitbucket-data-center-config-ssl-ca-certificate
              api_field: connection.bitbucketDataCenterConfig.sslCaCertificate
              required: false
              repeated: false
              help_text: |-
                SSL certificate authority to trust when making requests to Bitbucket Data
                Center.
        - group:
            api_field: connection.bitbucketCloudConfig
            required: false
            help_text: |-
              Configuration for connections to an instance of Bitbucket Cloud.
            params:
            - arg_name: bitbucket-cloud-config-workspace
              api_field: connection.bitbucketCloudConfig.workspace
              required: true
              repeated: false
              help_text: |-
                The Bitbucket Cloud Workspace ID to be connected to Google Cloud Platform.
            - arg_name: bitbucket-cloud-config-webhook-secret-version
              help_text: |-
                SecretManager resource containing the webhook secret used to verify webhook
                events, formatted as `projects/*/secrets/*/versions/*`. This is used to
                validate and create webhooks.
              is_positional: false
              is_primary_resource: false
              resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
              resource_method_params:
                connection.bitbucketCloudConfig.webhookSecretSecretVersion: '{__relative_name__}'
              required: true
            - group:
                api_field: connection.bitbucketCloudConfig.readAuthorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: bitbucket-cloud-config-read-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.bitbucketCloudConfig.readAuthorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
            - group:
                api_field: connection.bitbucketCloudConfig.authorizerCredential
                required: true
                help_text: |-
                  Represents a personal access token that authorized the Connection,
                  and associated metadata.
                params:
                - arg_name: bitbucket-cloud-config-authorizer-credential-user-token-secret-version
                  help_text: |-
                    A SecretManager resource containing the user token that authorizes
                    the Developer Connect connection. Format:
                    `projects/*/secrets/*/versions/*`.
                  is_positional: false
                  is_primary_resource: false
                  resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_secrets_versions
                  resource_method_params:
                    connection.bitbucketCloudConfig.authorizerCredential.userTokenSecretVersion: '{__relative_name__}'
                  required: true
    - help_text: |-
        Identifier. The resource name of the connection, in the format
        `projects/{project}/locations/{location}/connections/{connection_id}`.
      is_positional: true
      is_primary_resource: true
      request_id_field: connectionId
      resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_locations_connections
      required: true
    - arg_name: labels
      api_field: connection.labels
      required: false
      repeated: true
      help_text: |-
        Labels as key value pairs
      spec:
      - api_field: key
      - api_field: value
    - arg_name: disabled
      api_field: connection.disabled
      action: store_true
      required: false
      type: bool
      help_text: |-
        If disabled is set to true, functionality is disabled for this connection.
        Repository based API methods and webhooks processing for repositories in
        this connection will be disabled.
      default: null
    - arg_name: annotations
      api_field: connection.annotations
      required: false
      repeated: true
      help_text: |-
        Allows clients to store small amounts of arbitrary data.
      spec:
      - api_field: key
      - api_field: value
    - arg_name: etag
      api_field: connection.etag
      required: false
      repeated: false
      help_text: |-
        This checksum is computed by the server based on the value of other
        fields, and may be sent on update and delete requests to ensure the
        client has an up-to-date value before proceeding.
    - group:
        api_field: connection.cryptoKeyConfig
        required: false
        help_text: |-
          The crypto key configuration. This field is used by the Customer-managed
          encryption keys (CMEK) feature.
        params:
        - arg_name: crypto-key-config-reference
          help_text: |-
            The name of the key which is used to encrypt/decrypt customer data. For key
            in Cloud KMS, the key should be in the format of
            `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
          is_positional: false
          is_primary_resource: false
          resource_spec: !REF googlecloudsdk.command_lib.developer_connect.v1_resources:projects_locations_key_rings_crypto_keys
          resource_method_params:
            connection.cryptoKeyConfig.keyReference: '{__relative_name__}'
          required: true
    - group:
        api_field: connection.gitProxyConfig
        required: false
        help_text: |-
          The git proxy configuration.
        params:
        - arg_name: git-proxy-config-enabled
          api_field: connection.gitProxyConfig.enabled
          action: store_true
          required: false
          type: bool
          help_text: |-
            Setting this to true allows the git proxy to be used for performing git
            operations on the repositories linked in the connection.
          default: null
    - arg_name: request-id
      api_field: requestId
      required: false
      repeated: false
      help_text: |-
        An optional request ID to identify requests. Specify a unique request ID
        so that if you must retry your request, the server will know to ignore
        the request if it has already been completed. The server will guarantee
        that for at least 60 minutes since the first request.

        For example, consider a situation where you make an initial request and the
        request times out. If you make the request again with the same request
        ID, the server can check if original operation with the same request ID
        was received, and if so, will ignore the second request. This prevents
        clients from accidentally creating duplicate commitments.

        The request ID must be a valid UUID with the exception that zero UUID is
        not supported (00000000-0000-0000-0000-000000000000).
    - arg_name: validate-only
      api_field: validateOnly
      action: store_true
      required: false
      type: bool
      help_text: |-
        If set, validate the request, but do not actually post it.
      default: null
  request:
    api_version: v1
    collection:
    - developerconnect.projects.locations.connections
  async:
    collection:
    - developerconnect.projects.locations.operations
  output:
    format: csv[no-heading,separator="\\n"](installationState.stage,installationState.message,installationState.actionUri)
