Skip to content

Commit

Permalink
feat: [google-cloud-alloydb] support for enabling outbound public IP …
Browse files Browse the repository at this point in the history
…on an instance (#13035)

BEGIN_COMMIT_OVERRIDE
feat: support for enabling outbound public IP on an instance
feat: support for getting outbound public IP addresses of an instance
feat: support for setting maintenance update policy on a cluster
feat: support for getting maintenance schedule of a cluster
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

feat: support for getting outbound public IP addresses of an instance
feat: support for setting maintenance update policy on a cluster
feat: support for getting maintenance schedule of a cluster

PiperOrigin-RevId: 667707701

Source-Link:
googleapis/googleapis@a1185ce

Source-Link:
googleapis/googleapis-gen@6ca9eb3
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFsbG95ZGIvLk93bEJvdC55YW1sIiwiaCI6IjZjYTllYjNhNjljMmMzM2ZjYTg2YjhmNDE1MGFiYTg0NjkyNGY5Y2IifQ==

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <[email protected]>
  • Loading branch information
3 people authored Sep 3, 2024
1 parent ea71725 commit 4f468fa
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
EncryptionInfo,
Instance,
InstanceView,
MaintenanceSchedule,
MaintenanceUpdatePolicy,
MigrationSource,
SslConfig,
SupportedDatabaseFlag,
Expand Down Expand Up @@ -142,6 +144,8 @@
"ListSupportedDatabaseFlagsResponse",
"ListUsersRequest",
"ListUsersResponse",
"MaintenanceSchedule",
"MaintenanceUpdatePolicy",
"MigrationSource",
"OperationMetadata",
"PromoteClusterRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
EncryptionInfo,
Instance,
InstanceView,
MaintenanceSchedule,
MaintenanceUpdatePolicy,
MigrationSource,
SslConfig,
SupportedDatabaseFlag,
Expand Down Expand Up @@ -95,6 +97,8 @@
"EncryptionConfig",
"EncryptionInfo",
"Instance",
"MaintenanceSchedule",
"MaintenanceUpdatePolicy",
"MigrationSource",
"SslConfig",
"SupportedDatabaseFlag",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"ContinuousBackupInfo",
"BackupSource",
"ContinuousBackupSource",
"MaintenanceUpdatePolicy",
"MaintenanceSchedule",
"Cluster",
"Instance",
"ConnectionInfo",
Expand Down Expand Up @@ -622,6 +624,69 @@ class ContinuousBackupSource(proto.Message):
)


class MaintenanceUpdatePolicy(proto.Message):
r"""MaintenanceUpdatePolicy defines the policy for system
updates.
Attributes:
maintenance_windows (MutableSequence[google.cloud.alloydb_v1beta.types.MaintenanceUpdatePolicy.MaintenanceWindow]):
Preferred windows to perform maintenance.
Currently limited to 1.
"""

class MaintenanceWindow(proto.Message):
r"""MaintenanceWindow specifies a preferred day and time for
maintenance.
Attributes:
day (google.type.dayofweek_pb2.DayOfWeek):
Preferred day of the week for maintenance,
e.g. MONDAY, TUESDAY, etc.
start_time (google.type.timeofday_pb2.TimeOfDay):
Preferred time to start the maintenance
operation on the specified day. Maintenance will
start within 1 hour of this time.
"""

day: dayofweek_pb2.DayOfWeek = proto.Field(
proto.ENUM,
number=1,
enum=dayofweek_pb2.DayOfWeek,
)
start_time: timeofday_pb2.TimeOfDay = proto.Field(
proto.MESSAGE,
number=2,
message=timeofday_pb2.TimeOfDay,
)

maintenance_windows: MutableSequence[MaintenanceWindow] = proto.RepeatedField(
proto.MESSAGE,
number=1,
message=MaintenanceWindow,
)


class MaintenanceSchedule(proto.Message):
r"""MaintenanceSchedule stores the maintenance schedule generated
from the MaintenanceUpdatePolicy, once a maintenance rollout is
triggered, if MaintenanceWindow is set, and if there is no
conflicting DenyPeriod. The schedule is cleared once the update
takes place. This field cannot be manually changed; modify the
MaintenanceUpdatePolicy instead.
Attributes:
start_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The scheduled start time for the
maintenance.
"""

