From 2acdeb782521c01a4e1fa01e42fdd1ce79dbf13d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 14 Jan 2021 07:22:03 -0800 Subject: [PATCH] docs: document enum values with `undoc-members` option (#69) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/46757253-38e2-4a17-a782-2d1ad3ef2b6a/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 350246057 Source-Link: https://github.com/googleapis/googleapis/commit/520682435235d9c503983a360a2090025aa47cd1 --- .coveragerc | 2 +- .../reservation_service.rst | 11 ++ docs/bigquery_reservation_v1/services.rst | 6 +- docs/bigquery_reservation_v1/types.rst | 1 + .../reservation_service/async_client.py | 116 +++++++----- .../services/reservation_service/client.py | 179 +++++++++++------- .../services/reservation_service/pagers.py | 64 +++---- .../types/reservation.py | 46 ++--- synth.metadata | 6 +- .../test_reservation_service.py | 28 ++- 10 files changed, 280 insertions(+), 179 deletions(-) create mode 100644 docs/bigquery_reservation_v1/reservation_service.rst diff --git a/.coveragerc b/.coveragerc index a9b430fa..9cb886d0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,7 +5,7 @@ branch = True fail_under = 100 show_missing = True omit = - google/cloud/bigquery/reservation/__init__.py + google/cloud/bigquery_reservation/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/docs/bigquery_reservation_v1/reservation_service.rst b/docs/bigquery_reservation_v1/reservation_service.rst new file mode 100644 index 00000000..bfa849bf --- /dev/null +++ b/docs/bigquery_reservation_v1/reservation_service.rst @@ -0,0 +1,11 @@ +ReservationService +------------------------------------ + +.. automodule:: google.cloud.bigquery_reservation_v1.services.reservation_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.bigquery_reservation_v1.services.reservation_service.pagers + :members: + :inherited-members: diff --git a/docs/bigquery_reservation_v1/services.rst b/docs/bigquery_reservation_v1/services.rst index b2601c3b..3f9e9577 100644 --- a/docs/bigquery_reservation_v1/services.rst +++ b/docs/bigquery_reservation_v1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Bigquery Reservation v1 API ===================================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.bigquery_reservation_v1.services.reservation_service - :members: - :inherited-members: + reservation_service diff --git a/docs/bigquery_reservation_v1/types.rst b/docs/bigquery_reservation_v1/types.rst index 96a1583d..eca7ccfb 100644 --- a/docs/bigquery_reservation_v1/types.rst +++ b/docs/bigquery_reservation_v1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Bigquery Reservation v1 API .. automodule:: google.cloud.bigquery_reservation_v1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py index 4dbd0608..cb27dce2 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/async_client.py @@ -111,6 +111,7 @@ class ReservationServiceAsyncClient: ReservationServiceClient.parse_common_location_path ) + from_service_account_info = ReservationServiceClient.from_service_account_info from_service_account_file = ReservationServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -190,18 +191,20 @@ async def create_reservation( r"""Creates a new reservation resource. Args: - request (:class:`~.gcbr_reservation.CreateReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.CreateReservationRequest`): The request object. The request for [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. parent (:class:`str`): Required. Project, location. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reservation (:class:`~.gcbr_reservation.Reservation`): + reservation (:class:`google.cloud.bigquery_reservation_v1.types.Reservation`): Definition of the new reservation to create. + This corresponds to the ``reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -210,6 +213,7 @@ async def create_reservation( only contain lower case alphanumeric characters or dash. Max length is 64 characters. + This corresponds to the ``reservation_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -221,7 +225,7 @@ async def create_reservation( sent along with the request as metadata. Returns: - ~.gcbr_reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -281,12 +285,13 @@ async def list_reservations( specified location. Args: - request (:class:`~.reservation.ListReservationsRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.ListReservationsRequest`): The request object. The request for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. parent (:class:`str`): Required. The parent resource name containing project and location, e.g.: ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -298,7 +303,7 @@ async def list_reservations( sent along with the request as metadata. Returns: - ~.pagers.ListReservationsAsyncPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListReservationsAsyncPager: The response for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. @@ -370,13 +375,14 @@ async def get_reservation( r"""Returns information about the reservation. Args: - request (:class:`~.reservation.GetReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.GetReservationRequest`): The request object. The request for [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. name (:class:`str`): Required. Resource name of the reservation to retrieve. E.g., ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -388,7 +394,7 @@ async def get_reservation( sent along with the request as metadata. Returns: - ~.reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -453,13 +459,14 @@ async def delete_reservation( assignments. Args: - request (:class:`~.reservation.DeleteReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.DeleteReservationRequest`): The request object. The request for [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. name (:class:`str`): Required. Resource name of the reservation to retrieve. E.g., ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -528,17 +535,18 @@ async def update_reservation( r"""Updates an existing reservation resource. Args: - request (:class:`~.gcbr_reservation.UpdateReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.UpdateReservationRequest`): The request object. The request for [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. - reservation (:class:`~.gcbr_reservation.Reservation`): + reservation (:class:`google.cloud.bigquery_reservation_v1.types.Reservation`): Content of the reservation to update. This corresponds to the ``reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Standard field mask for the set of fields to be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -550,7 +558,7 @@ async def update_reservation( sent along with the request as metadata. Returns: - ~.gcbr_reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -610,18 +618,20 @@ async def create_capacity_commitment( r"""Creates a new capacity commitment resource. Args: - request (:class:`~.reservation.CreateCapacityCommitmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.CreateCapacityCommitmentRequest`): The request object. The request for [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. parent (:class:`str`): Required. Resource name of the parent reservation. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - capacity_commitment (:class:`~.reservation.CapacityCommitment`): + capacity_commitment (:class:`google.cloud.bigquery_reservation_v1.types.CapacityCommitment`): Content of the capacity commitment to create. + This corresponds to the ``capacity_commitment`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -633,7 +643,7 @@ async def create_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -703,12 +713,13 @@ async def list_capacity_commitments( project. Args: - request (:class:`~.reservation.ListCapacityCommitmentsRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsRequest`): The request object. The request for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. parent (:class:`str`): Required. Resource name of the parent reservation. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -720,7 +731,7 @@ async def list_capacity_commitments( sent along with the request as metadata. Returns: - ~.pagers.ListCapacityCommitmentsAsyncPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListCapacityCommitmentsAsyncPager: The response for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. @@ -792,13 +803,14 @@ async def get_capacity_commitment( r"""Returns information about the capacity commitment. Args: - request (:class:`~.reservation.GetCapacityCommitmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.GetCapacityCommitmentRequest`): The request object. The request for [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. name (:class:`str`): Required. Resource name of the capacity commitment to retrieve. E.g., ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -810,7 +822,7 @@ async def get_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -887,13 +899,14 @@ async def delete_capacity_commitment( error code ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.DeleteCapacityCommitmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.DeleteCapacityCommitmentRequest`): The request object. The request for [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. name (:class:`str`): Required. Resource name of the capacity commitment to delete. E.g., ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -969,18 +982,20 @@ async def update_capacity_commitment( ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.UpdateCapacityCommitmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.UpdateCapacityCommitmentRequest`): The request object. The request for [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. - capacity_commitment (:class:`~.reservation.CapacityCommitment`): + capacity_commitment (:class:`google.cloud.bigquery_reservation_v1.types.CapacityCommitment`): Content of the capacity commitment to update. + This corresponds to the ``capacity_commitment`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Standard field mask for the set of fields to be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -992,7 +1007,7 @@ async def update_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -1072,18 +1087,20 @@ async def split_capacity_commitment( ``FLEX`` and then delete it. Args: - request (:class:`~.reservation.SplitCapacityCommitmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.SplitCapacityCommitmentRequest`): The request object. The request for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. name (:class:`str`): Required. The resource name e.g.,: ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. slot_count (:class:`int`): Number of slots in the capacity commitment after the split. + This corresponds to the ``slot_count`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1095,7 +1112,7 @@ async def split_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.SplitCapacityCommitmentResponse: + google.cloud.bigquery_reservation_v1.types.SplitCapacityCommitmentResponse: The response for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. @@ -1162,12 +1179,13 @@ async def merge_capacity_commitments( ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.MergeCapacityCommitmentsRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.MergeCapacityCommitmentsRequest`): The request object. The request for [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. parent (:class:`str`): Parent resource that identifies admin project and location e.g., ``projects/myproject/locations/us`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1179,6 +1197,7 @@ async def merge_capacity_commitments( ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc + This corresponds to the ``capacity_commitment_ids`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1190,7 +1209,7 @@ async def merge_capacity_commitments( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -1292,7 +1311,7 @@ async def create_assignment( the assignment does not match location of the reservation. Args: - request (:class:`~.reservation.CreateAssignmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.CreateAssignmentRequest`): The request object. The request for [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. Note: "bigquery.reservationAssignments.create" @@ -1301,10 +1320,11 @@ async def create_assignment( Required. The parent resource name of the assignment E.g. ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - assignment (:class:`~.reservation.Assignment`): + assignment (:class:`google.cloud.bigquery_reservation_v1.types.Assignment`): Assignment resource to create. This corresponds to the ``assignment`` field on the ``request`` instance; if ``request`` is provided, this @@ -1317,7 +1337,7 @@ async def create_assignment( sent along with the request as metadata. Returns: - ~.reservation.Assignment: + google.cloud.bigquery_reservation_v1.types.Assignment: A Assignment allows a project to submit jobs of a certain type using slots from the specified reservation. @@ -1396,7 +1416,7 @@ async def list_assignments( **Note** "-" cannot be used for projects nor locations. Args: - request (:class:`~.reservation.ListAssignmentsRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.ListAssignmentsRequest`): The request object. The request for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. parent (:class:`str`): @@ -1407,6 +1427,7 @@ async def list_assignments( Or: ``projects/myproject/locations/US/reservations/-`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1418,7 +1439,7 @@ async def list_assignments( sent along with the request as metadata. Returns: - ~.pagers.ListAssignmentsAsyncPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListAssignmentsAsyncPager: The response for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. @@ -1505,7 +1526,7 @@ async def delete_assignment( ``project2`` will switch to use on-demand mode. Args: - request (:class:`~.reservation.DeleteAssignmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.DeleteAssignmentRequest`): The request object. The request for [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. Note: "bigquery.reservationAssignments.delete" @@ -1513,6 +1534,7 @@ async def delete_assignment( name (:class:`str`): Required. Name of the resource, e.g. ``projects/myproject/locations/US/reservations/team1-prod/assignments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1605,7 +1627,7 @@ async def search_assignments( **Note** "-" cannot be used for projects nor locations. Args: - request (:class:`~.reservation.SearchAssignmentsRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.SearchAssignmentsRequest`): The request object. The request for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. Note: "bigquery.reservationAssignments.search" @@ -1614,6 +1636,7 @@ async def search_assignments( Required. The resource name of the admin project(containing project and location), e.g.: ``projects/myproject/locations/US``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1626,6 +1649,7 @@ async def search_assignments( - ``assignee=folders/123`` - ``assignee=organizations/456`` + This corresponds to the ``query`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1637,7 +1661,7 @@ async def search_assignments( sent along with the request as metadata. Returns: - ~.pagers.SearchAssignmentsAsyncPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.SearchAssignmentsAsyncPager: The response for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. @@ -1716,7 +1740,7 @@ async def move_assignment( reservation. Args: - request (:class:`~.reservation.MoveAssignmentRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.MoveAssignmentRequest`): The request object. The request for [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment]. **Note**: "bigquery.reservationAssignments.create" @@ -1728,12 +1752,14 @@ async def move_assignment( name (:class:`str`): Required. The resource name of the assignment, e.g. ``projects/myproject/locations/US/reservations/team1-prod/assignments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. destination_id (:class:`str`): The new reservation ID, e.g.: ``projects/myotherproject/locations/US/reservations/team2-prod`` + This corresponds to the ``destination_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1745,7 +1771,7 @@ async def move_assignment( sent along with the request as metadata. Returns: - ~.reservation.Assignment: + google.cloud.bigquery_reservation_v1.types.Assignment: A Assignment allows a project to submit jobs of a certain type using slots from the specified reservation. @@ -1803,13 +1829,14 @@ async def get_bi_reservation( r"""Retrieves a BI reservation. Args: - request (:class:`~.reservation.GetBiReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.GetBiReservationRequest`): The request object. A request to get a singleton BI reservation. name (:class:`str`): Required. Name of the requested reservation, for example: ``projects/{project_id}/locations/{location_id}/bireservation`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1821,7 +1848,7 @@ async def get_bi_reservation( sent along with the request as metadata. Returns: - ~.reservation.BiReservation: + google.cloud.bigquery_reservation_v1.types.BiReservation: Represents a BI Reservation. """ # Create or coerce a protobuf request object. @@ -1890,17 +1917,18 @@ async def update_bi_reservation( must be set to 0. Args: - request (:class:`~.reservation.UpdateBiReservationRequest`): + request (:class:`google.cloud.bigquery_reservation_v1.types.UpdateBiReservationRequest`): The request object. A request to update a BI reservation. - bi_reservation (:class:`~.reservation.BiReservation`): + bi_reservation (:class:`google.cloud.bigquery_reservation_v1.types.BiReservation`): A reservation to update. This corresponds to the ``bi_reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): A list of fields to be updated in this request. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1912,7 +1940,7 @@ async def update_bi_reservation( sent along with the request as metadata. Returns: - ~.reservation.BiReservation: + google.cloud.bigquery_reservation_v1.types.BiReservation: Represents a BI Reservation. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py index 882b1b5a..f6c0490a 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py @@ -133,6 +133,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ReservationServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -145,7 +161,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ReservationServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -308,10 +324,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ReservationServiceTransport]): The + transport (Union[str, ReservationServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): 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 @@ -423,26 +439,29 @@ def create_reservation( r"""Creates a new reservation resource. Args: - request (:class:`~.gcbr_reservation.CreateReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.CreateReservationRequest): The request object. The request for [ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation]. - parent (:class:`str`): + parent (str): Required. Project, location. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reservation (:class:`~.gcbr_reservation.Reservation`): + reservation (google.cloud.bigquery_reservation_v1.types.Reservation): Definition of the new reservation to create. + This corresponds to the ``reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - reservation_id (:class:`str`): + reservation_id (str): The reservation ID. This field must only contain lower case alphanumeric characters or dash. Max length is 64 characters. + This corresponds to the ``reservation_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -454,7 +473,7 @@ def create_reservation( sent along with the request as metadata. Returns: - ~.gcbr_reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -515,12 +534,13 @@ def list_reservations( specified location. Args: - request (:class:`~.reservation.ListReservationsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListReservationsRequest): The request object. The request for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. - parent (:class:`str`): + parent (str): Required. The parent resource name containing project and location, e.g.: ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -532,7 +552,7 @@ def list_reservations( sent along with the request as metadata. Returns: - ~.pagers.ListReservationsPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListReservationsPager: The response for [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. @@ -597,13 +617,14 @@ def get_reservation( r"""Returns information about the reservation. Args: - request (:class:`~.reservation.GetReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.GetReservationRequest): The request object. The request for [ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation]. - name (:class:`str`): + name (str): Required. Resource name of the reservation to retrieve. E.g., ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -615,7 +636,7 @@ def get_reservation( sent along with the request as metadata. Returns: - ~.reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -673,13 +694,14 @@ def delete_reservation( assignments. Args: - request (:class:`~.reservation.DeleteReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.DeleteReservationRequest): The request object. The request for [ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation]. - name (:class:`str`): + name (str): Required. Resource name of the reservation to retrieve. E.g., ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -741,17 +763,18 @@ def update_reservation( r"""Updates an existing reservation resource. Args: - request (:class:`~.gcbr_reservation.UpdateReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.UpdateReservationRequest): The request object. The request for [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. - reservation (:class:`~.gcbr_reservation.Reservation`): + reservation (google.cloud.bigquery_reservation_v1.types.Reservation): Content of the reservation to update. This corresponds to the ``reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Standard field mask for the set of fields to be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -763,7 +786,7 @@ def update_reservation( sent along with the request as metadata. Returns: - ~.gcbr_reservation.Reservation: + google.cloud.bigquery_reservation_v1.types.Reservation: A reservation is a mechanism used to guarantee slots to users. @@ -824,18 +847,20 @@ def create_capacity_commitment( r"""Creates a new capacity commitment resource. Args: - request (:class:`~.reservation.CreateCapacityCommitmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.CreateCapacityCommitmentRequest): The request object. The request for [ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment]. - parent (:class:`str`): + parent (str): Required. Resource name of the parent reservation. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - capacity_commitment (:class:`~.reservation.CapacityCommitment`): + capacity_commitment (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): Content of the capacity commitment to create. + This corresponds to the ``capacity_commitment`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -847,7 +872,7 @@ def create_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -920,12 +945,13 @@ def list_capacity_commitments( project. Args: - request (:class:`~.reservation.ListCapacityCommitmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsRequest): The request object. The request for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. - parent (:class:`str`): + parent (str): Required. Resource name of the parent reservation. E.g., ``projects/myproject/locations/US`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -937,7 +963,7 @@ def list_capacity_commitments( sent along with the request as metadata. Returns: - ~.pagers.ListCapacityCommitmentsPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListCapacityCommitmentsPager: The response for [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. @@ -1004,13 +1030,14 @@ def get_capacity_commitment( r"""Returns information about the capacity commitment. Args: - request (:class:`~.reservation.GetCapacityCommitmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.GetCapacityCommitmentRequest): The request object. The request for [ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment]. - name (:class:`str`): + name (str): Required. Resource name of the capacity commitment to retrieve. E.g., ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1022,7 +1049,7 @@ def get_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -1092,13 +1119,14 @@ def delete_capacity_commitment( error code ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.DeleteCapacityCommitmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.DeleteCapacityCommitmentRequest): The request object. The request for [ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment]. - name (:class:`str`): + name (str): Required. Resource name of the capacity commitment to delete. E.g., ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1169,18 +1197,20 @@ def update_capacity_commitment( ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.UpdateCapacityCommitmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.UpdateCapacityCommitmentRequest): The request object. The request for [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. - capacity_commitment (:class:`~.reservation.CapacityCommitment`): + capacity_commitment (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): Content of the capacity commitment to update. + This corresponds to the ``capacity_commitment`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Standard field mask for the set of fields to be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1192,7 +1222,7 @@ def update_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -1275,18 +1305,20 @@ def split_capacity_commitment( ``FLEX`` and then delete it. Args: - request (:class:`~.reservation.SplitCapacityCommitmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.SplitCapacityCommitmentRequest): The request object. The request for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. - name (:class:`str`): + name (str): Required. The resource name e.g.,: ``projects/myproject/locations/US/capacityCommitments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - slot_count (:class:`int`): + slot_count (int): Number of slots in the capacity commitment after the split. + This corresponds to the ``slot_count`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1298,7 +1330,7 @@ def split_capacity_commitment( sent along with the request as metadata. Returns: - ~.reservation.SplitCapacityCommitmentResponse: + google.cloud.bigquery_reservation_v1.types.SplitCapacityCommitmentResponse: The response for [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. @@ -1368,16 +1400,17 @@ def merge_capacity_commitments( ``google.rpc.Code.FAILED_PRECONDITION``. Args: - request (:class:`~.reservation.MergeCapacityCommitmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.MergeCapacityCommitmentsRequest): The request object. The request for [ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments]. - parent (:class:`str`): + parent (str): Parent resource that identifies admin project and location e.g., ``projects/myproject/locations/us`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - capacity_commitment_ids (:class:`Sequence[str]`): + capacity_commitment_ids (Sequence[str]): Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location @@ -1385,6 +1418,7 @@ def merge_capacity_commitments( ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc + This corresponds to the ``capacity_commitment_ids`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1396,7 +1430,7 @@ def merge_capacity_commitments( sent along with the request as metadata. Returns: - ~.reservation.CapacityCommitment: + google.cloud.bigquery_reservation_v1.types.CapacityCommitment: Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some @@ -1501,19 +1535,20 @@ def create_assignment( the assignment does not match location of the reservation. Args: - request (:class:`~.reservation.CreateAssignmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.CreateAssignmentRequest): The request object. The request for [ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment]. Note: "bigquery.reservationAssignments.create" permission is required on the related assignee. - parent (:class:`str`): + parent (str): Required. The parent resource name of the assignment E.g. ``projects/myproject/locations/US/reservations/team1-prod`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - assignment (:class:`~.reservation.Assignment`): + assignment (google.cloud.bigquery_reservation_v1.types.Assignment): Assignment resource to create. This corresponds to the ``assignment`` field on the ``request`` instance; if ``request`` is provided, this @@ -1526,7 +1561,7 @@ def create_assignment( sent along with the request as metadata. Returns: - ~.reservation.Assignment: + google.cloud.bigquery_reservation_v1.types.Assignment: A Assignment allows a project to submit jobs of a certain type using slots from the specified reservation. @@ -1606,10 +1641,10 @@ def list_assignments( **Note** "-" cannot be used for projects nor locations. Args: - request (:class:`~.reservation.ListAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListAssignmentsRequest): The request object. The request for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. - parent (:class:`str`): + parent (str): Required. The parent resource name e.g.: ``projects/myproject/locations/US/reservations/team1-prod`` @@ -1617,6 +1652,7 @@ def list_assignments( Or: ``projects/myproject/locations/US/reservations/-`` + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1628,7 +1664,7 @@ def list_assignments( sent along with the request as metadata. Returns: - ~.pagers.ListAssignmentsPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.ListAssignmentsPager: The response for [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. @@ -1708,14 +1744,15 @@ def delete_assignment( ``project2`` will switch to use on-demand mode. Args: - request (:class:`~.reservation.DeleteAssignmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.DeleteAssignmentRequest): The request object. The request for [ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment]. Note: "bigquery.reservationAssignments.delete" permission is required on the related assignee. - name (:class:`str`): + name (str): Required. Name of the resource, e.g. ``projects/myproject/locations/US/reservations/team1-prod/assignments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1801,19 +1838,20 @@ def search_assignments( **Note** "-" cannot be used for projects nor locations. Args: - request (:class:`~.reservation.SearchAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.SearchAssignmentsRequest): The request object. The request for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. Note: "bigquery.reservationAssignments.search" permission is required on the related assignee. - parent (:class:`str`): + parent (str): Required. The resource name of the admin project(containing project and location), e.g.: ``projects/myproject/locations/US``. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - query (:class:`str`): + query (str): Please specify resource name as assignee in the query. Examples: @@ -1822,6 +1860,7 @@ def search_assignments( - ``assignee=folders/123`` - ``assignee=organizations/456`` + This corresponds to the ``query`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1833,7 +1872,7 @@ def search_assignments( sent along with the request as metadata. Returns: - ~.pagers.SearchAssignmentsPager: + google.cloud.bigquery_reservation_v1.services.reservation_service.pagers.SearchAssignmentsPager: The response for [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. @@ -1905,7 +1944,7 @@ def move_assignment( reservation. Args: - request (:class:`~.reservation.MoveAssignmentRequest`): + request (google.cloud.bigquery_reservation_v1.types.MoveAssignmentRequest): The request object. The request for [ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment]. **Note**: "bigquery.reservationAssignments.create" @@ -1914,15 +1953,17 @@ def move_assignment( **Note**: "bigquery.reservationAssignments.create" and "bigquery.reservationAssignments.delete" permission are required on the related assignee. - name (:class:`str`): + name (str): Required. The resource name of the assignment, e.g. ``projects/myproject/locations/US/reservations/team1-prod/assignments/123`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - destination_id (:class:`str`): + destination_id (str): The new reservation ID, e.g.: ``projects/myotherproject/locations/US/reservations/team2-prod`` + This corresponds to the ``destination_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1934,7 +1975,7 @@ def move_assignment( sent along with the request as metadata. Returns: - ~.reservation.Assignment: + google.cloud.bigquery_reservation_v1.types.Assignment: A Assignment allows a project to submit jobs of a certain type using slots from the specified reservation. @@ -1993,13 +2034,14 @@ def get_bi_reservation( r"""Retrieves a BI reservation. Args: - request (:class:`~.reservation.GetBiReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.GetBiReservationRequest): The request object. A request to get a singleton BI reservation. - name (:class:`str`): + name (str): Required. Name of the requested reservation, for example: ``projects/{project_id}/locations/{location_id}/bireservation`` + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2011,7 +2053,7 @@ def get_bi_reservation( sent along with the request as metadata. Returns: - ~.reservation.BiReservation: + google.cloud.bigquery_reservation_v1.types.BiReservation: Represents a BI Reservation. """ # Create or coerce a protobuf request object. @@ -2073,17 +2115,18 @@ def update_bi_reservation( must be set to 0. Args: - request (:class:`~.reservation.UpdateBiReservationRequest`): + request (google.cloud.bigquery_reservation_v1.types.UpdateBiReservationRequest): The request object. A request to update a BI reservation. - bi_reservation (:class:`~.reservation.BiReservation`): + bi_reservation (google.cloud.bigquery_reservation_v1.types.BiReservation): A reservation to update. This corresponds to the ``bi_reservation`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): A list of fields to be updated in this request. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2095,7 +2138,7 @@ def update_bi_reservation( sent along with the request as metadata. Returns: - ~.reservation.BiReservation: + google.cloud.bigquery_reservation_v1.types.BiReservation: Represents a BI Reservation. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py b/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py index a1c94827..0c1dc9ef 100644 --- a/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py +++ b/google/cloud/bigquery_reservation_v1/services/reservation_service/pagers.py @@ -24,7 +24,7 @@ class ListReservationsPager: """A pager for iterating through ``list_reservations`` requests. This class thinly wraps an initial - :class:`~.reservation.ListReservationsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListReservationsResponse` object, and provides an ``__iter__`` method to iterate through its ``reservations`` field. @@ -33,7 +33,7 @@ class ListReservationsPager: through the ``reservations`` field on the corresponding responses. - All the usual :class:`~.reservation.ListReservationsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListReservationsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListReservationsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListReservationsRequest): The initial request object. - response (:class:`~.reservation.ListReservationsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListReservationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListReservationsAsyncPager: """A pager for iterating through ``list_reservations`` requests. This class thinly wraps an initial - :class:`~.reservation.ListReservationsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListReservationsResponse` object, and provides an ``__aiter__`` method to iterate through its ``reservations`` field. @@ -95,7 +95,7 @@ class ListReservationsAsyncPager: through the ``reservations`` field on the corresponding responses. - All the usual :class:`~.reservation.ListReservationsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListReservationsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -113,9 +113,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListReservationsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListReservationsRequest): The initial request object. - response (:class:`~.reservation.ListReservationsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListReservationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -152,7 +152,7 @@ class ListCapacityCommitmentsPager: """A pager for iterating through ``list_capacity_commitments`` requests. This class thinly wraps an initial - :class:`~.reservation.ListCapacityCommitmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse` object, and provides an ``__iter__`` method to iterate through its ``capacity_commitments`` field. @@ -161,7 +161,7 @@ class ListCapacityCommitmentsPager: through the ``capacity_commitments`` field on the corresponding responses. - All the usual :class:`~.reservation.ListCapacityCommitmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -179,9 +179,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListCapacityCommitmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsRequest): The initial request object. - response (:class:`~.reservation.ListCapacityCommitmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -214,7 +214,7 @@ class ListCapacityCommitmentsAsyncPager: """A pager for iterating through ``list_capacity_commitments`` requests. This class thinly wraps an initial - :class:`~.reservation.ListCapacityCommitmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse` object, and provides an ``__aiter__`` method to iterate through its ``capacity_commitments`` field. @@ -223,7 +223,7 @@ class ListCapacityCommitmentsAsyncPager: through the ``capacity_commitments`` field on the corresponding responses. - All the usual :class:`~.reservation.ListCapacityCommitmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -241,9 +241,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListCapacityCommitmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsRequest): The initial request object. - response (:class:`~.reservation.ListCapacityCommitmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListCapacityCommitmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -280,7 +280,7 @@ class ListAssignmentsPager: """A pager for iterating through ``list_assignments`` requests. This class thinly wraps an initial - :class:`~.reservation.ListAssignmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse` object, and provides an ``__iter__`` method to iterate through its ``assignments`` field. @@ -289,7 +289,7 @@ class ListAssignmentsPager: through the ``assignments`` field on the corresponding responses. - All the usual :class:`~.reservation.ListAssignmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -307,9 +307,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListAssignmentsRequest): The initial request object. - response (:class:`~.reservation.ListAssignmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -342,7 +342,7 @@ class ListAssignmentsAsyncPager: """A pager for iterating through ``list_assignments`` requests. This class thinly wraps an initial - :class:`~.reservation.ListAssignmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse` object, and provides an ``__aiter__`` method to iterate through its ``assignments`` field. @@ -351,7 +351,7 @@ class ListAssignmentsAsyncPager: through the ``assignments`` field on the corresponding responses. - All the usual :class:`~.reservation.ListAssignmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -369,9 +369,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.ListAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.ListAssignmentsRequest): The initial request object. - response (:class:`~.reservation.ListAssignmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.ListAssignmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -408,7 +408,7 @@ class SearchAssignmentsPager: """A pager for iterating through ``search_assignments`` requests. This class thinly wraps an initial - :class:`~.reservation.SearchAssignmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse` object, and provides an ``__iter__`` method to iterate through its ``assignments`` field. @@ -417,7 +417,7 @@ class SearchAssignmentsPager: through the ``assignments`` field on the corresponding responses. - All the usual :class:`~.reservation.SearchAssignmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -435,9 +435,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.SearchAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.SearchAssignmentsRequest): The initial request object. - response (:class:`~.reservation.SearchAssignmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -470,7 +470,7 @@ class SearchAssignmentsAsyncPager: """A pager for iterating through ``search_assignments`` requests. This class thinly wraps an initial - :class:`~.reservation.SearchAssignmentsResponse` object, and + :class:`google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse` object, and provides an ``__aiter__`` method to iterate through its ``assignments`` field. @@ -479,7 +479,7 @@ class SearchAssignmentsAsyncPager: through the ``assignments`` field on the corresponding responses. - All the usual :class:`~.reservation.SearchAssignmentsResponse` + All the usual :class:`google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -497,9 +497,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.reservation.SearchAssignmentsRequest`): + request (google.cloud.bigquery_reservation_v1.types.SearchAssignmentsRequest): The initial request object. - response (:class:`~.reservation.SearchAssignmentsResponse`): + response (google.cloud.bigquery_reservation_v1.types.SearchAssignmentsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/bigquery_reservation_v1/types/reservation.py b/google/cloud/bigquery_reservation_v1/types/reservation.py index f743aab4..43f13d98 100644 --- a/google/cloud/bigquery_reservation_v1/types/reservation.py +++ b/google/cloud/bigquery_reservation_v1/types/reservation.py @@ -113,18 +113,18 @@ class CapacityCommitment(proto.Message): ``projects/myproject/locations/US/capacityCommitments/123`` slot_count (int): Number of slots in this commitment. - plan (~.gcbr_reservation.CapacityCommitment.CommitmentPlan): + plan (google.cloud.bigquery_reservation_v1.types.CapacityCommitment.CommitmentPlan): Capacity commitment commitment plan. - state (~.gcbr_reservation.CapacityCommitment.State): + state (google.cloud.bigquery_reservation_v1.types.CapacityCommitment.State): Output only. State of the commitment. - commitment_end_time (~.timestamp.Timestamp): + commitment_end_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The end of the current commitment period. It is applicable only for ACTIVE capacity commitments. - failure_status (~.status.Status): + failure_status (google.rpc.status_pb2.Status): Output only. For FAILED commitment plan, provides the reason of failure. - renewal_plan (~.gcbr_reservation.CapacityCommitment.CommitmentPlan): + renewal_plan (google.cloud.bigquery_reservation_v1.types.CapacityCommitment.CommitmentPlan): The plan this capacity commitment is converted to after commitment_end_time passes. Once the plan is changed, committed period is extended according to commitment plan. @@ -180,7 +180,7 @@ class CreateReservationRequest(proto.Message): The reservation ID. This field must only contain lower case alphanumeric characters or dash. Max length is 64 characters. - reservation (~.gcbr_reservation.Reservation): + reservation (google.cloud.bigquery_reservation_v1.types.Reservation): Definition of the new reservation to create. """ @@ -219,7 +219,7 @@ class ListReservationsResponse(proto.Message): [ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations]. Attributes: - reservations (Sequence[~.gcbr_reservation.Reservation]): + reservations (Sequence[google.cloud.bigquery_reservation_v1.types.Reservation]): List of reservations visible to the user. next_page_token (str): Token to retrieve the next page of results, @@ -269,9 +269,9 @@ class UpdateReservationRequest(proto.Message): [ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation]. Attributes: - reservation (~.gcbr_reservation.Reservation): + reservation (google.cloud.bigquery_reservation_v1.types.Reservation): Content of the reservation to update. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Standard field mask for the set of fields to be updated. """ @@ -289,7 +289,7 @@ class CreateCapacityCommitmentRequest(proto.Message): parent (str): Required. Resource name of the parent reservation. E.g., ``projects/myproject/locations/US`` - capacity_commitment (~.gcbr_reservation.CapacityCommitment): + capacity_commitment (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): Content of the capacity commitment to create. enforce_single_admin_project_per_org (bool): If true, fail the request if another project @@ -332,7 +332,7 @@ class ListCapacityCommitmentsResponse(proto.Message): [ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments]. Attributes: - capacity_commitments (Sequence[~.gcbr_reservation.CapacityCommitment]): + capacity_commitments (Sequence[google.cloud.bigquery_reservation_v1.types.CapacityCommitment]): List of capacity commitments visible to the user. next_page_token (str): @@ -385,9 +385,9 @@ class UpdateCapacityCommitmentRequest(proto.Message): [ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment]. Attributes: - capacity_commitment (~.gcbr_reservation.CapacityCommitment): + capacity_commitment (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): Content of the capacity commitment to update. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Standard field mask for the set of fields to be updated. """ @@ -422,9 +422,9 @@ class SplitCapacityCommitmentResponse(proto.Message): [ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment]. Attributes: - first (~.gcbr_reservation.CapacityCommitment): + first (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): First capacity commitment, result of a split. - second (~.gcbr_reservation.CapacityCommitment): + second (google.cloud.bigquery_reservation_v1.types.CapacityCommitment): Second capacity commitment, result of a split. """ @@ -469,9 +469,9 @@ class Assignment(proto.Message): The resource which will use the reservation. E.g. ``projects/myproject``, ``folders/123``, or ``organizations/456``. - job_type (~.gcbr_reservation.Assignment.JobType): + job_type (google.cloud.bigquery_reservation_v1.types.Assignment.JobType): Which type of jobs will use the reservation. - state (~.gcbr_reservation.Assignment.State): + state (google.cloud.bigquery_reservation_v1.types.Assignment.State): Output only. State of the assignment. """ @@ -511,7 +511,7 @@ class CreateAssignmentRequest(proto.Message): parent (str): Required. The parent resource name of the assignment E.g. ``projects/myproject/locations/US/reservations/team1-prod`` - assignment (~.gcbr_reservation.Assignment): + assignment (google.cloud.bigquery_reservation_v1.types.Assignment): Assignment resource to create. """ @@ -553,7 +553,7 @@ class ListAssignmentsResponse(proto.Message): [ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments]. Attributes: - assignments (Sequence[~.gcbr_reservation.Assignment]): + assignments (Sequence[google.cloud.bigquery_reservation_v1.types.Assignment]): List of assignments visible to the user. next_page_token (str): Token to retrieve the next page of results, @@ -626,7 +626,7 @@ class SearchAssignmentsResponse(proto.Message): [ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments]. Attributes: - assignments (Sequence[~.gcbr_reservation.Assignment]): + assignments (Sequence[google.cloud.bigquery_reservation_v1.types.Assignment]): List of assignments visible to the user. next_page_token (str): Token to retrieve the next page of results, @@ -676,7 +676,7 @@ class BiReservation(proto.Message): The resource name of the singleton BI reservation. Reservation names have the form ``projects/{project_id}/locations/{location_id}/bireservation``. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update timestamp of a reservation. size (int): @@ -706,9 +706,9 @@ class UpdateBiReservationRequest(proto.Message): r"""A request to update a BI reservation. Attributes: - bi_reservation (~.gcbr_reservation.BiReservation): + bi_reservation (google.cloud.bigquery_reservation_v1.types.BiReservation): A reservation to update. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): A list of fields to be updated in this request. """ diff --git a/synth.metadata b/synth.metadata index cefb0577..70085e2c 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "520682435235d9c503983a360a2090025aa47cd1", + "internalRef": "350246057" } }, { @@ -42,6 +42,7 @@ } ], "generatedFiles": [ + ".coveragerc", ".flake8", ".github/CONTRIBUTING.md", ".github/ISSUE_TEMPLATE/bug_report.md", @@ -93,6 +94,7 @@ "MANIFEST.in", "docs/_static/custom.css", "docs/_templates/layout.html", + "docs/bigquery_reservation_v1/reservation_service.rst", "docs/bigquery_reservation_v1/services.rst", "docs/bigquery_reservation_v1/types.rst", "docs/conf.py", diff --git a/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py b/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py index d7ea0ad7..58e735ee 100644 --- a/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py +++ b/tests/unit/gapic/bigquery_reservation_v1/test_reservation_service.py @@ -94,8 +94,21 @@ def test__get_default_mtls_endpoint(): ) +def test_reservation_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ReservationServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "bigqueryreservation.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ReservationServiceClient, ReservationServiceAsyncClient] + "client_class", [ReservationServiceClient, ReservationServiceAsyncClient,] ) def test_reservation_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -114,7 +127,10 @@ def test_reservation_service_client_from_service_account_file(client_class): def test_reservation_service_client_get_transport_class(): transport = ReservationServiceClient.get_transport_class() - assert transport == transports.ReservationServiceGrpcTransport + available_transports = [ + transports.ReservationServiceGrpcTransport, + ] + assert transport in available_transports transport = ReservationServiceClient.get_transport_class("grpc") assert transport == transports.ReservationServiceGrpcTransport @@ -5583,7 +5599,7 @@ def test_reservation_service_host_with_port(): def test_reservation_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ReservationServiceGrpcTransport( @@ -5595,7 +5611,7 @@ def test_reservation_service_grpc_transport_channel(): def test_reservation_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ReservationServiceGrpcAsyncIOTransport( @@ -5620,7 +5636,7 @@ def test_reservation_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -5676,7 +5692,7 @@ def test_reservation_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel