diff --git a/packages/google-cloud-service-management/.github/release-please.yml b/packages/google-cloud-service-management/.github/release-please.yml index 6def37a84c98..e9a4f0085128 100644 --- a/packages/google-cloud-service-management/.github/release-please.yml +++ b/packages/google-cloud-service-management/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/packages/google-cloud-service-management/.release-please-manifest.json b/packages/google-cloud-service-management/.release-please-manifest.json new file mode 100644 index 000000000000..b3e339579988 --- /dev/null +++ b/packages/google-cloud-service-management/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.3.3" +} diff --git a/packages/google-cloud-service-management/docs/servicemanagement_v1/types.rst b/packages/google-cloud-service-management/docs/servicemanagement_v1/types.rst index e77e9329ad24..f53a66140e4a 100644 --- a/packages/google-cloud-service-management/docs/servicemanagement_v1/types.rst +++ b/packages/google-cloud-service-management/docs/servicemanagement_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Servicemanagement v1 API .. automodule:: google.cloud.servicemanagement_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement/__init__.py b/packages/google-cloud-service-management/google/cloud/servicemanagement/__init__.py index 26bd57cadbfa..739847c8009a 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement/__init__.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.servicemanagement import gapic_version as package_version + +__version__ = package_version.__version__ + from google.cloud.servicemanagement_v1.services.service_manager.async_client import ( ServiceManagerAsyncClient, diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py b/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py new file mode 100644 index 000000000000..e37037224727 --- /dev/null +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.3.3" # {x-release-please-version} diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/__init__.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/__init__.py index baeac6de3cba..c0bfc3955302 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/__init__.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.servicemanagement import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.service_manager import ServiceManagerAsyncClient, ServiceManagerClient from .types.resources import ( diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/async_client.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/async_client.py index 038de590c581..0c0256947b47 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/async_client.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -34,6 +44,7 @@ from google.api import auth_pb2 # type: ignore from google.api import backend_pb2 # type: ignore from google.api import billing_pb2 # type: ignore +from google.api import client_pb2 # type: ignore from google.api import context_pb2 # type: ignore from google.api import control_pb2 # type: ignore from google.api import documentation_pb2 # type: ignore @@ -186,9 +197,9 @@ def transport(self) -> ServiceManagerTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ServiceManagerTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the service manager client. @@ -232,12 +243,12 @@ def __init__( async def list_services( self, - request: Union[servicemanager.ListServicesRequest, dict] = None, + request: Optional[Union[servicemanager.ListServicesRequest, dict]] = None, *, - producer_project_id: str = None, - consumer_id: str = None, + producer_project_id: Optional[str] = None, + consumer_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesAsyncPager: r"""Lists managed services. @@ -272,7 +283,7 @@ async def sample_list_services(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.ListServicesRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.ListServicesRequest, dict]]): The request object. Request message for `ListServices` method. producer_project_id (:class:`str`): @@ -356,11 +367,11 @@ async def sample_list_services(): async def get_service( self, - request: Union[servicemanager.GetServiceRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ManagedService: r"""Gets a managed service. Authentication is required @@ -393,7 +404,7 @@ async def sample_get_service(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.GetServiceRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.GetServiceRequest, dict]]): The request object. Request message for `GetService` method. service_name (:class:`str`): @@ -463,11 +474,11 @@ async def sample_get_service(): async def create_service( self, - request: Union[servicemanager.CreateServiceRequest, dict] = None, + request: Optional[Union[servicemanager.CreateServiceRequest, dict]] = None, *, - service: resources.ManagedService = None, + service: Optional[resources.ManagedService] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new managed service. @@ -512,7 +523,7 @@ async def sample_create_service(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.CreateServiceRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.CreateServiceRequest, dict]]): The request object. Request message for CreateService method. service (:class:`google.cloud.servicemanagement_v1.types.ManagedService`): @@ -582,11 +593,11 @@ async def sample_create_service(): async def delete_service( self, - request: Union[servicemanager.DeleteServiceRequest, dict] = None, + request: Optional[Union[servicemanager.DeleteServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a managed service. This method will change the service @@ -629,7 +640,7 @@ async def sample_delete_service(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.DeleteServiceRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.DeleteServiceRequest, dict]]): The request object. Request message for DeleteService method. service_name (:class:`str`): @@ -717,11 +728,11 @@ async def sample_delete_service(): async def undelete_service( self, - request: Union[servicemanager.UndeleteServiceRequest, dict] = None, + request: Optional[Union[servicemanager.UndeleteServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Revives a previously deleted managed service. The @@ -763,7 +774,7 @@ async def sample_undelete_service(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.UndeleteServiceRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.UndeleteServiceRequest, dict]]): The request object. Request message for UndeleteService method. service_name (:class:`str`): @@ -844,11 +855,11 @@ async def sample_undelete_service(): async def list_service_configs( self, - request: Union[servicemanager.ListServiceConfigsRequest, dict] = None, + request: Optional[Union[servicemanager.ListServiceConfigsRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServiceConfigsAsyncPager: r"""Lists the history of the service configuration for a @@ -882,7 +893,7 @@ async def sample_list_service_configs(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.ListServiceConfigsRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.ListServiceConfigsRequest, dict]]): The request object. Request message for ListServiceConfigs method. service_name (:class:`str`): @@ -964,13 +975,13 @@ async def sample_list_service_configs(): async def get_service_config( self, - request: Union[servicemanager.GetServiceConfigRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceConfigRequest, dict]] = None, *, - service_name: str = None, - config_id: str = None, - view: servicemanager.GetServiceConfigRequest.ConfigView = None, + service_name: Optional[str] = None, + config_id: Optional[str] = None, + view: Optional[servicemanager.GetServiceConfigRequest.ConfigView] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service_pb2.Service: r"""Gets a service configuration (version) for a managed @@ -1004,7 +1015,7 @@ async def sample_get_service_config(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.GetServiceConfigRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.GetServiceConfigRequest, dict]]): The request object. Request message for GetServiceConfig method. service_name (:class:`str`): @@ -1041,25 +1052,35 @@ async def sample_get_service_config(): Returns: google.api.service_pb2.Service: - Service is the root object of Google service configuration schema. It - describes basic information about a service, such as - the name and the title, and delegates other aspects - to sub-sections. Each sub-section is either a proto + Service is the root object of Google API service configuration (service + config). It describes the basic information about a + logical service, such as the service name and the + user-facing title, and delegates other aspects to + sub-sections. Each sub-section is either a proto message or a repeated proto message that configures a - specific aspect, such as auth. See each proto message - definition for details. + specific aspect, such as auth. For more information, + see each proto message definition. Example: type: google.api.Service name: calendar.googleapis.com title: Google Calendar API apis: - name: google.calendar.v3.Calendar - authentication: providers: - id: - google_calendar_auth jwks_uri: - https://www.googleapis.com/oauth2/v1/certs issuer: - https://securetoken.google.com rules: - selector: - "*" requirements: provider_id: - google_calendar_auth + + visibility: + rules: - selector: "google.calendar.v3.*" + restriction: PREVIEW + + backend: + rules: - selector: "google.calendar.v3.*" + address: calendar.example.com + + authentication: + providers: - id: google_calendar_auth jwks_uri: + https://www.googleapis.com/oauth2/v1/certs + issuer: https://securetoken.google.com rules: - + selector: "*" requirements: provider_id: + google_calendar_auth """ # Create or coerce a protobuf request object. @@ -1115,12 +1136,14 @@ async def sample_get_service_config(): async def create_service_config( self, - request: Union[servicemanager.CreateServiceConfigRequest, dict] = None, + request: Optional[ + Union[servicemanager.CreateServiceConfigRequest, dict] + ] = None, *, - service_name: str = None, - service_config: service_pb2.Service = None, + service_name: Optional[str] = None, + service_config: Optional[service_pb2.Service] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service_pb2.Service: r"""Creates a new service configuration (version) for a managed @@ -1160,7 +1183,7 @@ async def sample_create_service_config(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.CreateServiceConfigRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.CreateServiceConfigRequest, dict]]): The request object. Request message for CreateServiceConfig method. service_name (:class:`str`): @@ -1187,25 +1210,35 @@ async def sample_create_service_config(): Returns: google.api.service_pb2.Service: - Service is the root object of Google service configuration schema. It - describes basic information about a service, such as - the name and the title, and delegates other aspects - to sub-sections. Each sub-section is either a proto + Service is the root object of Google API service configuration (service + config). It describes the basic information about a + logical service, such as the service name and the + user-facing title, and delegates other aspects to + sub-sections. Each sub-section is either a proto message or a repeated proto message that configures a - specific aspect, such as auth. See each proto message - definition for details. + specific aspect, such as auth. For more information, + see each proto message definition. Example: type: google.api.Service name: calendar.googleapis.com title: Google Calendar API apis: - name: google.calendar.v3.Calendar - authentication: providers: - id: - google_calendar_auth jwks_uri: - https://www.googleapis.com/oauth2/v1/certs issuer: - https://securetoken.google.com rules: - selector: - "*" requirements: provider_id: - google_calendar_auth + + visibility: + rules: - selector: "google.calendar.v3.*" + restriction: PREVIEW + + backend: + rules: - selector: "google.calendar.v3.*" + address: calendar.example.com + + authentication: + providers: - id: google_calendar_auth jwks_uri: + https://www.googleapis.com/oauth2/v1/certs + issuer: https://securetoken.google.com rules: - + selector: "*" requirements: provider_id: + google_calendar_auth """ # Create or coerce a protobuf request object. @@ -1256,13 +1289,13 @@ async def sample_create_service_config(): async def submit_config_source( self, - request: Union[servicemanager.SubmitConfigSourceRequest, dict] = None, + request: Optional[Union[servicemanager.SubmitConfigSourceRequest, dict]] = None, *, - service_name: str = None, - config_source: resources.ConfigSource = None, - validate_only: bool = None, + service_name: Optional[str] = None, + config_source: Optional[resources.ConfigSource] = None, + validate_only: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new service configuration (version) for a managed @@ -1310,7 +1343,7 @@ async def sample_submit_config_source(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.SubmitConfigSourceRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.SubmitConfigSourceRequest, dict]]): The request object. Request message for SubmitConfigSource method. service_name (:class:`str`): @@ -1411,12 +1444,14 @@ async def sample_submit_config_source(): async def list_service_rollouts( self, - request: Union[servicemanager.ListServiceRolloutsRequest, dict] = None, + request: Optional[ + Union[servicemanager.ListServiceRolloutsRequest, dict] + ] = None, *, - service_name: str = None, - filter: str = None, + service_name: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServiceRolloutsAsyncPager: r"""Lists the history of the service configuration @@ -1452,7 +1487,7 @@ async def sample_list_service_rollouts(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.ListServiceRolloutsRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.ListServiceRolloutsRequest, dict]]): The request object. Request message for 'ListServiceRollouts' service_name (:class:`str`): @@ -1550,12 +1585,12 @@ async def sample_list_service_rollouts(): async def get_service_rollout( self, - request: Union[servicemanager.GetServiceRolloutRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceRolloutRequest, dict]] = None, *, - service_name: str = None, - rollout_id: str = None, + service_name: Optional[str] = None, + rollout_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Rollout: r"""Gets a service configuration @@ -1589,7 +1624,7 @@ async def sample_get_service_rollout(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.GetServiceRolloutRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.GetServiceRolloutRequest, dict]]): The request object. Request message for GetServiceRollout method. service_name (:class:`str`): @@ -1675,12 +1710,14 @@ async def sample_get_service_rollout(): async def create_service_rollout( self, - request: Union[servicemanager.CreateServiceRolloutRequest, dict] = None, + request: Optional[ + Union[servicemanager.CreateServiceRolloutRequest, dict] + ] = None, *, - service_name: str = None, - rollout: resources.Rollout = None, + service_name: Optional[str] = None, + rollout: Optional[resources.Rollout] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new service configuration rollout. Based on @@ -1732,7 +1769,7 @@ async def sample_create_service_rollout(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.CreateServiceRolloutRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.CreateServiceRolloutRequest, dict]]): The request object. Request message for 'CreateServiceRollout' service_name (:class:`str`): @@ -1823,12 +1860,14 @@ async def sample_create_service_rollout(): async def generate_config_report( self, - request: Union[servicemanager.GenerateConfigReportRequest, dict] = None, + request: Optional[ + Union[servicemanager.GenerateConfigReportRequest, dict] + ] = None, *, - new_config: any_pb2.Any = None, - old_config: any_pb2.Any = None, + new_config: Optional[any_pb2.Any] = None, + old_config: Optional[any_pb2.Any] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> servicemanager.GenerateConfigReportResponse: r"""Generates and returns a report (errors, warnings and changes @@ -1870,7 +1909,7 @@ async def sample_generate_config_report(): print(response) Args: - request (Union[google.cloud.servicemanagement_v1.types.GenerateConfigReportRequest, dict]): + request (Optional[Union[google.cloud.servicemanagement_v1.types.GenerateConfigReportRequest, dict]]): The request object. Request message for GenerateConfigReport method. new_config (:class:`google.protobuf.any_pb2.Any`): diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py index 2c8b6b56f570..a07e5ca4497c 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -37,6 +48,7 @@ from google.api import auth_pb2 # type: ignore from google.api import backend_pb2 # type: ignore from google.api import billing_pb2 # type: ignore +from google.api import client_pb2 # type: ignore from google.api import context_pb2 # type: ignore from google.api import control_pb2 # type: ignore from google.api import documentation_pb2 # type: ignore @@ -85,7 +97,7 @@ class ServiceManagerClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ServiceManagerTransport]: """Returns an appropriate transport class. @@ -340,8 +352,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ServiceManagerTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, ServiceManagerTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the service manager client. @@ -355,7 +367,7 @@ def __init__( transport (Union[str, ServiceManagerTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -385,6 +397,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -437,12 +450,12 @@ def __init__( def list_services( self, - request: Union[servicemanager.ListServicesRequest, dict] = None, + request: Optional[Union[servicemanager.ListServicesRequest, dict]] = None, *, - producer_project_id: str = None, - consumer_id: str = None, + producer_project_id: Optional[str] = None, + consumer_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServicesPager: r"""Lists managed services. @@ -561,11 +574,11 @@ def sample_list_services(): def get_service( self, - request: Union[servicemanager.GetServiceRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ManagedService: r"""Gets a managed service. Authentication is required @@ -668,11 +681,11 @@ def sample_get_service(): def create_service( self, - request: Union[servicemanager.CreateServiceRequest, dict] = None, + request: Optional[Union[servicemanager.CreateServiceRequest, dict]] = None, *, - service: resources.ManagedService = None, + service: Optional[resources.ManagedService] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new managed service. @@ -787,11 +800,11 @@ def sample_create_service(): def delete_service( self, - request: Union[servicemanager.DeleteServiceRequest, dict] = None, + request: Optional[Union[servicemanager.DeleteServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a managed service. This method will change the service @@ -922,11 +935,11 @@ def sample_delete_service(): def undelete_service( self, - request: Union[servicemanager.UndeleteServiceRequest, dict] = None, + request: Optional[Union[servicemanager.UndeleteServiceRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Revives a previously deleted managed service. The @@ -1049,11 +1062,11 @@ def sample_undelete_service(): def list_service_configs( self, - request: Union[servicemanager.ListServiceConfigsRequest, dict] = None, + request: Optional[Union[servicemanager.ListServiceConfigsRequest, dict]] = None, *, - service_name: str = None, + service_name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServiceConfigsPager: r"""Lists the history of the service configuration for a @@ -1169,13 +1182,13 @@ def sample_list_service_configs(): def get_service_config( self, - request: Union[servicemanager.GetServiceConfigRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceConfigRequest, dict]] = None, *, - service_name: str = None, - config_id: str = None, - view: servicemanager.GetServiceConfigRequest.ConfigView = None, + service_name: Optional[str] = None, + config_id: Optional[str] = None, + view: Optional[servicemanager.GetServiceConfigRequest.ConfigView] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service_pb2.Service: r"""Gets a service configuration (version) for a managed @@ -1246,25 +1259,35 @@ def sample_get_service_config(): Returns: google.api.service_pb2.Service: - Service is the root object of Google service configuration schema. It - describes basic information about a service, such as - the name and the title, and delegates other aspects - to sub-sections. Each sub-section is either a proto + Service is the root object of Google API service configuration (service + config). It describes the basic information about a + logical service, such as the service name and the + user-facing title, and delegates other aspects to + sub-sections. Each sub-section is either a proto message or a repeated proto message that configures a - specific aspect, such as auth. See each proto message - definition for details. + specific aspect, such as auth. For more information, + see each proto message definition. Example: type: google.api.Service name: calendar.googleapis.com title: Google Calendar API apis: - name: google.calendar.v3.Calendar - authentication: providers: - id: - google_calendar_auth jwks_uri: - https://www.googleapis.com/oauth2/v1/certs issuer: - https://securetoken.google.com rules: - selector: - "*" requirements: provider_id: - google_calendar_auth + + visibility: + rules: - selector: "google.calendar.v3.*" + restriction: PREVIEW + + backend: + rules: - selector: "google.calendar.v3.*" + address: calendar.example.com + + authentication: + providers: - id: google_calendar_auth jwks_uri: + https://www.googleapis.com/oauth2/v1/certs + issuer: https://securetoken.google.com rules: - + selector: "*" requirements: provider_id: + google_calendar_auth """ # Create or coerce a protobuf request object. @@ -1320,12 +1343,14 @@ def sample_get_service_config(): def create_service_config( self, - request: Union[servicemanager.CreateServiceConfigRequest, dict] = None, + request: Optional[ + Union[servicemanager.CreateServiceConfigRequest, dict] + ] = None, *, - service_name: str = None, - service_config: service_pb2.Service = None, + service_name: Optional[str] = None, + service_config: Optional[service_pb2.Service] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service_pb2.Service: r"""Creates a new service configuration (version) for a managed @@ -1392,25 +1417,35 @@ def sample_create_service_config(): Returns: google.api.service_pb2.Service: - Service is the root object of Google service configuration schema. It - describes basic information about a service, such as - the name and the title, and delegates other aspects - to sub-sections. Each sub-section is either a proto + Service is the root object of Google API service configuration (service + config). It describes the basic information about a + logical service, such as the service name and the + user-facing title, and delegates other aspects to + sub-sections. Each sub-section is either a proto message or a repeated proto message that configures a - specific aspect, such as auth. See each proto message - definition for details. + specific aspect, such as auth. For more information, + see each proto message definition. Example: type: google.api.Service name: calendar.googleapis.com title: Google Calendar API apis: - name: google.calendar.v3.Calendar - authentication: providers: - id: - google_calendar_auth jwks_uri: - https://www.googleapis.com/oauth2/v1/certs issuer: - https://securetoken.google.com rules: - selector: - "*" requirements: provider_id: - google_calendar_auth + + visibility: + rules: - selector: "google.calendar.v3.*" + restriction: PREVIEW + + backend: + rules: - selector: "google.calendar.v3.*" + address: calendar.example.com + + authentication: + providers: - id: google_calendar_auth jwks_uri: + https://www.googleapis.com/oauth2/v1/certs + issuer: https://securetoken.google.com rules: - + selector: "*" requirements: provider_id: + google_calendar_auth """ # Create or coerce a protobuf request object. @@ -1461,13 +1496,13 @@ def sample_create_service_config(): def submit_config_source( self, - request: Union[servicemanager.SubmitConfigSourceRequest, dict] = None, + request: Optional[Union[servicemanager.SubmitConfigSourceRequest, dict]] = None, *, - service_name: str = None, - config_source: resources.ConfigSource = None, - validate_only: bool = None, + service_name: Optional[str] = None, + config_source: Optional[resources.ConfigSource] = None, + validate_only: Optional[bool] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new service configuration (version) for a managed @@ -1616,12 +1651,14 @@ def sample_submit_config_source(): def list_service_rollouts( self, - request: Union[servicemanager.ListServiceRolloutsRequest, dict] = None, + request: Optional[ + Union[servicemanager.ListServiceRolloutsRequest, dict] + ] = None, *, - service_name: str = None, - filter: str = None, + service_name: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListServiceRolloutsPager: r"""Lists the history of the service configuration @@ -1755,12 +1792,12 @@ def sample_list_service_rollouts(): def get_service_rollout( self, - request: Union[servicemanager.GetServiceRolloutRequest, dict] = None, + request: Optional[Union[servicemanager.GetServiceRolloutRequest, dict]] = None, *, - service_name: str = None, - rollout_id: str = None, + service_name: Optional[str] = None, + rollout_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.Rollout: r"""Gets a service configuration @@ -1880,12 +1917,14 @@ def sample_get_service_rollout(): def create_service_rollout( self, - request: Union[servicemanager.CreateServiceRolloutRequest, dict] = None, + request: Optional[ + Union[servicemanager.CreateServiceRolloutRequest, dict] + ] = None, *, - service_name: str = None, - rollout: resources.Rollout = None, + service_name: Optional[str] = None, + rollout: Optional[resources.Rollout] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new service configuration rollout. Based on @@ -2028,12 +2067,14 @@ def sample_create_service_rollout(): def generate_config_report( self, - request: Union[servicemanager.GenerateConfigReportRequest, dict] = None, + request: Optional[ + Union[servicemanager.GenerateConfigReportRequest, dict] + ] = None, *, - new_config: any_pb2.Any = None, - old_config: any_pb2.Any = None, + new_config: Optional[any_pb2.Any] = None, + old_config: Optional[any_pb2.Any] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> servicemanager.GenerateConfigReportResponse: r"""Generates and returns a report (errors, warnings and changes diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/base.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/base.py index a5cc372392c4..2beae87c57f3 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/base.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/base.py @@ -55,7 +55,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc.py index d367d29080c9..bae6699136fe 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc.py @@ -49,14 +49,14 @@ def __init__( self, *, host: str = "servicemanagement.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -184,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "servicemanagement.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc_asyncio.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc_asyncio.py index 93d3f135af1f..f08ca4052d50 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc_asyncio.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/services/service_manager/transports/grpc_asyncio.py @@ -51,7 +51,7 @@ class ServiceManagerGrpcAsyncIOTransport(ServiceManagerTransport): def create_channel( cls, host: str = "servicemanagement.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -94,15 +94,15 @@ def __init__( self, *, host: str = "servicemanagement.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/resources.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/resources.py index 7385f5023d3c..adb62a97c0aa 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/resources.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/resources.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.api import config_change_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -46,11 +48,11 @@ class ManagedService(proto.Message): service. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=2, ) - producer_project_id = proto.Field( + producer_project_id: str = proto.Field( proto.STRING, number=3, ) @@ -61,10 +63,10 @@ class OperationMetadata(proto.Message): resource. Attributes: - resource_names (Sequence[str]): + resource_names (MutableSequence[str]): The full name of the resources that this operation is directly associated with. - steps (Sequence[google.cloud.servicemanagement_v1.types.OperationMetadata.Step]): + steps (MutableSequence[google.cloud.servicemanagement_v1.types.OperationMetadata.Step]): Detailed status information for each step. The order is undetermined. progress_percentage (int): @@ -95,30 +97,30 @@ class Step(proto.Message): The status code. """ - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - status = proto.Field( + status: "OperationMetadata.Status" = proto.Field( proto.ENUM, number=4, enum="OperationMetadata.Status", ) - resource_names = proto.RepeatedField( + resource_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - steps = proto.RepeatedField( + steps: MutableSequence[Step] = proto.RepeatedField( proto.MESSAGE, number=2, message=Step, ) - progress_percentage = proto.Field( + progress_percentage: int = proto.Field( proto.INT32, number=3, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, @@ -143,16 +145,16 @@ class Kind(proto.Enum): WARNING = 0 ERROR = 1 - location = proto.Field( + location: str = proto.Field( proto.STRING, number=1, ) - kind = proto.Field( + kind: Kind = proto.Field( proto.ENUM, number=2, enum=Kind, ) - message = proto.Field( + message: str = proto.Field( proto.STRING, number=3, ) @@ -168,16 +170,16 @@ class ConfigSource(proto.Message): message, typically assigned by the client for tracking purpose. If empty, the server may choose to generate one instead. - files (Sequence[google.cloud.servicemanagement_v1.types.ConfigFile]): + files (MutableSequence[google.cloud.servicemanagement_v1.types.ConfigFile]): Set of source configuration files that are used to generate a service configuration (``google.api.Service``). """ - id = proto.Field( + id: str = proto.Field( proto.STRING, number=5, ) - files = proto.RepeatedField( + files: MutableSequence["ConfigFile"] = proto.RepeatedField( proto.MESSAGE, number=2, message="ConfigFile", @@ -207,15 +209,15 @@ class FileType(proto.Enum): FILE_DESCRIPTOR_SET_PROTO = 4 PROTO_FILE = 6 - file_path = proto.Field( + file_path: str = proto.Field( proto.STRING, number=1, ) - file_contents = proto.Field( + file_contents: bytes = proto.Field( proto.BYTES, number=3, ) - file_type = proto.Field( + file_type: FileType = proto.Field( proto.ENUM, number=4, enum=FileType, @@ -232,7 +234,7 @@ class ConfigRef(proto.Message): name}/configs/{config id}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -245,7 +247,7 @@ class ChangeReport(proto.Message): between two service configurations. Attributes: - config_changes (Sequence[google.api.config_change_pb2.ConfigChange]): + config_changes (MutableSequence[google.api.config_change_pb2.ConfigChange]): List of changes between two service configurations. The changes will be alphabetically sorted based on the identifier of each change. A ConfigChange identifier is a @@ -253,7 +255,9 @@ class ChangeReport(proto.Message): visibility.rules[selector='LibraryService.CreateBook'].restriction """ - config_changes = proto.RepeatedField( + config_changes: MutableSequence[ + config_change_pb2.ConfigChange + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=config_change_pb2.ConfigChange, @@ -354,7 +358,7 @@ class TrafficPercentStrategy(proto.Message): } Attributes: - percentages (Mapping[str, float]): + percentages (MutableMapping[str, float]): Maps service configuration IDs to their corresponding traffic percentage. Key is the service configuration ID, Value is the traffic @@ -362,7 +366,7 @@ class TrafficPercentStrategy(proto.Message): the sum must equal to 100.0. """ - percentages = proto.MapField( + percentages: MutableMapping[str, float] = proto.MapField( proto.STRING, proto.DOUBLE, number=1, @@ -375,37 +379,37 @@ class DeleteServiceStrategy(proto.Message): """ - rollout_id = proto.Field( + rollout_id: str = proto.Field( proto.STRING, number=1, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - created_by = proto.Field( + created_by: str = proto.Field( proto.STRING, number=3, ) - status = proto.Field( + status: RolloutStatus = proto.Field( proto.ENUM, number=4, enum=RolloutStatus, ) - traffic_percent_strategy = proto.Field( + traffic_percent_strategy: TrafficPercentStrategy = proto.Field( proto.MESSAGE, number=5, oneof="strategy", message=TrafficPercentStrategy, ) - delete_service_strategy = proto.Field( + delete_service_strategy: DeleteServiceStrategy = proto.Field( proto.MESSAGE, number=200, oneof="strategy", message=DeleteServiceStrategy, ) - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=8, ) diff --git a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/servicemanager.py b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/servicemanager.py index fe19c9e3eae7..d13db8e72193 100644 --- a/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/servicemanager.py +++ b/packages/google-cloud-service-management/google/cloud/servicemanagement_v1/types/servicemanager.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.api import service_pb2 # type: ignore from google.protobuf import any_pb2 # type: ignore import proto # type: ignore @@ -68,19 +70,19 @@ class ListServicesRequest(proto.Message): - project: """ - producer_project_id = proto.Field( + producer_project_id: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=5, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=6, ) - consumer_id = proto.Field( + consumer_id: str = proto.Field( proto.STRING, number=7, ) @@ -90,7 +92,7 @@ class ListServicesResponse(proto.Message): r"""Response message for ``ListServices`` method. Attributes: - services (Sequence[google.cloud.servicemanagement_v1.types.ManagedService]): + services (MutableSequence[google.cloud.servicemanagement_v1.types.ManagedService]): The returned services will only have the name field set. next_page_token (str): @@ -102,12 +104,12 @@ class ListServicesResponse(proto.Message): def raw_page(self): return self - services = proto.RepeatedField( + services: MutableSequence[resources.ManagedService] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.ManagedService, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -123,7 +125,7 @@ class GetServiceRequest(proto.Message): example: ``example.googleapis.com``. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) @@ -138,7 +140,7 @@ class CreateServiceRequest(proto.Message): resource. """ - service = proto.Field( + service: resources.ManagedService = proto.Field( proto.MESSAGE, number=1, message=resources.ManagedService, @@ -156,7 +158,7 @@ class DeleteServiceRequest(proto.Message): ``example.googleapis.com``. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) @@ -173,7 +175,7 @@ class UndeleteServiceRequest(proto.Message): ``example.googleapis.com``. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) @@ -187,7 +189,7 @@ class UndeleteServiceResponse(proto.Message): Revived service resource. """ - service = proto.Field( + service: resources.ManagedService = proto.Field( proto.MESSAGE, number=1, message=resources.ManagedService, @@ -218,15 +220,15 @@ class ConfigView(proto.Enum): BASIC = 0 FULL = 1 - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - config_id = proto.Field( + config_id: str = proto.Field( proto.STRING, number=2, ) - view = proto.Field( + view: ConfigView = proto.Field( proto.ENUM, number=3, enum=ConfigView, @@ -250,15 +252,15 @@ class ListServiceConfigsRequest(proto.Message): Maximum value is 100. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -268,7 +270,7 @@ class ListServiceConfigsResponse(proto.Message): r"""Response message for ListServiceConfigs method. Attributes: - service_configs (Sequence[google.api.service_pb2.Service]): + service_configs (MutableSequence[google.api.service_pb2.Service]): The list of service configuration resources. next_page_token (str): The token of the next page of results. @@ -278,12 +280,12 @@ class ListServiceConfigsResponse(proto.Message): def raw_page(self): return self - service_configs = proto.RepeatedField( + service_configs: MutableSequence[service_pb2.Service] = proto.RepeatedField( proto.MESSAGE, number=1, message=service_pb2.Service, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -302,11 +304,11 @@ class CreateServiceConfigRequest(proto.Message): Required. The service configuration resource. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - service_config = proto.Field( + service_config: service_pb2.Service = proto.Field( proto.MESSAGE, number=2, message=service_pb2.Service, @@ -332,16 +334,16 @@ class SubmitConfigSourceRequest(proto.Message): sources will NOT be persisted. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - config_source = proto.Field( + config_source: resources.ConfigSource = proto.Field( proto.MESSAGE, number=2, message=resources.ConfigSource, ) - validate_only = proto.Field( + validate_only: bool = proto.Field( proto.BOOL, number=3, ) @@ -355,7 +357,7 @@ class SubmitConfigSourceResponse(proto.Message): The generated service configuration. """ - service_config = proto.Field( + service_config: service_pb2.Service = proto.Field( proto.MESSAGE, number=1, message=service_pb2.Service, @@ -376,11 +378,11 @@ class CreateServiceRolloutRequest(proto.Message): is output only. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - rollout = proto.Field( + rollout: resources.Rollout = proto.Field( proto.MESSAGE, number=2, message=resources.Rollout, @@ -413,19 +415,19 @@ class ListServiceRolloutsRequest(proto.Message): status=FAILED' """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) @@ -435,7 +437,7 @@ class ListServiceRolloutsResponse(proto.Message): r"""Response message for ListServiceRollouts method. Attributes: - rollouts (Sequence[google.cloud.servicemanagement_v1.types.Rollout]): + rollouts (MutableSequence[google.cloud.servicemanagement_v1.types.Rollout]): The list of rollout resources. next_page_token (str): The token of the next page of results. @@ -445,12 +447,12 @@ class ListServiceRolloutsResponse(proto.Message): def raw_page(self): return self - rollouts = proto.RepeatedField( + rollouts: MutableSequence[resources.Rollout] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.Rollout, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -469,11 +471,11 @@ class GetServiceRolloutRequest(proto.Message): Required. The id of the rollout resource. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - rollout_id = proto.Field( + rollout_id: str = proto.Field( proto.STRING, number=2, ) @@ -499,12 +501,12 @@ class GenerateConfigReportRequest(proto.Message): and [google.api.Service][google.api.Service] """ - new_config = proto.Field( + new_config: any_pb2.Any = proto.Field( proto.MESSAGE, number=1, message=any_pb2.Any, ) - old_config = proto.Field( + old_config: any_pb2.Any = proto.Field( proto.MESSAGE, number=2, message=any_pb2.Any, @@ -520,29 +522,29 @@ class GenerateConfigReportResponse(proto.Message): id (str): ID of the service configuration this report belongs to. - change_reports (Sequence[google.cloud.servicemanagement_v1.types.ChangeReport]): + change_reports (MutableSequence[google.cloud.servicemanagement_v1.types.ChangeReport]): list of ChangeReport, each corresponding to comparison between two service configurations. - diagnostics (Sequence[google.cloud.servicemanagement_v1.types.Diagnostic]): + diagnostics (MutableSequence[google.cloud.servicemanagement_v1.types.Diagnostic]): Errors / Linter warnings associated with the service definition this report belongs to. """ - service_name = proto.Field( + service_name: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=2, ) - change_reports = proto.RepeatedField( + change_reports: MutableSequence[resources.ChangeReport] = proto.RepeatedField( proto.MESSAGE, number=3, message=resources.ChangeReport, ) - diagnostics = proto.RepeatedField( + diagnostics: MutableSequence[resources.Diagnostic] = proto.RepeatedField( proto.MESSAGE, number=4, message=resources.Diagnostic, diff --git a/packages/google-cloud-service-management/owlbot.py b/packages/google-cloud-service-management/owlbot.py new file mode 100644 index 000000000000..ce738f01d012 --- /dev/null +++ b/packages/google-cloud-service-management/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from pathlib import Path +import shutil + +import synthtool as s +import synthtool.gcp as gcp +from synthtool.languages import python + +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) + +for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py"]) +s.remove_staging_dirs() + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- + +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), +) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) + +python.py_samples(skip_readmes=True) + +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/packages/google-cloud-service-management/release-please-config.json b/packages/google-cloud-service-management/release-please-config.json new file mode 100644 index 000000000000..565490081de7 --- /dev/null +++ b/packages/google-cloud-service-management/release-please-config.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/servicemanagement/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_servicemanagement_v1.json b/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json similarity index 99% rename from packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_servicemanagement_v1.json rename to packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json index 6182ab89d435..8b514f320127 100644 --- a/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_servicemanagement_v1.json +++ b/packages/google-cloud-service-management/samples/generated_samples/snippet_metadata_google.api.servicemanagement.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-service-management" + "name": "google-cloud-service-management", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-service-management/setup.py b/packages/google-cloud-service-management/setup.py index ae69da2918f8..b87f47289750 100644 --- a/packages/google-cloud-service-management/setup.py +++ b/packages/google-cloud-service-management/setup.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,22 +13,36 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import io import os import setuptools # type: ignore +package_root = os.path.abspath(os.path.dirname(__file__)) + name = "google-cloud-service-management" -version = "1.3.3" -description = "Service Management API" -release_status = "Development Status :: 5 - Production/Stable" -url = "https://github.com/googleapis/python-service-management" + + +description = "Google Cloud Service Management API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/servicemanagement/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] +url = "https://github.com/googleapis/python-service-management" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -37,8 +50,18 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") + setuptools.setup( - name="google-cloud-service-management", + name=name, version=version, description=description, long_description=readme, @@ -46,22 +69,24 @@ author_email="googleapis-packages@google.com", license="Apache 2.0", url=url, - packages=setuptools.PEP420PackageFinder.find(), - namespace_packages=("google", "google.cloud"), - platforms="Posix; MacOS X; Windows", - include_package_data=True, - install_requires=dependencies, - python_requires=">=3.7", classifiers=[ release_status, "Intended Audience :: Developers", - "Operating System :: OS Independent", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", "Topic :: Internet", - "Topic :: Software Development :: Libraries :: Python Modules", ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-service-management/testing/constraints-3.10.txt b/packages/google-cloud-service-management/testing/constraints-3.10.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.10.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-service-management/testing/constraints-3.11.txt b/packages/google-cloud-service-management/testing/constraints-3.11.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.11.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-service-management/testing/constraints-3.7.txt b/packages/google-cloud-service-management/testing/constraints-3.7.txt index a12652ce2cc3..6f3158cc2034 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.7.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.7.txt @@ -1,24 +1,9 @@ -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/packages/google-cloud-service-management/testing/constraints-3.8.txt b/packages/google-cloud-service-management/testing/constraints-3.8.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.8.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-service-management/testing/constraints-3.9.txt b/packages/google-cloud-service-management/testing/constraints-3.9.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-service-management/testing/constraints-3.9.txt +++ b/packages/google-cloud-service-management/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py index 67aa3f1c9e78..764e6ef324df 100644 --- a/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py +++ b/packages/google-cloud-service-management/tests/unit/gapic/servicemanagement_v1/test_service_manager.py @@ -27,6 +27,7 @@ from google.api import auth_pb2 # type: ignore from google.api import backend_pb2 # type: ignore from google.api import billing_pb2 # type: ignore +from google.api import client_pb2 # type: ignore from google.api import context_pb2 # type: ignore from google.api import control_pb2 # type: ignore from google.api import documentation_pb2 # type: ignore @@ -64,6 +65,7 @@ from google.protobuf import any_pb2 # type: ignore from google.protobuf import api_pb2 # type: ignore from google.protobuf import duration_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import source_context_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import type_pb2 # type: ignore