start_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=1,
message=timestamp_pb2.Timestamp,
)


class Cluster(proto.Message):
r"""A cluster is a collection of regional AlloyDB resources. It
can include a primary instance and one or more read pool
Expand Down Expand Up @@ -693,7 +758,7 @@ class Cluster(proto.Message):
cluster resources are created and from which they are
accessible via Private IP. The network must belong to the
same project as the cluster. It is specified in the form:
"projects/{project}/global/networks/{network_id}". This is
``projects/{project}/global/networks/{network_id}``. This is
required to create a cluster. Deprecated, use
network_config.network instead.
etag (str):
Expand Down Expand Up @@ -752,6 +817,13 @@ class Cluster(proto.Message):
specific to PRIMARY cluster.
satisfies_pzs (bool):
Output only. Reserved for future use.
maintenance_update_policy (google.cloud.alloydb_v1beta.types.MaintenanceUpdatePolicy):
Optional. The maintenance update policy
determines when to allow or deny updates.
maintenance_schedule (google.cloud.alloydb_v1beta.types.MaintenanceSchedule):
Output only. The maintenance schedule for the
cluster, generated for a specific rollout if a
maintenance window is set.
"""

class State(proto.Enum):
Expand Down Expand Up @@ -830,7 +902,7 @@ class NetworkConfig(proto.Message):
cluster resources are created and from which they are
accessible via Private IP. The network must belong to the
same project as the cluster. It is specified in the form:
"projects/{project_number}/global/networks/{network_id}".
``projects/{project_number}/global/networks/{network_id}``.
This is required to create a cluster.
allocated_ip_range (str):
Optional. Name of the allocated IP range for the private IP
Expand Down Expand Up @@ -1014,6 +1086,16 @@ class PrimaryConfig(proto.Message):
proto.BOOL,
number=30,
)
maintenance_update_policy: "MaintenanceUpdatePolicy" = proto.Field(
proto.MESSAGE,
number=32,
message="MaintenanceUpdatePolicy",
)
maintenance_schedule: "MaintenanceSchedule" = proto.Field(
proto.MESSAGE,
number=37,
message="MaintenanceSchedule",
)


class Instance(proto.Message):
Expand Down Expand Up @@ -1147,6 +1229,9 @@ class Instance(proto.Message):
network_config (google.cloud.alloydb_v1beta.types.Instance.InstanceNetworkConfig):
Optional. Instance level network
configuration.
outbound_public_ip_addresses (MutableSequence[str]):
Output only. All outbound public IP addresses
configured for the instance.
"""

class State(proto.Enum):
Expand Down Expand Up @@ -1514,6 +1599,10 @@ class InstanceNetworkConfig(proto.Message):
enable_public_ip (bool):
Optional. Enabling public ip for the
instance.
enable_outbound_public_ip (bool):
Optional. Enabling an outbound public IP
address to support a database server sending
requests out into the internet.
"""

class AuthorizedNetwork(proto.Message):
Expand Down Expand Up @@ -1542,6 +1631,10 @@ class AuthorizedNetwork(proto.Message):
proto.BOOL,
number=2,
)
enable_outbound_public_ip: bool = proto.Field(
proto.BOOL,
number=3,
)

name: str = proto.Field(
proto.STRING,
Expand Down Expand Up @@ -1669,6 +1762,10 @@ class AuthorizedNetwork(proto.Message):
number=29,
message=InstanceNetworkConfig,
)
outbound_public_ip_addresses: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=34,
)


class ConnectionInfo(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4942,6 +4942,7 @@ def test_get_instance(request_type, transport: str = "grpc"):
reconciling=True,
etag="etag_value",
satisfies_pzs=True,
outbound_public_ip_addresses=["outbound_public_ip_addresses_value"],
)
response = client.get_instance(request)

Expand All @@ -4965,6 +4966,9 @@ def test_get_instance(request_type, transport: str = "grpc"):
assert response.reconciling is True
assert response.etag == "etag_value"
assert response.satisfies_pzs is True
assert response.outbound_public_ip_addresses == [
"outbound_public_ip_addresses_value"
]


