async def reload_document( self, request: document.ReloadDocumentRequest = None, *, name: str = None, gcs_source: gcs.GcsSource = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes. Note: If the document source is Google Cloud Storage URI, its metadata will be replaced with the custom metadata from Google Cloud Storage if the ``import_gcs_custom_metadata`` field is set to true in the request. Note: The ``projects.agent.knowledgeBases.documents`` resource is deprecated; only use ``projects.knowledgeBases.documents``. Args: request (:class:`google.cloud.dialogflow_v2beta1.types.ReloadDocumentRequest`): The request object. Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. name (:class:`str`): Required. The name of the document to reload. Format: ``projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. gcs_source (:class:`google.cloud.dialogflow_v2beta1.types.GcsSource`): The path for a Cloud Storage source file for reloading document content. If not provided, the Document's existing source will be reloaded. This corresponds to the ``gcs_source`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dialogflow_v2beta1.types.Document` A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. For more information, see the [knowledge base guide](\ https://cloud.google.com/dialogflow/docs/how/knowledge-bases). Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, gcs_source]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = document.ReloadDocumentRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name if gcs_source is not None: request.gcs_source = gcs_source # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.reload_document, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("name", request.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, document.Document, metadata_type=document.KnowledgeOperationMetadata, ) # Done; return the response. return response
async def batch_process_documents( self, request: document_understanding.BatchProcessDocumentsRequest = None, *, requests: Sequence[ document_understanding.ProcessDocumentRequest] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format. Args: request (:class:`~.document_understanding.BatchProcessDocumentsRequest`): The request object. Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format. requests (:class:`Sequence[~.document_understanding.ProcessDocumentRequest]`): Required. Individual requests for each document. This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.document_understanding.BatchProcessDocumentsResponse``: Response to an batch document processing request. This is returned in the LRO Operation after the operation is complete. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. if request is not None and any([requests]): raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = document_understanding.BatchProcessDocumentsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if requests is not None: request.requests = requests # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.batch_process_documents, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, ), ), default_timeout=120.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("parent", request.parent), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, document_understanding.BatchProcessDocumentsResponse, metadata_type=document_understanding.OperationMetadata, ) # Done; return the response. return response
async def batch_migrate_resources( self, request: migration_service.BatchMigrateResourcesRequest = None, *, parent: str = None, migrate_resource_requests: Sequence[ migration_service.MigrateResourceRequest] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and datalabeling.googleapis.com to AI Platform (Unified). Args: request (:class:`google.cloud.aiplatform_v1beta1.types.BatchMigrateResourcesRequest`): The request object. Request message for ``MigrationService.BatchMigrateResources``. parent (:class:`str`): Required. The location of the migrated resource will live in. Format: ``projects/{project}/locations/{location}`` This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. migrate_resource_requests (:class:`Sequence[google.cloud.aiplatform_v1beta1.types.MigrateResourceRequest]`): Required. The request messages specifying the resources to migrate. They must be in the same location as the destination. Up to 50 resources can be migrated in one batch. This corresponds to the ``migrate_resource_requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.BatchMigrateResourcesResponse` Response message for ``MigrationService.BatchMigrateResources``. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, migrate_resource_requests]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = migration_service.BatchMigrateResourcesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent if migrate_resource_requests: request.migrate_resource_requests.extend(migrate_resource_requests) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.batch_migrate_resources, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("parent", request.parent), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, migration_service.BatchMigrateResourcesResponse, metadata_type=migration_service. BatchMigrateResourcesOperationMetadata, ) # Done; return the response. return response
async def delete_tag_binding( self, request: tag_bindings.DeleteTagBindingRequest = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a TagBinding. Args: request (:class:`google.cloud.resourcemanager_v3.types.DeleteTagBindingRequest`): The request object. The request message to delete a TagBinding. name (:class:`str`): Required. The name of the TagBinding. This is a String of the form: ``tagBindings/{id}`` (e.g. ``tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456``). This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = tag_bindings.DeleteTagBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_tag_binding, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty_pb2.Empty, metadata_type=tag_bindings.DeleteTagBindingMetadata, ) # Done; return the response. return response
async def export_test_cases( self, request: test_case.ExportTestCasesRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases. Args: request (:class:`google.cloud.dialogflowcx_v3beta1.types.ExportTestCasesRequest`): The request object. The request message for [TestCases.ExportTestCases][google.cloud.dialogflow.cx.v3beta1.TestCases.ExportTestCases]. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dialogflowcx_v3beta1.types.ExportTestCasesResponse` The response message for [TestCases.ExportTestCases][google.cloud.dialogflow.cx.v3beta1.TestCases.ExportTestCases]. """ # Create or coerce a protobuf request object. request = test_case.ExportTestCasesRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.export_test_cases, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("parent", request.parent), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, test_case.ExportTestCasesResponse, metadata_type=test_case.ExportTestCasesMetadata, ) # Done; return the response. return response
async def export_entities( self, request: datastore_admin.ExportEntitiesRequest = None, *, project_id: str = None, labels: Sequence[ datastore_admin.ExportEntitiesRequest.LabelsEntry] = None, entity_filter: datastore_admin.EntityFilter = None, output_url_prefix: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports a copy of all or a subset of entities from Google Cloud Datastore to another storage system, such as Google Cloud Storage. Recent updates to entities may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. Args: request (:class:`~.datastore_admin.ExportEntitiesRequest`): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities]. project_id (:class:`str`): Required. Project ID against which to make the request. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. labels (:class:`Sequence[~.datastore_admin.ExportEntitiesRequest.LabelsEntry]`): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. entity_filter (:class:`~.datastore_admin.EntityFilter`): Description of what data from the project is included in the export. This corresponds to the ``entity_filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. output_url_prefix (:class:`str`): Required. Location for the export metadata and data files. The full resource URL of the external storage location. Currently, only Google Cloud Storage is supported. So output_url_prefix should be of the form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]``, where ``BUCKET_NAME`` is the name of the Cloud Storage bucket and ``NAMESPACE_PATH`` is an optional Cloud Storage namespace path (this is not a Cloud Datastore namespace). For more information about Cloud Storage namespace paths, see `Object name considerations <https://cloud.google.com/storage/docs/naming#object-considerations>`__. The resulting files will be nested deeper than the specified URL prefix. The final output URL will be provided in the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That value should be used for subsequent ImportEntities operations. By nesting the data files deeper, the same Cloud Storage bucket can be used in multiple ExportEntities operations without conflict. This corresponds to the ``output_url_prefix`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.datastore_admin.ExportEntitiesResponse``: The response for [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities]. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any( [project_id, labels, entity_filter, output_url_prefix]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = datastore_admin.ExportEntitiesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if entity_filter is not None: request.entity_filter = entity_filter if output_url_prefix is not None: request.output_url_prefix = output_url_prefix if labels: request.labels.update(labels) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.export_entities, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, datastore_admin.ExportEntitiesResponse, metadata_type=datastore_admin.ExportEntitiesMetadata, ) # Done; return the response. return response
async def update_index( self, request: index_service.UpdateIndexRequest = None, *, index: gca_index.Index = None, update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates an Index. Args: request (:class:`google.cloud.aiplatform_v1.types.UpdateIndexRequest`): The request object. Request message for [IndexService.UpdateIndex][google.cloud.aiplatform.v1.IndexService.UpdateIndex]. index (:class:`google.cloud.aiplatform_v1.types.Index`): Required. The Index which updates the resource on the server. This corresponds to the ``index`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): The update mask applies to the resource. For the ``FieldMask`` definition, see [google.protobuf.FieldMask][google.protobuf.FieldMask]. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.Index` A representation of a collection of database items organized in a way that allows for approximate nearest neighbor (a.k.a ANN) algorithms search. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([index, update_mask]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = index_service.UpdateIndexRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if index is not None: request.index = index if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_index, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("index.name", request.index.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, gca_index.Index, metadata_type=index_service.UpdateIndexOperationMetadata, ) # Done; return the response. return response
async def export_data( self, request: dataset_service.ExportDataRequest = None, *, name: str = None, export_config: dataset.ExportDataConfig = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports data from a Dataset. Args: request (:class:`google.cloud.aiplatform_v1.types.ExportDataRequest`): The request object. Request message for ``DatasetService.ExportData``. name (:class:`str`): Required. The name of the Dataset resource. Format: ``projects/{project}/locations/{location}/datasets/{dataset}`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. export_config (:class:`google.cloud.aiplatform_v1.types.ExportDataConfig`): Required. The desired output location. This corresponds to the ``export_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.ExportDataResponse` Response message for ``DatasetService.ExportData``. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, export_config]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = dataset_service.ExportDataRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name if export_config is not None: request.export_config = export_config # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.export_data, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, dataset_service.ExportDataResponse, metadata_type=dataset_service.ExportDataOperationMetadata, ) # Done; return the response. return response
async def export_flow( self, request: Union[flow.ExportFlowRequest, dict] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports the specified flow to a binary file. This method is a `long-running operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__. The returned ``Operation`` type has the following method-specific fields: - ``metadata``: An empty `Struct message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__ - ``response``: [ExportFlowResponse][google.cloud.dialogflow.cx.v3.ExportFlowResponse] Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported. .. code-block:: from google.cloud import dialogflowcx_v3 def sample_export_flow(): # Create a client client = dialogflowcx_v3.FlowsClient() # Initialize request argument(s) request = dialogflowcx_v3.ExportFlowRequest( name="name_value", ) # Make the request operation = client.export_flow(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response) Args: request (Union[google.cloud.dialogflowcx_v3.types.ExportFlowRequest, dict]): The request object. The request message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3.Flows.ExportFlow]. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dialogflowcx_v3.types.ExportFlowResponse` The response message for [Flows.ExportFlow][google.cloud.dialogflow.cx.v3.Flows.ExportFlow]. """ # Create or coerce a protobuf request object. request = flow.ExportFlowRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.export_flow, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, flow.ExportFlowResponse, metadata_type=struct_pb2.Struct, ) # Done; return the response. return response
async def delete_domain_mapping( self, request: appengine.DeleteDomainMappingRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the specified domain mapping. A user must be authorized to administer the associated domain in order to delete a ``DomainMapping`` resource. Args: request (:class:`google.cloud.appengine_admin_v1.types.DeleteDomainMappingRequest`): The request object. Request message for `DomainMappings.DeleteDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}. """ # Create or coerce a protobuf request object. request = appengine.DeleteDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_domain_mapping, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("name", request.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty.Empty, metadata_type=ga_operation.OperationMetadataV1, ) # Done; return the response. return response
async def stage_build( self, request: build_service.StageBuildRequest = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Stages a given build artifact from a internal Google Cloud Storage bucket to a partner Google Cloud Storage bucket. If any of objects has already been copied, it will overwrite the previous objects. Operation <response: [StageBuildResponse][google.chromeos.moblab.v1beta1.StageBuildResponse], metadata: [StageBuildMetadata][google.chromeos.moblab.v1beta1.StageBuildMetadata]> Args: request (:class:`google.chromeos.moblab_v1beta1.types.StageBuildRequest`): The request object. Request message for staging a build artifact. name (:class:`str`): Required. The full resource name of the build artifact. For example, 'buildTargets/octopus/models/bobba/builds/12607.6.0/artifacts/chromeos- moblab-peng-staging'. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.chromeos.moblab_v1beta1.types.StageBuildResponse` Response message for staging a build artifact. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = build_service.StageBuildRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.stage_build, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("name", request.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, build_service.StageBuildResponse, metadata_type=build_service.StageBuildMetadata, ) # Done; return the response. return response
async def update_domain_mapping( self, request: appengine.UpdateDomainMappingRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified domain mapping. To map an SSL certificate to a domain mapping, update ``certificate_id`` to point to an ``AuthorizedCertificate`` resource. A user must be authorized to administer the associated domain in order to update a ``DomainMapping`` resource. Args: request (:class:`google.cloud.appengine_admin_v1.types.UpdateDomainMappingRequest`): The request object. Request message for `DomainMappings.UpdateDomainMapping`. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.appengine_admin_v1.types.DomainMapping` A domain serving an App Engine application. """ # Create or coerce a protobuf request object. request = appengine.UpdateDomainMappingRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_domain_mapping, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("name", request.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, domain_mapping.DomainMapping, metadata_type=ga_operation.OperationMetadataV1, ) # Done; return the response. return response
async def annotate_video( self, request: video_intelligence.AnnotateVideoRequest = None, *, input_uri: str = None, features: Sequence[video_intelligence.Feature] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Performs asynchronous video annotation. Progress and results can be retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains ``AnnotateVideoProgress`` (progress). ``Operation.response`` contains ``AnnotateVideoResponse`` (results). Args: request (:class:`google.cloud.videointelligence_v1p1beta1.types.AnnotateVideoRequest`): The request object. Video annotation request. input_uri (:class:`str`): Input video location. Currently, only `Google Cloud Storage <https://cloud.google.com/storage/>`__ URIs are supported, which must be specified in the following format: ``gs://bucket-id/object-id`` (other URI formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see `Request URIs <https://cloud.google.com/storage/docs/request-endpoints>`__. A video URI may include wildcards in ``object-id``, and thus identify multiple videos. Supported wildcards: '*' to match 0 or more characters; '?' to match 1 character. If unset, the input video should be embedded in the request as ``input_content``. If set, ``input_content`` should be unset. This corresponds to the ``input_uri`` field on the ``request`` instance; if ``request`` is provided, this should not be set. features (:class:`Sequence[google.cloud.videointelligence_v1p1beta1.types.Feature]`): Required. Requested video annotation features. This corresponds to the ``features`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.videointelligence_v1p1beta1.types.AnnotateVideoResponse` Video annotation response. Included in the response field of the Operation returned by the GetOperation call of the google::longrunning::Operations service. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([input_uri, features]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = video_intelligence.AnnotateVideoRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if input_uri is not None: request.input_uri = input_uri if features: request.features.extend(features) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.annotate_video, default_retry=retries.Retry( initial=1.0, maximum=120.0, multiplier=2.5, predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), deadline=600.0, ), default_timeout=600.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, video_intelligence.AnnotateVideoResponse, metadata_type=video_intelligence.AnnotateVideoProgress, ) # Done; return the response. return response
async def update_specialist_pool( self, request: specialist_pool_service.UpdateSpecialistPoolRequest = None, *, specialist_pool: gca_specialist_pool.SpecialistPool = None, update_mask: field_mask.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates a SpecialistPool. Args: request (:class:`google.cloud.aiplatform_v1beta1.types.UpdateSpecialistPoolRequest`): The request object. Request message for ``SpecialistPoolService.UpdateSpecialistPool``. specialist_pool (:class:`google.cloud.aiplatform_v1beta1.types.SpecialistPool`): Required. The SpecialistPool which replaces the resource on the server. This corresponds to the ``specialist_pool`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Required. The update mask applies to the resource. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.SpecialistPool` SpecialistPool represents customers' own workforce to work on their data labeling jobs. It includes a group of specialist managers who are responsible for managing the labelers in this pool as well as customers' data labeling jobs associated with this pool. Customers create specialist pool as well as start data labeling jobs on Cloud, managers and labelers work with the jobs using CrowdCompute console. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([specialist_pool, update_mask]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = specialist_pool_service.UpdateSpecialistPoolRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if specialist_pool is not None: request.specialist_pool = specialist_pool if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_specialist_pool, default_timeout=5.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("specialist_pool.name", request.specialist_pool.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, gca_specialist_pool.SpecialistPool, metadata_type=specialist_pool_service. UpdateSpecialistPoolOperationMetadata, ) # Done; return the response. return response
async def update_tag_key( self, request: tag_keys.UpdateTagKeyRequest = None, *, tag_key: tag_keys.TagKey = None, update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the attributes of the TagKey resource. Args: request (:class:`google.cloud.resourcemanager_v3.types.UpdateTagKeyRequest`): The request object. The request message for updating a TagKey. tag_key (:class:`google.cloud.resourcemanager_v3.types.TagKey`): Required. The new definition of the TagKey. Only the ``description`` and ``etag`` fields can be updated by this request. If the ``etag`` field is not empty, it must match the ``etag`` field of the existing tag key. Otherwise, ``FAILED_PRECONDITION`` will be returned. This corresponds to the ``tag_key`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Fields to be updated. The mask may only contain ``description`` or ``etag``. If omitted entirely, both ``description`` and ``etag`` are assumed to be significant. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagKey` A TagKey, used to group a set of TagValues. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([tag_key, update_mask]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = tag_keys.UpdateTagKeyRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if tag_key is not None: request.tag_key = tag_key if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_tag_key, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("tag_key.name", request.tag_key.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, tag_keys.TagKey, metadata_type=tag_keys.UpdateTagKeyMetadata, ) # Done; return the response. return response
async def train_flow( self, request: Union[flow.TrainFlowRequest, dict] = None, *, name: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Trains the specified flow. Note that only the flow in 'draft' environment is trained. This method is a `long-running operation <https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation>`__. The returned ``Operation`` type has the following method-specific fields: - ``metadata``: An empty `Struct message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__ - ``response``: An `Empty message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__ Note: You should always train a flow prior to sending it queries. See the `training documentation <https://cloud.google.com/dialogflow/cx/docs/concept/training>`__. .. code-block:: from google.cloud import dialogflowcx_v3 def sample_train_flow(): # Create a client client = dialogflowcx_v3.FlowsClient() # Initialize request argument(s) request = dialogflowcx_v3.TrainFlowRequest( name="name_value", ) # Make the request operation = client.train_flow(request=request) print("Waiting for operation to complete...") response = operation.result() # Handle the response print(response) Args: request (Union[google.cloud.dialogflowcx_v3.types.TrainFlowRequest, dict]): The request object. The request message for [Flows.TrainFlow][google.cloud.dialogflow.cx.v3.Flows.TrainFlow]. name (:class:`str`): Required. The flow to train. Format: ``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = flow.TrainFlowRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.train_flow, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty_pb2.Empty, metadata_type=struct_pb2.Struct, ) # Done; return the response. return response
async def delete_tag_key( self, request: tag_keys.DeleteTagKeyRequest = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a TagKey. The TagKey cannot be deleted if it has any child TagValues. Args: request (:class:`google.cloud.resourcemanager_v3.types.DeleteTagKeyRequest`): The request object. The request message for deleting a TagKey. name (:class:`str`): Required. The resource name of a TagKey to be deleted in the format ``tagKeys/123``. The TagKey cannot be a parent of any existing TagValues or it will not be deleted successfully. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagKey` A TagKey, used to group a set of TagValues. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = tag_keys.DeleteTagKeyRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_tag_key, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("name", request.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, tag_keys.TagKey, metadata_type=tag_keys.DeleteTagKeyMetadata, ) # Done; return the response. return response
async def create_game_server_deployment( self, request: game_server_deployments. CreateGameServerDeploymentRequest = None, *, parent: str = None, game_server_deployment: game_server_deployments. GameServerDeployment = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new game server deployment in a given project and location. Args: request (:class:`google.cloud.gaming_v1beta.types.CreateGameServerDeploymentRequest`): The request object. Request message for GameServerDeploymentsService.CreateGameServerDeployment. parent (:class:`str`): Required. The parent resource name. Uses the form: ``projects/{project}/locations/{location}``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. game_server_deployment (:class:`google.cloud.gaming_v1beta.types.GameServerDeployment`): Required. The game server delpoyment resource to be created. This corresponds to the ``game_server_deployment`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.gaming_v1beta.types.GameServerDeployment` A game server deployment resource. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, game_server_deployment]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = game_server_deployments.CreateGameServerDeploymentRequest( request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent if game_server_deployment is not None: request.game_server_deployment = game_server_deployment # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_game_server_deployment, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("parent", request.parent), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, game_server_deployments.GameServerDeployment, metadata_type=common.OperationMetadata, ) # Done; return the response. return response
async def import_entities( self, request: datastore_admin.ImportEntitiesRequest = None, *, project_id: str = None, labels: Sequence[ datastore_admin.ImportEntitiesRequest.LabelsEntry] = None, input_url: str = None, entity_filter: datastore_admin.EntityFilter = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Imports entities into Google Cloud Datastore. Existing entities with the same key are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportEntities operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Datastore. Args: request (:class:`~.datastore_admin.ImportEntitiesRequest`): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities]. project_id (:class:`str`): Required. Project ID against which to make the request. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. labels (:class:`Sequence[~.datastore_admin.ImportEntitiesRequest.LabelsEntry]`): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this should not be set. input_url (:class:`str`): Required. The full resource URL of the external storage location. Currently, only Google Cloud Storage is supported. So input_url should be of the form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE``, where ``BUCKET_NAME`` is the name of the Cloud Storage bucket, ``NAMESPACE_PATH`` is an optional Cloud Storage namespace path (this is not a Cloud Datastore namespace), and ``OVERALL_EXPORT_METADATA_FILE`` is the metadata file written by the ExportEntities operation. For more information about Cloud Storage namespace paths, see `Object name considerations <https://cloud.google.com/storage/docs/naming#object-considerations>`__. For more information, see [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. This corresponds to the ``input_url`` field on the ``request`` instance; if ``request`` is provided, this should not be set. entity_filter (:class:`~.datastore_admin.EntityFilter`): Optionally specify which kinds/namespaces are to be imported. If provided, the list must be a subset of the EntityFilter used in creating the export, otherwise a FAILED_PRECONDITION error will be returned. If no filter is specified then all entities from the export are imported. This corresponds to the ``entity_filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.empty.Empty``: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: :: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for ``Empty`` is empty JSON object ``{}``. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any( [project_id, labels, input_url, entity_filter]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = datastore_admin.ImportEntitiesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if input_url is not None: request.input_url = input_url if entity_filter is not None: request.entity_filter = entity_filter if labels: request.labels.update(labels) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.import_entities, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty.Empty, metadata_type=datastore_admin.ImportEntitiesMetadata, ) # Done; return the response. return response
async def update_game_server_deployment_rollout( self, request: game_server_deployments. UpdateGameServerDeploymentRolloutRequest = None, *, rollout: game_server_deployments.GameServerDeploymentRollout = None, update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Patches a single game server deployment rollout. The method will not return an error if the update does not affect any existing realms. For example - if the default_game_server_config is changed but all existing realms use the override, that is valid. Similarly, if a non existing realm is explicitly called out in game_server_config_overrides field, that will also not result in an error. Args: request (:class:`google.cloud.gaming_v1beta.types.UpdateGameServerDeploymentRolloutRequest`): The request object. Request message for GameServerDeploymentsService.UpdateGameServerRolloutDeployment. rollout (:class:`google.cloud.gaming_v1beta.types.GameServerDeploymentRollout`): Required. The game server delpoyment rollout to be updated. Only fields specified in update_mask are updated. This corresponds to the ``rollout`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Required. Mask of fields to update. At least one path must be supplied in this field. For the ``FieldMask`` definition, see https: //developers.google.com/protocol-buffers // /docs/reference/google.protobuf#fieldmask This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.gaming_v1beta.types.GameServerDeployment` A game server deployment resource. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([rollout, update_mask]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = game_server_deployments.UpdateGameServerDeploymentRolloutRequest( request) # If we have keyword arguments corresponding to fields on the # request, apply these. if rollout is not None: request.rollout = rollout if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_game_server_deployment_rollout, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("rollout.name", request.rollout.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, game_server_deployments.GameServerDeployment, metadata_type=common.OperationMetadata, ) # Done; return the response. return response
async def create_tag_binding( self, request: tag_bindings.CreateTagBindingRequest = None, *, tag_binding: tag_bindings.TagBinding = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or organization). Args: request (:class:`google.cloud.resourcemanager_v3.types.CreateTagBindingRequest`): The request object. The request message to create a TagBinding. tag_binding (:class:`google.cloud.resourcemanager_v3.types.TagBinding`): Required. The TagBinding to be created. This corresponds to the ``tag_binding`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagBinding` A TagBinding represents a connection between a TagValue and a cloud resource (currently project, folder, or organization). Once a TagBinding is created, the TagValue is applied to all the descendants of the cloud resource. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([tag_binding]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = tag_bindings.CreateTagBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if tag_binding is not None: request.tag_binding = tag_binding # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_tag_binding, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, tag_bindings.TagBinding, metadata_type=tag_bindings.CreateTagBindingMetadata, ) # Done; return the response. return response
async def create_cluster( self, request: clusters.CreateClusterRequest = None, *, project_id: str = None, region: str = None, cluster: clusters.Cluster = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be `ClusterOperationMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata>`__. Args: request (:class:`~.clusters.CreateClusterRequest`): The request object. A request to create a cluster. project_id (:class:`str`): Required. The ID of the Google Cloud Platform project that the cluster belongs to. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. region (:class:`str`): Required. The Dataproc region in which to handle the request. This corresponds to the ``region`` field on the ``request`` instance; if ``request`` is provided, this should not be set. cluster (:class:`~.clusters.Cluster`): Required. The cluster to create. This corresponds to the ``cluster`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.clusters.Cluster``: Describes the identifying information, config, and status of a cluster of Compute Engine instances. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. if request is not None and any([project_id, region, cluster]): raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = clusters.CreateClusterRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if region is not None: request.region = region if cluster is not None: request.cluster = cluster # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_cluster, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, client_info=_client_info, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, clusters.Cluster, metadata_type=operations.ClusterOperationMetadata, ) # Done; return the response. return response
async def instantiate_inline_workflow_template( self, request: workflow_templates. InstantiateInlineWorkflowTemplateRequest = None, *, parent: str = None, template: workflow_templates.WorkflowTemplate = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Instantiates a template and begins execution. This method is equivalent to executing the sequence [CreateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.CreateWorkflowTemplate], [InstantiateWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.InstantiateWorkflowTemplate], [DeleteWorkflowTemplate][google.cloud.dataproc.v1beta2.WorkflowTemplateService.DeleteWorkflowTemplate]. The returned Operation can be used to track execution of workflow by polling [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when entire workflow is finished. The running workflow can be aborted via [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted. The [Operation.metadata][google.longrunning.Operation.metadata] will be `WorkflowMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata>`__. Also see `Using WorkflowMetadata <https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata>`__. On successful completion, [Operation.response][google.longrunning.Operation.response] will be [Empty][google.protobuf.Empty]. Args: request (:class:`google.cloud.dataproc_v1beta2.types.InstantiateInlineWorkflowTemplateRequest`): The request object. A request to instantiate an inline workflow template. parent (:class:`str`): Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. - For ``projects.regions.workflowTemplates,instantiateinline``, the resource name of the region has the following format: ``projects/{project_id}/regions/{region}`` - For ``projects.locations.workflowTemplates.instantiateinline``, the resource name of the location has the following format: ``projects/{project_id}/locations/{location}`` This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. template (:class:`google.cloud.dataproc_v1beta2.types.WorkflowTemplate`): Required. The workflow template to instantiate. This corresponds to the ``template`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for Empty is empty JSON object {}. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, template]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = workflow_templates.InstantiateInlineWorkflowTemplateRequest( request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent if template is not None: request.template = template # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.instantiate_inline_workflow_template, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( core_exceptions.ServiceUnavailable, ), deadline=600.0, ), default_timeout=600.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("parent", request.parent), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty_pb2.Empty, metadata_type=workflow_templates.WorkflowMetadata, ) # Done; return the response. return response
async def update_cluster( self, request: clusters.UpdateClusterRequest = None, *, project_id: str = None, region: str = None, cluster_name: str = None, cluster: clusters.Cluster = None, update_mask: field_mask.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates a cluster in a project. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be `ClusterOperationMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata>`__. Args: request (:class:`~.clusters.UpdateClusterRequest`): The request object. A request to update a cluster. project_id (:class:`str`): Required. The ID of the Google Cloud Platform project the cluster belongs to. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. region (:class:`str`): Required. The Dataproc region in which to handle the request. This corresponds to the ``region`` field on the ``request`` instance; if ``request`` is provided, this should not be set. cluster_name (:class:`str`): Required. The cluster name. This corresponds to the ``cluster_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. cluster (:class:`~.clusters.Cluster`): Required. The changes to the cluster. This corresponds to the ``cluster`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`~.field_mask.FieldMask`): Required. Specifies the path, relative to ``Cluster``, of the field to update. For example, to change the number of workers in a cluster to 5, the ``update_mask`` parameter would be specified as ``config.worker_config.num_instances``, and the ``PATCH`` request body would specify the new value, as follows: :: { "config":{ "workerConfig":{ "numInstances":"5" } } } Similarly, to change the number of preemptible workers in a cluster to 5, the ``update_mask`` parameter would be ``config.secondary_worker_config.num_instances``, and the ``PATCH`` request body would be set as follows: :: { "config":{ "secondaryWorkerConfig":{ "numInstances":"5" } } } Note: currently only the following fields can be updated: .. raw:: html <table> <tr> <td><strong>Mask</strong></td><td><strong>Purpose</strong></td> </tr> <tr> <td>labels</td><td>Updates labels</td> </tr> <tr> <td>config.worker_config.num_instances</td><td>Resize primary worker group</td> </tr> <tr> <td>config.secondary_worker_config.num_instances</td><td>Resize secondary worker group</td> </tr> <tr> <td>config.lifecycle_config.auto_delete_ttl</td><td>Reset MAX TTL duration</td> </tr> <tr> <td>config.lifecycle_config.auto_delete_time</td><td>Update MAX TTL deletion timestamp</td> </tr> <tr> <td>config.lifecycle_config.idle_delete_ttl</td><td>Update Idle TTL duration</td> </tr> <tr> <td>config.autoscaling_config.policy_uri</td><td>Use, stop using, or change autoscaling policies</td> </tr> </table> This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.clusters.Cluster``: Describes the identifying information, config, and status of a cluster of Compute Engine instances. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. if request is not None and any( [project_id, region, cluster_name, cluster, update_mask] ): raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = clusters.UpdateClusterRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if region is not None: request.region = region if cluster_name is not None: request.cluster_name = cluster_name if cluster is not None: request.cluster = cluster if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_cluster, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, client_info=_client_info, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, clusters.Cluster, metadata_type=operations.ClusterOperationMetadata, ) # Done; return the response. return response
async def async_batch_annotate_files( self, request: Union[image_annotator.AsyncBatchAnnotateFilesRequest, dict] = None, *, requests: Sequence[image_annotator.AsyncAnnotateFileRequest] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Args: request (Union[google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest, dict]): The request object. Multiple async file annotation requests are batched into a single service call. requests (:class:`Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]`): Required. Individual async file annotation requests for this batch. This corresponds to the ``requests`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse` Response to an async batch file annotation request. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([requests]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = image_annotator.AsyncBatchAnnotateFilesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if requests: request.requests.extend(requests) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.async_batch_annotate_files, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type( core_exceptions.DeadlineExceeded, core_exceptions.ServiceUnavailable, ), deadline=600.0, ), default_timeout=600.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, image_annotator.AsyncBatchAnnotateFilesResponse, metadata_type=image_annotator.OperationMetadata, ) # Done; return the response. return response
async def diagnose_cluster( self, request: clusters.DiagnoseClusterRequest = None, *, project_id: str = None, region: str = None, cluster_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Gets cluster diagnostic information. The returned [Operation.metadata][google.longrunning.Operation.metadata] will be `ClusterOperationMetadata <https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1beta2#clusteroperationmetadata>`__. After the operation completes, [Operation.response][google.longrunning.Operation.response] contains [Empty][google.protobuf.Empty]. Args: request (:class:`~.clusters.DiagnoseClusterRequest`): The request object. A request to collect cluster diagnostic information. project_id (:class:`str`): Required. The ID of the Google Cloud Platform project that the cluster belongs to. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. region (:class:`str`): Required. The Dataproc region in which to handle the request. This corresponds to the ``region`` field on the ``request`` instance; if ``request`` is provided, this should not be set. cluster_name (:class:`str`): Required. The cluster name. This corresponds to the ``cluster_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: ~.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:``~.empty.Empty``: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: :: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for ``Empty`` is empty JSON object ``{}``. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. if request is not None and any([project_id, region, cluster_name]): raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = clusters.DiagnoseClusterRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if region is not None: request.region = region if cluster_name is not None: request.cluster_name = cluster_name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.diagnose_cluster, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), ), default_timeout=300.0, client_info=_client_info, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, empty.Empty, metadata_type=operations.ClusterOperationMetadata, ) # Done; return the response. return response
async def submit_job_as_operation( self, request: jobs.SubmitJobRequest = None, *, project_id: str = None, region: str = None, job: jobs.Job = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Submits job to a cluster. Args: request (:class:`google.cloud.dataproc_v1.types.SubmitJobRequest`): The request object. A request to submit a job. project_id (:class:`str`): Required. The ID of the Google Cloud Platform project that the job belongs to. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. region (:class:`str`): Required. The Dataproc region in which to handle the request. This corresponds to the ``region`` field on the ``request`` instance; if ``request`` is provided, this should not be set. job (:class:`google.cloud.dataproc_v1.types.Job`): Required. The job resource. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dataproc_v1.types.Job` A Dataproc job resource. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, region, job]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = jobs.SubmitJobRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if project_id is not None: request.project_id = project_id if region is not None: request.region = region if job is not None: request.job = job # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.submit_job_as_operation, default_retry=retries.Retry( initial=0.1, maximum=60.0, multiplier=1.3, predicate=retries.if_exception_type(exceptions.ServiceUnavailable,), deadline=900.0, ), default_timeout=900.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, jobs.Job, metadata_type=jobs.JobMetadata, ) # Done; return the response. return response
async def create_tag_key( self, request: tag_keys.CreateTagKeyRequest = None, *, tag_key: tag_keys.TagKey = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 300 TagKeys can exist under a parent at any given time. Args: request (:class:`google.cloud.resourcemanager_v3.types.CreateTagKeyRequest`): The request object. The request message for creating a TagKey. tag_key (:class:`google.cloud.resourcemanager_v3.types.TagKey`): Required. The TagKey to be created. Only fields ``short_name``, ``description``, and ``parent`` are considered during the creation request. This corresponds to the ``tag_key`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagKey` A TagKey, used to group a set of TagValues. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([tag_key]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = tag_keys.CreateTagKeyRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if tag_key is not None: request.tag_key = tag_key # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_tag_key, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, tag_keys.TagKey, metadata_type=tag_keys.CreateTagKeyMetadata, ) # Done; return the response. return response
async def batch_update_intents( self, request: intent.BatchUpdateIntentsRequest = None, *, parent: str = None, intent_batch_uri: str = None, intent_batch_inline: intent.IntentBatch = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates/Creates multiple intents in the specified agent. Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]> Args: request (:class:`google.cloud.dialogflow_v2beta1.types.BatchUpdateIntentsRequest`): The request object. The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. parent (:class:`str`): Required. The name of the agent to update or create intents in. Supported formats: - ``projects/<Project ID>/agent`` - ``projects/<Project ID>/locations/<Location ID>/agent`` This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. intent_batch_uri (:class:`str`): The URI to a Google Cloud Storage file containing intents to update or create. The file format can either be a serialized proto (of IntentBatch type) or JSON object. Note: The URI must start with "gs://". This corresponds to the ``intent_batch_uri`` field on the ``request`` instance; if ``request`` is provided, this should not be set. intent_batch_inline (:class:`google.cloud.dialogflow_v2beta1.types.IntentBatch`): The collection of intents to update or create. This corresponds to the ``intent_batch_inline`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dialogflow_v2beta1.types.BatchUpdateIntentsResponse` The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, intent_batch_uri, intent_batch_inline]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = intent.BatchUpdateIntentsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent if intent_batch_uri is not None: request.intent_batch_uri = intent_batch_uri if intent_batch_inline is not None: request.intent_batch_inline = intent_batch_inline # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.batch_update_intents, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, intent.BatchUpdateIntentsResponse, metadata_type=struct_pb2.Struct, ) # Done; return the response. return response
async def update_document( self, request: gcd_document.UpdateDocumentRequest = None, *, document: gcd_document.Document = None, update_mask: field_mask.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates the specified document. Note: The ``projects.agent.knowledgeBases.documents`` resource is deprecated; only use ``projects.knowledgeBases.documents``. Args: request (:class:`google.cloud.dialogflow_v2beta1.types.UpdateDocumentRequest`): The request object. Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. document (:class:`google.cloud.dialogflow_v2beta1.types.Document`): Required. The document to update. This corresponds to the ``document`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Optional. Not specified means ``update all``. Currently, only ``display_name`` can be updated, an InvalidArgument will be returned for attempting to update other fields. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be :class:`google.cloud.dialogflow_v2beta1.types.Document` A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. For more information, see the [knowledge base guide](\ https://cloud.google.com/dialogflow/docs/how/knowledge-bases). Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([document, update_mask]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = gcd_document.UpdateDocumentRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if document is not None: request.document = document if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_document, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("document.name", request.document.name), )), ) # Send the request. response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Wrap the response in an operation future. response = operation_async.from_gapic( response, self._client._transport.operations_client, gcd_document.Document, metadata_type=gcd_document.KnowledgeOperationMetadata, ) # Done; return the response. return response