Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
feat: add monitoring_config field (#236)
Browse files Browse the repository at this point in the history
* feat: add `monitoring_config` field
feat: add `force` on `DeleteMembershipRequest`
docs: update API annotation

PiperOrigin-RevId: 525780657

Source-Link: googleapis/googleapis@d3ceec8

Source-Link: googleapis/googleapis-gen@9b15e39
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWIxNWUzOTI3OGZhOWIyZDJmMTljMDlmN2M5MTZjYTdhYWMzMzZiZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

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] committed Apr 21, 2023
1 parent a45ae51 commit a77403d
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 17 deletions.
2 changes: 2 additions & 0 deletions google/cloud/gkehub_v1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
Membership,
MembershipEndpoint,
MembershipState,
MonitoringConfig,
MultiCloudCluster,
OnPremCluster,
OperationMetadata,
Expand Down Expand Up @@ -77,6 +78,7 @@
"Membership",
"MembershipEndpoint",
"MembershipState",
"MonitoringConfig",
"MultiCloudCluster",
"OnPremCluster",
"OperationMetadata",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class GkeHubMembershipServiceAsyncClient:
Kubernetes clusters to Google Cloud, represented with the
[Membership][google.cloud.gkehub.v1beta1.Membership] resource.
GKE Hub is currently only available in the global region.
GKE Hub is currently available in the global region and all regions
in https://cloud.google.com/compute/docs/regions-zones.
**Membership management may be non-trivial:** it is recommended to
use one of the Google-provided client libraries or tools where
Expand Down Expand Up @@ -286,7 +287,8 @@ async def sample_list_memberships():
parent (:class:`str`):
Required. The parent (project and location) where the
Memberships will be listed. Specified in the format
``projects/*/locations/*``.
``projects/*/locations/*``. ``projects/*/locations/-``
list memberships in all the regions.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -929,7 +931,7 @@ async def sample_generate_connect_manifest():
request (Optional[Union[google.cloud.gkehub_v1beta1.types.GenerateConnectManifestRequest, dict]]):
The request object. Request message for
``GkeHubMembershipService.GenerateConnectManifest``
method. .
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class GkeHubMembershipServiceClient(metaclass=GkeHubMembershipServiceClientMeta)
Kubernetes clusters to Google Cloud, represented with the
[Membership][google.cloud.gkehub.v1beta1.Membership] resource.
GKE Hub is currently only available in the global region.
GKE Hub is currently available in the global region and all regions
in https://cloud.google.com/compute/docs/regions-zones.
**Membership management may be non-trivial:** it is recommended to
use one of the Google-provided client libraries or tools where
Expand Down Expand Up @@ -510,7 +511,8 @@ def sample_list_memberships():
parent (str):
Required. The parent (project and location) where the
Memberships will be listed. Specified in the format
``projects/*/locations/*``.
``projects/*/locations/*``. ``projects/*/locations/-``
list memberships in all the regions.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -1153,7 +1155,7 @@ def sample_generate_connect_manifest():
request (Union[google.cloud.gkehub_v1beta1.types.GenerateConnectManifestRequest, dict]):
The request object. Request message for
``GkeHubMembershipService.GenerateConnectManifest``
method. .
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class GkeHubMembershipServiceGrpcTransport(GkeHubMembershipServiceTransport):
Kubernetes clusters to Google Cloud, represented with the
[Membership][google.cloud.gkehub.v1beta1.Membership] resource.
GKE Hub is currently only available in the global region.
GKE Hub is currently available in the global region and all regions
in https://cloud.google.com/compute/docs/regions-zones.
**Membership management may be non-trivial:** it is recommended to
use one of the Google-provided client libraries or tools where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class GkeHubMembershipServiceGrpcAsyncIOTransport(GkeHubMembershipServiceTranspo
Kubernetes clusters to Google Cloud, represented with the
[Membership][google.cloud.gkehub.v1beta1.Membership] resource.
GKE Hub is currently only available in the global region.
GKE Hub is currently available in the global region and all regions
in https://cloud.google.com/compute/docs/regions-zones.
**Membership management may be non-trivial:** it is recommended to
use one of the Google-provided client libraries or tools where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ class GkeHubMembershipServiceRestTransport(GkeHubMembershipServiceTransport):
Kubernetes clusters to Google Cloud, represented with the
[Membership][google.cloud.gkehub.v1beta1.Membership] resource.
GKE Hub is currently only available in the global region.
GKE Hub is currently available in the global region and all regions
in https://cloud.google.com/compute/docs/regions-zones.
**Membership management may be non-trivial:** it is recommended to
use one of the Google-provided client libraries or tools where
Expand Down Expand Up @@ -908,7 +909,7 @@ def __call__(
request (~.membership.GenerateConnectManifestRequest):
The request object. Request message for
``GkeHubMembershipService.GenerateConnectManifest``
method. .
method.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/gkehub_v1beta1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Membership,
MembershipEndpoint,
MembershipState,
MonitoringConfig,
MultiCloudCluster,
OnPremCluster,
OperationMetadata,
Expand Down Expand Up @@ -66,6 +67,7 @@
"Membership",
"MembershipEndpoint",
"MembershipState",
"MonitoringConfig",
"MultiCloudCluster",
"OnPremCluster",
"OperationMetadata",
Expand Down
79 changes: 77 additions & 2 deletions google/cloud/gkehub_v1beta1/types/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ApplianceCluster",
"KubernetesMetadata",
"Authority",
"MonitoringConfig",
"MembershipState",
"ListMembershipsRequest",
"ListMembershipsResponse",
Expand Down Expand Up @@ -135,6 +136,9 @@ class Membership(proto.Message):
infrastructure_type (google.cloud.gkehub_v1beta1.types.Membership.InfrastructureType):
Optional. The infrastructure type this
Membership is running on.
monitoring_config (google.cloud.gkehub_v1beta1.types.MonitoringConfig):
Optional. The monitoring config information
for this membership.
"""

class InfrastructureType(proto.Enum):
Expand Down Expand Up @@ -224,6 +228,11 @@ class InfrastructureType(proto.Enum):
number=13,
enum=InfrastructureType,
)
monitoring_config: "MonitoringConfig" = proto.Field(
proto.MESSAGE,
number=14,
message="MonitoringConfig",
)


class MembershipEndpoint(proto.Message):
Expand Down Expand Up @@ -483,6 +492,7 @@ class OnPremCluster(proto.Message):
resource_link (str):
Immutable. Self-link of the GCP resource for
the GKE On-Prem cluster. For example:
//gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster
//gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster
cluster_missing (bool):
Expand Down Expand Up @@ -548,6 +558,7 @@ class MultiCloudCluster(proto.Message):
//gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster
//gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster
//gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/attachedClusters/my-cluster
cluster_missing (bool):
Output only. If cluster_missing is set then it denotes that
API(gkemulticloud.googleapis.com) resource for this GKE
Expand Down Expand Up @@ -718,6 +729,60 @@ class Authority(proto.Message):
)


class MonitoringConfig(proto.Message):
r"""This field informs Fleet-based applications/services/UIs with
the necessary information for where each underlying Cluster
reports its metrics.
Attributes:
project_id (str):
Immutable. Project used to report Metrics
location (str):
Immutable. Location used to report Metrics
cluster (str):
Immutable. Cluster name used to report metrics. For Anthos
on VMWare/Baremetal, it would be in format
``memberClusters/cluster_name``; And for Anthos on
MultiCloud, it would be in format
``{azureClusters, awsClusters}/cluster_name``.
kubernetes_metrics_prefix (str):
Kubernetes system metrics, if available, are
written to this prefix. This defaults to
kubernetes.io for GKE, and kubernetes.io/anthos
for Anthos eventually. Noted: Anthos MultiCloud
will have kubernetes.io prefix today but will
migration to be under kubernetes.io/anthos
cluster_hash (str):
Immutable. Cluster hash, this is a unique
string generated by google code, which does not
contain any PII, which we can use to reference
the cluster. This is expected to be created by
the monitoring stack and persisted into the
Cluster object as well as to GKE-Hub.
"""

project_id: str = proto.Field(
proto.STRING,
number=1,
)
location: str = proto.Field(
proto.STRING,
number=2,
)
cluster: str = proto.Field(
proto.STRING,
number=3,
)
kubernetes_metrics_prefix: str = proto.Field(
proto.STRING,
number=4,
)
cluster_hash: str = proto.Field(
proto.STRING,
number=5,
)


class MembershipState(proto.Message):
r"""State of the Membership resource.
Expand Down Expand Up @@ -780,7 +845,8 @@ class ListMembershipsRequest(proto.Message):
parent (str):
Required. The parent (project and location) where the
Memberships will be listed. Specified in the format
``projects/*/locations/*``.
``projects/*/locations/*``. ``projects/*/locations/-`` list
memberships in all the regions.
page_size (int):
Optional. When requesting a 'page' of resources,
``page_size`` specifies number of resources to return. If
Expand Down Expand Up @@ -982,6 +1048,11 @@ class DeleteMembershipRequest(proto.Message):
The request ID must be a valid UUID with the
exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
force (bool):
Optional. If set to true, any subresource
from this Membership will also be deleted.
Otherwise, the request will only work if the
Membership has no subresource.
"""

name: str = proto.Field(
Expand All @@ -992,6 +1063,10 @@ class DeleteMembershipRequest(proto.Message):
proto.STRING,
number=4,
)
force: bool = proto.Field(
proto.BOOL,
number=5,
)


class UpdateMembershipRequest(proto.Message):
Expand Down Expand Up @@ -1056,7 +1131,7 @@ class UpdateMembershipRequest(proto.Message):

class GenerateConnectManifestRequest(proto.Message):
r"""Request message for
``GkeHubMembershipService.GenerateConnectManifest`` method. .
``GkeHubMembershipService.GenerateConnectManifest`` method.
Attributes:
name (str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-gke-hub",
"version": "1.9.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-gke-hub",
"version": "1.9.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_gkehub_v1beta1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class gkehubCallTransformer(cst.CSTTransformer):
CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata')
METHOD_TO_PARAMS: Dict[str, Tuple[str]] = {
'create_membership': ('parent', 'membership_id', 'resource', 'request_id', ),
'delete_membership': ('name', 'request_id', ),
'delete_membership': ('name', 'request_id', 'force', ),
'generate_connect_manifest': ('name', 'connect_agent', 'version', 'is_upgrade', 'registry', 'image_pull_secret_content', ),
'generate_exclusivity_manifest': ('name', 'crd_manifest', 'cr_manifest', ),
'get_membership': ('name', ),
Expand Down
45 changes: 43 additions & 2 deletions tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3381,6 +3381,13 @@ def test_create_membership_rest(request_type):
"last_connection_time": {},
"unique_id": "unique_id_value",
"infrastructure_type": 1,
"monitoring_config": {
"project_id": "project_id_value",
"location": "location_value",
"cluster": "cluster_value",
"kubernetes_metrics_prefix": "kubernetes_metrics_prefix_value",
"cluster_hash": "cluster_hash_value",
},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -3646,6 +3653,13 @@ def test_create_membership_rest_bad_request(
"last_connection_time": {},
"unique_id": "unique_id_value",
"infrastructure_type": 1,
"monitoring_config": {
"project_id": "project_id_value",
"location": "location_value",
"cluster": "cluster_value",
"kubernetes_metrics_prefix": "kubernetes_metrics_prefix_value",
"cluster_hash": "cluster_hash_value",
},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -3793,7 +3807,12 @@ def test_delete_membership_rest_required_fields(
credentials=ga_credentials.AnonymousCredentials()
).delete_membership._get_unset_required_fields(jsonified_request)
# Check that path parameters and body parameters are not mixing in.
assert not set(unset_fields) - set(("request_id",))
assert not set(unset_fields) - set(
(
"force",
"request_id",
)
)
jsonified_request.update(unset_fields)

# verify required fields with non-default values are left alone
Expand Down Expand Up @@ -3844,7 +3863,15 @@ def test_delete_membership_rest_unset_required_fields():
)

unset_fields = transport.delete_membership._get_unset_required_fields({})
assert set(unset_fields) == (set(("requestId",)) & set(("name",)))
assert set(unset_fields) == (
set(
(
"force",
"requestId",
)
)
& set(("name",))
)


@pytest.mark.parametrize("null_interceptor", [True, False])
Expand Down Expand Up @@ -4064,6 +4091,13 @@ def test_update_membership_rest(request_type):
"last_connection_time": {},
"unique_id": "unique_id_value",
"infrastructure_type": 1,
"monitoring_config": {
"project_id": "project_id_value",
"location": "location_value",
"cluster": "cluster_value",
"kubernetes_metrics_prefix": "kubernetes_metrics_prefix_value",
"cluster_hash": "cluster_hash_value",
},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -4316,6 +4350,13 @@ def test_update_membership_rest_bad_request(
"last_connection_time": {},
"unique_id": "unique_id_value",
"infrastructure_type": 1,
"monitoring_config": {
"project_id": "project_id_value",
"location": "location_value",
"cluster": "cluster_value",
"kubernetes_metrics_prefix": "kubernetes_metrics_prefix_value",
"cluster_hash": "cluster_hash_value",
},
}
request = request_type(**request_init)

Expand Down

0 comments on commit a77403d

Please sign in to comment.