Skip to content

Commit

Permalink
feat: [google-cloud-build] Add Bitbucket Data Center Config and Bitbu…
Browse files Browse the repository at this point in the history
…cket Cloud config for Cloud Build Repositories (#12454)

BEGIN_COMMIT_OVERRIDE
feat: Add Bitbucket Data Center Config and Bitbucket Cloud config for
Cloud Build Repositories
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 615470832

Source-Link:
googleapis/googleapis@98cbc7d

Source-Link:
googleapis/googleapis-gen@c056f3f
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJ1aWxkLy5Pd2xCb3QueWFtbCIsImgiOiJjMDU2ZjNmNzZjN2E4ODNmNmNiMjNjY2VjYmNlMzM5ODY2NTFjNWM3In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people committed Mar 15, 2024
1 parent 55bf59f commit 6994587
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 15 deletions.
Expand Up @@ -26,6 +26,8 @@
from .types.repositories import (
BatchCreateRepositoriesRequest,
BatchCreateRepositoriesResponse,
BitbucketCloudConfig,
BitbucketDataCenterConfig,
Connection,
CreateConnectionRequest,
CreateRepositoryRequest,
Expand Down Expand Up @@ -61,6 +63,8 @@
"RepositoryManagerAsyncClient",
"BatchCreateRepositoriesRequest",
"BatchCreateRepositoriesResponse",
"BitbucketCloudConfig",
"BitbucketDataCenterConfig",
"Connection",
"CreateConnectionRequest",
"CreateRepositoryRequest",
Expand Down
Expand Up @@ -349,8 +349,8 @@ async def sample_create_connection():
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or
GitLab.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center,
Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -467,8 +467,8 @@ async def sample_get_connection():
Returns:
google.cloud.devtools.cloudbuild_v2.types.Connection:
A connection to a SCM like GitHub,
GitHub Enterprise, Bitbucket Server or
GitLab.
GitHub Enterprise, Bitbucket Data
Center, Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -716,8 +716,8 @@ async def sample_update_connection():
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or
GitLab.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center,
Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down
Expand Up @@ -826,8 +826,8 @@ def sample_create_connection():
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or
GitLab.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center,
Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -944,8 +944,8 @@ def sample_get_connection():
Returns:
google.cloud.devtools.cloudbuild_v2.types.Connection:
A connection to a SCM like GitHub,
GitHub Enterprise, Bitbucket Server or
GitLab.
GitHub Enterprise, Bitbucket Data
Center, Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -1175,8 +1175,8 @@ def sample_update_connection():
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Server or
GitLab.
The result type for the operation will be :class:`google.cloud.devtools.cloudbuild_v2.types.Connection` A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center,
Bitbucket Cloud or GitLab.
"""
# Create or coerce a protobuf request object.
Expand Down
Expand Up @@ -1636,8 +1636,8 @@ def __call__(
Returns:
~.repositories.Connection:
A connection to a SCM like GitHub,
GitHub Enterprise, Bitbucket Server or
GitLab.
GitHub Enterprise, Bitbucket Data
Center, Bitbucket Cloud or GitLab.
"""

Expand Down
Expand Up @@ -17,6 +17,8 @@
from .repositories import (
BatchCreateRepositoriesRequest,
BatchCreateRepositoriesResponse,
BitbucketCloudConfig,
BitbucketDataCenterConfig,
Connection,
CreateConnectionRequest,
CreateRepositoryRequest,
Expand Down Expand Up @@ -53,6 +55,8 @@
"RunWorkflowCustomOperationMetadata",
"BatchCreateRepositoriesRequest",
"BatchCreateRepositoriesResponse",
"BitbucketCloudConfig",
"BitbucketDataCenterConfig",
"Connection",
"CreateConnectionRequest",
"CreateRepositoryRequest",
Expand Down
Expand Up @@ -32,6 +32,8 @@
"GitHubConfig",
"GitHubEnterpriseConfig",
"GitLabConfig",
"BitbucketDataCenterConfig",
"BitbucketCloudConfig",
"ServiceDirectoryConfig",
"Repository",
"OAuthCredential",
Expand Down Expand Up @@ -62,7 +64,7 @@

class Connection(proto.Message):
r"""A connection to a SCM like GitHub, GitHub Enterprise,
Bitbucket Server or GitLab.
Bitbucket Data Center, Bitbucket Cloud or GitLab.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Expand Down Expand Up @@ -95,6 +97,16 @@ class Connection(proto.Message):
Configuration for connections to gitlab.com
or an instance of GitLab Enterprise.
This field is a member of `oneof`_ ``connection_config``.
bitbucket_data_center_config (google.cloud.devtools.cloudbuild_v2.types.BitbucketDataCenterConfig):
Configuration for connections to Bitbucket
Data Center.
This field is a member of `oneof`_ ``connection_config``.
bitbucket_cloud_config (google.cloud.devtools.cloudbuild_v2.types.BitbucketCloudConfig):
Configuration for connections to Bitbucket
Cloud.
This field is a member of `oneof`_ ``connection_config``.
installation_state (google.cloud.devtools.cloudbuild_v2.types.InstallationState):
Output only. Installation state of the
Expand Down Expand Up @@ -150,6 +162,18 @@ class Connection(proto.Message):
oneof="connection_config",
message="GitLabConfig",
)
bitbucket_data_center_config: "BitbucketDataCenterConfig" = proto.Field(
proto.MESSAGE,
number=8,
oneof="connection_config",
message="BitbucketDataCenterConfig",
)
bitbucket_cloud_config: "BitbucketCloudConfig" = proto.Field(
proto.MESSAGE,
number=9,
oneof="connection_config",
message="BitbucketCloudConfig",
)
installation_state: "InstallationState" = proto.Field(
proto.MESSAGE,
number=12,
Expand Down Expand Up @@ -465,6 +489,116 @@ class GitLabConfig(proto.Message):
)


class BitbucketDataCenterConfig(proto.Message):
r"""Configuration for connections to Bitbucket Data Center.
Attributes:
host_uri (str):
Required. The URI of the Bitbucket Data
Center instance or cluster this connection is
for.
webhook_secret_secret_version (str):
Required. Immutable. SecretManager resource containing the
webhook secret used to verify webhook events, formatted as
``projects/*/secrets/*/versions/*``.
read_authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
Required. A http access token with the ``REPO_READ`` access.
authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
Required. A http access token with the ``REPO_ADMIN`` scope
access.
service_directory_config (google.cloud.devtools.cloudbuild_v2.types.ServiceDirectoryConfig):
Optional. Configuration for using Service
Directory to privately connect to a Bitbucket
Data Center. This should only be set if the
Bitbucket Data Center is hosted on-premises and
not reachable by public internet. If this field
is left empty, calls to the Bitbucket Data
Center will be made over the public internet.
ssl_ca (str):
Optional. SSL certificate to use for requests
to the Bitbucket Data Center.
server_version (str):
Output only. Version of the Bitbucket Data Center running on
the ``host_uri``.
"""

host_uri: str = proto.Field(
proto.STRING,
number=1,
)
webhook_secret_secret_version: str = proto.Field(
proto.STRING,
number=2,
)
read_authorizer_credential: "UserCredential" = proto.Field(
proto.MESSAGE,
number=3,
message="UserCredential",
)
authorizer_credential: "UserCredential" = proto.Field(
proto.MESSAGE,
number=4,
message="UserCredential",
)
service_directory_config: "ServiceDirectoryConfig" = proto.Field(
proto.MESSAGE,
number=5,
message="ServiceDirectoryConfig",
)
ssl_ca: str = proto.Field(
proto.STRING,
number=6,
)
server_version: str = proto.Field(
proto.STRING,
number=7,
)


class BitbucketCloudConfig(proto.Message):
r"""Configuration for connections to Bitbucket Cloud.
Attributes:
workspace (str):
Required. The Bitbucket Cloud Workspace ID to
be connected to Google Cloud Platform.
webhook_secret_secret_version (str):
Required. SecretManager resource containing the webhook
secret used to verify webhook events, formatted as
``projects/*/secrets/*/versions/*``.
read_authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
Required. An access token with the ``repository`` access. It
can be either a workspace, project or repository access
token. It's recommended to use a system account to generate
the credentials.
authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
Required. An access token with the ``webhook``,
``repository``, ``repository:admin`` and ``pullrequest``
scope access. It can be either a workspace, project or
repository access token. It's recommended to use a system
account to generate these credentials.
"""

workspace: str = proto.Field(
proto.STRING,
number=1,
)
webhook_secret_secret_version: str = proto.Field(
proto.STRING,
number=2,
)
read_authorizer_credential: "UserCredential" = proto.Field(
proto.MESSAGE,
number=3,
message="UserCredential",
)
authorizer_credential: "UserCredential" = proto.Field(
proto.MESSAGE,
number=4,
message="UserCredential",
)


class ServiceDirectoryConfig(proto.Message):
r"""ServiceDirectoryConfig represents Service Directory
configuration for a connection.
Expand Down
Expand Up @@ -5146,6 +5146,21 @@ def test_create_connection_rest(request_type):
"ssl_ca": "ssl_ca_value",
"server_version": "server_version_value",
},
"bitbucket_data_center_config": {
"host_uri": "host_uri_value",
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
"read_authorizer_credential": {},
"authorizer_credential": {},
"service_directory_config": {},
"ssl_ca": "ssl_ca_value",
"server_version": "server_version_value",
},
"bitbucket_cloud_config": {
"workspace": "workspace_value",
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
"read_authorizer_credential": {},
"authorizer_credential": {},
},
"installation_state": {
"stage": 1,
"message": "message_value",
Expand Down Expand Up @@ -6162,6 +6177,21 @@ def test_update_connection_rest(request_type):
"ssl_ca": "ssl_ca_value",
"server_version": "server_version_value",
},
"bitbucket_data_center_config": {
"host_uri": "host_uri_value",
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
"read_authorizer_credential": {},
"authorizer_credential": {},
"service_directory_config": {},
"ssl_ca": "ssl_ca_value",
"server_version": "server_version_value",
},
"bitbucket_cloud_config": {
"workspace": "workspace_value",
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
"read_authorizer_credential": {},
"authorizer_credential": {},
},
"installation_state": {
"stage": 1,
"message": "message_value",
Expand Down

0 comments on commit 6994587

Please sign in to comment.