def test_get_instance_empty_call():
Expand Down Expand Up @@ -5075,6 +5079,7 @@ async def test_get_instance_empty_call_async():
reconciling=True,
etag="etag_value",
satisfies_pzs=True,
outbound_public_ip_addresses=["outbound_public_ip_addresses_value"],
)
)
response = await client.get_instance()
Expand Down Expand Up @@ -5155,6 +5160,7 @@ async def test_get_instance_async(
reconciling=True,
etag="etag_value",
satisfies_pzs=True,
outbound_public_ip_addresses=["outbound_public_ip_addresses_value"],
)
)
response = await client.get_instance(request)
Expand All @@ -5179,6 +5185,9 @@ async def test_get_instance_async(
assert response.reconciling is True
assert response.etag == "etag_value"
assert response.satisfies_pzs is True
assert response.outbound_public_ip_addresses == [
"outbound_public_ip_addresses_value"
]


@pytest.mark.asyncio
Expand Down Expand Up @@ -15285,6 +15294,10 @@ def test_create_cluster_rest(request_type):
]
},
"satisfies_pzs": True,
"maintenance_update_policy": {
"maintenance_windows": [{"day": 1, "start_time": {}}]
},
"maintenance_schedule": {"start_time": {}},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -15766,6 +15779,10 @@ def test_update_cluster_rest(request_type):
]
},
"satisfies_pzs": True,
"maintenance_update_policy": {
"maintenance_windows": [{"day": 1, "start_time": {}}]
},
"maintenance_schedule": {"start_time": {}},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -17093,6 +17110,10 @@ def test_create_secondary_cluster_rest(request_type):
]
},
"satisfies_pzs": True,
"maintenance_update_policy": {
"maintenance_windows": [{"day": 1, "start_time": {}}]
},
"maintenance_schedule": {"start_time": {}},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -17909,6 +17930,7 @@ def test_get_instance_rest(request_type):
reconciling=True,
etag="etag_value",
satisfies_pzs=True,
outbound_public_ip_addresses=["outbound_public_ip_addresses_value"],
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -17936,6 +17958,9 @@ def test_get_instance_rest(request_type):
assert response.reconciling is True
assert response.etag == "etag_value"
assert response.satisfies_pzs is True
assert response.outbound_public_ip_addresses == [
"outbound_public_ip_addresses_value"
]


def test_get_instance_rest_use_cached_wrapped_rpc():
Expand Down Expand Up @@ -18283,7 +18308,12 @@ def test_create_instance_rest(request_type):
"network_config": {
"authorized_external_networks": [{"cidr_range": "cidr_range_value"}],
"enable_public_ip": True,
"enable_outbound_public_ip": True,
},
"outbound_public_ip_addresses": [
"outbound_public_ip_addresses_value1",
"outbound_public_ip_addresses_value2",
],
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -18759,7 +18789,12 @@ def test_create_secondary_instance_rest(request_type):
"network_config": {
"authorized_external_networks": [{"cidr_range": "cidr_range_value"}],
"enable_public_ip": True,
"enable_outbound_public_ip": True,
},
"outbound_public_ip_addresses": [
"outbound_public_ip_addresses_value1",
"outbound_public_ip_addresses_value2",
],
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -19249,7 +19284,12 @@ def test_batch_create_instances_rest(request_type):
{"cidr_range": "cidr_range_value"}
],
"enable_public_ip": True,
"enable_outbound_public_ip": True,
},
"outbound_public_ip_addresses": [
"outbound_public_ip_addresses_value1",
"outbound_public_ip_addresses_value2",
],
},
"request_id": "request_id_value",
"validate_only": True,
Expand Down Expand Up @@ -19654,7 +19694,12 @@ def test_update_instance_rest(request_type):
"network_config": {
"authorized_external_networks": [{"cidr_range": "cidr_range_value"}],
"enable_public_ip": True,
"enable_outbound_public_ip": True,
},
"outbound_public_ip_addresses": [
"outbound_public_ip_addresses_value1",
"outbound_public_ip_addresses_value2",
],
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down

0 comments on commit 4f468fa

Please sign in to comment.