Skip to content

Commit 6994587

Browse files
feat: [google-cloud-build] Add Bitbucket Data Center Config and Bitbucket 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>
1 parent 55bf59f commit 6994587

7 files changed

Lines changed: 187 additions & 15 deletions

File tree

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from .types.repositories import (
2727
BatchCreateRepositoriesRequest,
2828
BatchCreateRepositoriesResponse,
29+
BitbucketCloudConfig,
30+
BitbucketDataCenterConfig,
2931
Connection,
3032
CreateConnectionRequest,
3133
CreateRepositoryRequest,
@@ -61,6 +63,8 @@
6163
"RepositoryManagerAsyncClient",
6264
"BatchCreateRepositoriesRequest",
6365
"BatchCreateRepositoriesResponse",
66+
"BitbucketCloudConfig",
67+
"BitbucketDataCenterConfig",
6468
"Connection",
6569
"CreateConnectionRequest",
6670
"CreateRepositoryRequest",

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/services/repository_manager/async_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ async def sample_create_connection():
349349
google.api_core.operation_async.AsyncOperation:
350350
An object representing a long-running operation.
351351
352-
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
353-
GitLab.
352+
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,
353+
Bitbucket Cloud or GitLab.
354354
355355
"""
356356
# Create or coerce a protobuf request object.
@@ -467,8 +467,8 @@ async def sample_get_connection():
467467
Returns:
468468
google.cloud.devtools.cloudbuild_v2.types.Connection:
469469
A connection to a SCM like GitHub,
470-
GitHub Enterprise, Bitbucket Server or
471-
GitLab.
470+
GitHub Enterprise, Bitbucket Data
471+
Center, Bitbucket Cloud or GitLab.
472472
473473
"""
474474
# Create or coerce a protobuf request object.
@@ -716,8 +716,8 @@ async def sample_update_connection():
716716
google.api_core.operation_async.AsyncOperation:
717717
An object representing a long-running operation.
718718
719-
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
720-
GitLab.
719+
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,
720+
Bitbucket Cloud or GitLab.
721721
722722
"""
723723
# Create or coerce a protobuf request object.

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/services/repository_manager/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ def sample_create_connection():
826826
google.api_core.operation.Operation:
827827
An object representing a long-running operation.
828828
829-
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
830-
GitLab.
829+
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,
830+
Bitbucket Cloud or GitLab.
831831
832832
"""
833833
# Create or coerce a protobuf request object.
@@ -944,8 +944,8 @@ def sample_get_connection():
944944
Returns:
945945
google.cloud.devtools.cloudbuild_v2.types.Connection:
946946
A connection to a SCM like GitHub,
947-
GitHub Enterprise, Bitbucket Server or
948-
GitLab.
947+
GitHub Enterprise, Bitbucket Data
948+
Center, Bitbucket Cloud or GitLab.
949949
950950
"""
951951
# Create or coerce a protobuf request object.
@@ -1175,8 +1175,8 @@ def sample_update_connection():
11751175
google.api_core.operation.Operation:
11761176
An object representing a long-running operation.
11771177
1178-
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
1179-
GitLab.
1178+
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,
1179+
Bitbucket Cloud or GitLab.
11801180
11811181
"""
11821182
# Create or coerce a protobuf request object.

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/services/repository_manager/transports/rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,8 @@ def __call__(
16361636
Returns:
16371637
~.repositories.Connection:
16381638
A connection to a SCM like GitHub,
1639-
GitHub Enterprise, Bitbucket Server or
1640-
GitLab.
1639+
GitHub Enterprise, Bitbucket Data
1640+
Center, Bitbucket Cloud or GitLab.
16411641
16421642
"""
16431643

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from .repositories import (
1818
BatchCreateRepositoriesRequest,
1919
BatchCreateRepositoriesResponse,
20+
BitbucketCloudConfig,
21+
BitbucketDataCenterConfig,
2022
Connection,
2123
CreateConnectionRequest,
2224
CreateRepositoryRequest,
@@ -53,6 +55,8 @@
5355
"RunWorkflowCustomOperationMetadata",
5456
"BatchCreateRepositoriesRequest",
5557
"BatchCreateRepositoriesResponse",
58+
"BitbucketCloudConfig",
59+
"BitbucketDataCenterConfig",
5660
"Connection",
5761
"CreateConnectionRequest",
5862
"CreateRepositoryRequest",

packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/repositories.py

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
"GitHubConfig",
3333
"GitHubEnterpriseConfig",
3434
"GitLabConfig",
35+
"BitbucketDataCenterConfig",
36+
"BitbucketCloudConfig",
3537
"ServiceDirectoryConfig",
3638
"Repository",
3739
"OAuthCredential",
@@ -62,7 +64,7 @@
6264

6365
class Connection(proto.Message):
6466
r"""A connection to a SCM like GitHub, GitHub Enterprise,
65-
Bitbucket Server or GitLab.
67+
Bitbucket Data Center, Bitbucket Cloud or GitLab.
6668
6769
This message has `oneof`_ fields (mutually exclusive fields).
6870
For each oneof, at most one member field can be set at the same time.
@@ -95,6 +97,16 @@ class Connection(proto.Message):
9597
Configuration for connections to gitlab.com
9698
or an instance of GitLab Enterprise.
9799
100+
This field is a member of `oneof`_ ``connection_config``.
101+
bitbucket_data_center_config (google.cloud.devtools.cloudbuild_v2.types.BitbucketDataCenterConfig):
102+
Configuration for connections to Bitbucket
103+
Data Center.
104+
105+
This field is a member of `oneof`_ ``connection_config``.
106+
bitbucket_cloud_config (google.cloud.devtools.cloudbuild_v2.types.BitbucketCloudConfig):
107+
Configuration for connections to Bitbucket
108+
Cloud.
109+
98110
This field is a member of `oneof`_ ``connection_config``.
99111
installation_state (google.cloud.devtools.cloudbuild_v2.types.InstallationState):
100112
Output only. Installation state of the
@@ -150,6 +162,18 @@ class Connection(proto.Message):
150162
oneof="connection_config",
151163
message="GitLabConfig",
152164
)
165+
bitbucket_data_center_config: "BitbucketDataCenterConfig" = proto.Field(
166+
proto.MESSAGE,
167+
number=8,
168+
oneof="connection_config",
169+
message="BitbucketDataCenterConfig",
170+
)
171+
bitbucket_cloud_config: "BitbucketCloudConfig" = proto.Field(
172+
proto.MESSAGE,
173+
number=9,
174+
oneof="connection_config",
175+
message="BitbucketCloudConfig",
176+
)
153177
installation_state: "InstallationState" = proto.Field(
154178
proto.MESSAGE,
155179
number=12,
@@ -465,6 +489,116 @@ class GitLabConfig(proto.Message):
465489
)
466490

467491

492+
class BitbucketDataCenterConfig(proto.Message):
493+
r"""Configuration for connections to Bitbucket Data Center.
494+
495+
Attributes:
496+
host_uri (str):
497+
Required. The URI of the Bitbucket Data
498+
Center instance or cluster this connection is
499+
for.
500+
webhook_secret_secret_version (str):
501+
Required. Immutable. SecretManager resource containing the
502+
webhook secret used to verify webhook events, formatted as
503+
``projects/*/secrets/*/versions/*``.
504+
read_authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
505+
Required. A http access token with the ``REPO_READ`` access.
506+
authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
507+
Required. A http access token with the ``REPO_ADMIN`` scope
508+
access.
509+
service_directory_config (google.cloud.devtools.cloudbuild_v2.types.ServiceDirectoryConfig):
510+
Optional. Configuration for using Service
511+
Directory to privately connect to a Bitbucket
512+
Data Center. This should only be set if the
513+
Bitbucket Data Center is hosted on-premises and
514+
not reachable by public internet. If this field
515+
is left empty, calls to the Bitbucket Data
516+
Center will be made over the public internet.
517+
ssl_ca (str):
518+
Optional. SSL certificate to use for requests
519+
to the Bitbucket Data Center.
520+
server_version (str):
521+
Output only. Version of the Bitbucket Data Center running on
522+
the ``host_uri``.
523+
"""
524+
525+
host_uri: str = proto.Field(
526+
proto.STRING,
527+
number=1,
528+
)
529+
webhook_secret_secret_version: str = proto.Field(
530+
proto.STRING,
531+
number=2,
532+
)
533+
read_authorizer_credential: "UserCredential" = proto.Field(
534+
proto.MESSAGE,
535+
number=3,
536+
message="UserCredential",
537+
)
538+
authorizer_credential: "UserCredential" = proto.Field(
539+
proto.MESSAGE,
540+
number=4,
541+
message="UserCredential",
542+
)
543+
service_directory_config: "ServiceDirectoryConfig" = proto.Field(
544+
proto.MESSAGE,
545+
number=5,
546+
message="ServiceDirectoryConfig",
547+
)
548+
ssl_ca: str = proto.Field(
549+
proto.STRING,
550+
number=6,
551+
)
552+
server_version: str = proto.Field(
553+
proto.STRING,
554+
number=7,
555+
)
556+
557+
558+
class BitbucketCloudConfig(proto.Message):
559+
r"""Configuration for connections to Bitbucket Cloud.
560+
561+
Attributes:
562+
workspace (str):
563+
Required. The Bitbucket Cloud Workspace ID to
564+
be connected to Google Cloud Platform.
565+
webhook_secret_secret_version (str):
566+
Required. SecretManager resource containing the webhook
567+
secret used to verify webhook events, formatted as
568+
``projects/*/secrets/*/versions/*``.
569+
read_authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
570+
Required. An access token with the ``repository`` access. It
571+
can be either a workspace, project or repository access
572+
token. It's recommended to use a system account to generate
573+
the credentials.
574+
authorizer_credential (google.cloud.devtools.cloudbuild_v2.types.UserCredential):
575+
Required. An access token with the ``webhook``,
576+
``repository``, ``repository:admin`` and ``pullrequest``
577+
scope access. It can be either a workspace, project or
578+
repository access token. It's recommended to use a system
579+
account to generate these credentials.
580+
"""
581+
582+
workspace: str = proto.Field(
583+
proto.STRING,
584+
number=1,
585+
)
586+
webhook_secret_secret_version: str = proto.Field(
587+
proto.STRING,
588+
number=2,
589+
)
590+
read_authorizer_credential: "UserCredential" = proto.Field(
591+
proto.MESSAGE,
592+
number=3,
593+
message="UserCredential",
594+
)
595+
authorizer_credential: "UserCredential" = proto.Field(
596+
proto.MESSAGE,
597+
number=4,
598+
message="UserCredential",
599+
)
600+
601+
468602
class ServiceDirectoryConfig(proto.Message):
469603
r"""ServiceDirectoryConfig represents Service Directory
470604
configuration for a connection.

packages/google-cloud-build/tests/unit/gapic/cloudbuild_v2/test_repository_manager.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5146,6 +5146,21 @@ def test_create_connection_rest(request_type):
51465146
"ssl_ca": "ssl_ca_value",
51475147
"server_version": "server_version_value",
51485148
},
5149+
"bitbucket_data_center_config": {
5150+
"host_uri": "host_uri_value",
5151+
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
5152+
"read_authorizer_credential": {},
5153+
"authorizer_credential": {},
5154+
"service_directory_config": {},
5155+
"ssl_ca": "ssl_ca_value",
5156+
"server_version": "server_version_value",
5157+
},
5158+
"bitbucket_cloud_config": {
5159+
"workspace": "workspace_value",
5160+
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
5161+
"read_authorizer_credential": {},
5162+
"authorizer_credential": {},
5163+
},
51495164
"installation_state": {
51505165
"stage": 1,
51515166
"message": "message_value",
@@ -6162,6 +6177,21 @@ def test_update_connection_rest(request_type):
61626177
"ssl_ca": "ssl_ca_value",
61636178
"server_version": "server_version_value",
61646179
},
6180+
"bitbucket_data_center_config": {
6181+
"host_uri": "host_uri_value",
6182+
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
6183+
"read_authorizer_credential": {},
6184+
"authorizer_credential": {},
6185+
"service_directory_config": {},
6186+
"ssl_ca": "ssl_ca_value",
6187+
"server_version": "server_version_value",
6188+
},
6189+
"bitbucket_cloud_config": {
6190+
"workspace": "workspace_value",
6191+
"webhook_secret_secret_version": "webhook_secret_secret_version_value",
6192+
"read_authorizer_credential": {},
6193+
"authorizer_credential": {},
6194+
},
61656195
"installation_state": {
61666196
"stage": 1,
61676197
"message": "message_value",

0 commit comments

Comments
 (0)