Skip to content

Commit

Permalink
feat: [google-cloud-build] Add PrivateServiceConnect option to Worker…
Browse files Browse the repository at this point in the history
…Pool (#13221)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 690046730

Source-Link:
googleapis/googleapis@48d30c4

Source-Link:
googleapis/googleapis-gen@2e1af9f
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJ1aWxkLy5Pd2xCb3QueWFtbCIsImgiOiIyZTFhZjlmMjA0Y2MyZjEzZjA3YmNhMWY1M2VkMmUyMTUxYTljNDhkIn0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 28, 2024
1 parent c2d1df7 commit 629b927
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.26.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.26.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class CloudBuildAsyncClient:
)
network_path = staticmethod(CloudBuildClient.network_path)
parse_network_path = staticmethod(CloudBuildClient.parse_network_path)
network_attachment_path = staticmethod(CloudBuildClient.network_attachment_path)
parse_network_attachment_path = staticmethod(
CloudBuildClient.parse_network_attachment_path
)
repository_path = staticmethod(CloudBuildClient.repository_path)
parse_repository_path = staticmethod(CloudBuildClient.parse_repository_path)
secret_version_path = staticmethod(CloudBuildClient.secret_version_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,28 @@ def parse_network_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def network_attachment_path(
project: str,
region: str,
networkattachment: str,
) -> str:
"""Returns a fully-qualified network_attachment string."""
return "projects/{project}/regions/{region}/networkAttachments/{networkattachment}".format(
project=project,
region=region,
networkattachment=networkattachment,
)

@staticmethod
def parse_network_attachment_path(path: str) -> Dict[str, str]:
"""Parses a network_attachment path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/regions/(?P<region>.+?)/networkAttachments/(?P<networkattachment>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def repository_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3702,6 +3702,9 @@ class PrivatePoolV1Config(proto.Message):
pool.
network_config (google.cloud.devtools.cloudbuild_v1.types.PrivatePoolV1Config.NetworkConfig):
Network configuration for the pool.
private_service_connect (google.cloud.devtools.cloudbuild_v1.types.PrivatePoolV1Config.PrivateServiceConnect):
Immutable. Private Service Connect(PSC)
Network configuration for the pool.
"""

class WorkerConfig(proto.Message):
Expand Down Expand Up @@ -3791,6 +3794,55 @@ class EgressOption(proto.Enum):
number=3,
)

class PrivateServiceConnect(proto.Message):
r"""Defines the Private Service Connect network configuration for
the pool.
Attributes:
network_attachment (str):
Required. Immutable. The network attachment that the worker
network interface is peered to. Must be in the format
``projects/{project}/regions/{region}/networkAttachments/{networkAttachment}``.
The region of network attachment must be the same as the
worker pool. See `Network
Attachments <https://cloud.google.com/vpc/docs/about-network-attachments>`__
public_ip_address_disabled (bool):
Required. Immutable. Disable public IP on the primary
network interface.
If true, workers are created without any public address,
which prevents network egress to public IPs unless a network
proxy is configured. If false, workers are created with a
public address which allows for public internet egress. The
public address only applies to traffic through the primary
network interface. If ``route_all_traffic`` is set to true,
all traffic will go through the non-primary network
interface, this boolean has no effect.
route_all_traffic (bool):
Immutable. Route all traffic through PSC
interface. Enable this if you want full control
of traffic in the private pool. Configure Cloud
NAT for the subnet of network attachment if you
need to access public Internet.
If false, Only route private IPs, e.g.
10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16
through PSC interface.
"""

network_attachment: str = proto.Field(
proto.STRING,
number=1,
)
public_ip_address_disabled: bool = proto.Field(
proto.BOOL,
number=2,
)
route_all_traffic: bool = proto.Field(
proto.BOOL,
number=3,
)

worker_config: WorkerConfig = proto.Field(
proto.MESSAGE,
number=1,
Expand All @@ -3801,6 +3853,11 @@ class EgressOption(proto.Enum):
number=2,
message=NetworkConfig,
)
private_service_connect: PrivateServiceConnect = proto.Field(
proto.MESSAGE,
number=5,
message=PrivateServiceConnect,
)


class CreateWorkerPoolRequest(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.26.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-build",
"version": "3.26.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-build",
"version": "3.26.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Loading

0 comments on commit 629b927

Please sign in to comment.