def get_environment( self, request: environment.GetEnvironmentRequest = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> environment.Environment: r"""Retrieves the specified agent environment. Args: request (google.cloud.dialogflow_v2.types.GetEnvironmentRequest): The request object. The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment]. 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.cloud.dialogflow_v2.types.Environment: You can create multiple versions of your agent and publish them to separate environments. When you edit an agent, you are editing the draft agent. At any point, you can save the draft agent as an agent version, which is an immutable snapshot of your agent. When you save the draft agent, it is published to the default environment. When you create agent versions, you can publish them to custom environments. You can create a variety of custom environments for: - testing - development - production - etc. For more information, see the [versions and environments guide](\ https://cloud.google.com/dialogflow/docs/agents-versions). """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes # in a environment.GetEnvironmentRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance(request, environment.GetEnvironmentRequest): request = environment.GetEnvironmentRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[self._transport.get_environment] # 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 = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Done; return the response. return response
async def get_environment( self, request: Union[environment.GetEnvironmentRequest, dict] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> environment.Environment: r"""Retrieves the specified agent environment. .. code-block:: python from google.cloud import dialogflow_v2 async def sample_get_environment(): # Create a client client = dialogflow_v2.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflow_v2.GetEnvironmentRequest( name="name_value", ) # Make the request response = await client.get_environment(request=request) # Handle the response print(response) Args: request (Union[google.cloud.dialogflow_v2.types.GetEnvironmentRequest, dict]): The request object. The request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment]. 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.cloud.dialogflow_v2.types.Environment: You can create multiple versions of your agent and publish them to separate environments. When you edit an agent, you are editing the draft agent. At any point, you can save the draft agent as an agent version, which is an immutable snapshot of your agent. When you save the draft agent, it is published to the default environment. When you create agent versions, you can publish them to custom environments. You can create a variety of custom environments for: - testing - development - production - etc. For more information, see the [versions and environments guide](\ https://cloud.google.com/dialogflow/docs/agents-versions). """ # Create or coerce a protobuf request object. request = environment.GetEnvironmentRequest(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.get_environment, 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, ) # Done; return the response. return response