Class AppHubAsyncClient (0.1.5)

AppHubAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.apphub_v1.services.app_hub.transports.base.AppHubTransport, typing.Callable[[...], google.cloud.apphub_v1.services.app_hub.transports.base.AppHubTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

The App Hub API allows you to manage App Hub resources.

Properties

api_endpoint

Return the API endpoint used by the client instance.

Returns
Type Description
str The API endpoint used by the client instance.

transport

Returns the transport used by the client instance.

Returns
Type Description
AppHubTransport The transport used by the client instance.

universe_domain

Return the universe domain used by the client instance.

Returns
Type Description
str The universe domain used by the client instance.

Methods

AppHubAsyncClient

AppHubAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.apphub_v1.services.app_hub.transports.base.AppHubTransport, typing.Callable[[...], google.cloud.apphub_v1.services.app_hub.transports.base.AppHubTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

Instantiates the app hub async client.

Parameters
Name Description
credentials Optional[google.auth.credentials.Credentials]

The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

transport Optional[Union[str,AppHubTransport,Callable[..., AppHubTransport]]]

The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the AppHubTransport constructor. If set to None, a transport is chosen automatically.

client_options Optional[Union[google.api_core.client_options.ClientOptions, dict]]

Custom options for the client. 1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: "always" (always use the default mTLS endpoint), "never" (always use the default regular endpoint) and "auto" (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value). 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "true", then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not set, no client certificate will be used. 3. The universe_domain property can be used to override the default "googleapis.com" universe. Note that api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

client_info google.api_core.gapic_v1.client_info.ClientInfo

The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

Exceptions
Type Description
google.auth.exceptions.MutualTlsChannelError If mutual TLS transport creation failed for any reason.

application_path

application_path(project: str, location: str, application: str) -> str

Returns a fully-qualified application string.

cancel_operation

cancel_operation(
    request: typing.Optional[
        google.longrunning.operations_pb2.CancelOperationRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None

Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request .operations_pb2.CancelOperationRequest

The request object. Request message for CancelOperation method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

common_billing_account_path

common_billing_account_path(billing_account: str) -> str

Returns a fully-qualified billing_account string.

common_folder_path

common_folder_path(folder: str) -> str

Returns a fully-qualified folder string.

common_location_path

common_location_path(project: str, location: str) -> str

Returns a fully-qualified location string.

common_organization_path

common_organization_path(organization: str) -> str

Returns a fully-qualified organization string.

common_project_path

common_project_path(project: str) -> str

Returns a fully-qualified project string.

create_application

create_application(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.CreateApplicationRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    application: typing.Optional[
        google.cloud.apphub_v1.types.application.Application
    ] = None,
    application_id: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Creates an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_create_application():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    application = apphub_v1.Application()
    application.scope.type_ = "REGIONAL"

    request = apphub_v1.CreateApplicationRequest(
        parent="parent_value",
        application_id="application_id_value",
        application=application,
    )

    # Make the request
    operation = client.create_application(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.CreateApplicationRequest, dict]]

The request object. Request for CreateApplication.

parent str

Required. Project and location to create Application in. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

application Application

Required. The resource being created This corresponds to the application field on the request instance; if request is provided, this should not be set.

application_id str

Required. The Application identifier. Must contain only lowercase letters, numbers or hyphens, with the first character a letter, the last a letter or a number, and a 63 character maximum. This corresponds to the application_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Application Application defines the governance boundary for App Hub Entities that perform a logical end-to-end business function. App Hub supports application level IAM permission to align with governance requirements.

create_service

create_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.CreateServiceRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    service: typing.Optional[google.cloud.apphub_v1.types.service.Service] = None,
    service_id: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Creates a Service in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_create_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    service = apphub_v1.Service()
    service.discovered_service = "discovered_service_value"

    request = apphub_v1.CreateServiceRequest(
        parent="parent_value",
        service_id="service_id_value",
        service=service,
    )

    # Make the request
    operation = client.create_service(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.CreateServiceRequest, dict]]

The request object. Request for CreateService.

parent str

Required. Fully qualified name of the parent Application to create the Service in. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

service Service

Required. The resource being created. This corresponds to the service field on the request instance; if request is provided, this should not be set.

service_id str

Required. The Service identifier. Must contain only lowercase letters, numbers or hyphens, with the first character a letter, the last a letter or a number, and a 63 character maximum. This corresponds to the service_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Service Service is an App Hub data model that contains a discovered service, which represents a network/api interface that exposes some functionality to clients for consumption over the network.

create_service_project_attachment

create_service_project_attachment(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.CreateServiceProjectAttachmentRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    service_project_attachment: typing.Optional[
        google.cloud.apphub_v1.types.service_project_attachment.ServiceProjectAttachment
    ] = None,
    service_project_attachment_id: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Attaches a service project to the host project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_create_service_project_attachment():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    service_project_attachment = apphub_v1.ServiceProjectAttachment()
    service_project_attachment.service_project = "service_project_value"

    request = apphub_v1.CreateServiceProjectAttachmentRequest(
        parent="parent_value",
        service_project_attachment_id="service_project_attachment_id_value",
        service_project_attachment=service_project_attachment,
    )

    # Make the request
    operation = client.create_service_project_attachment(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.CreateServiceProjectAttachmentRequest, dict]]

The request object. Request for CreateServiceProjectAttachment.

parent str

Required. Host project ID and location to which service project is being attached. Only global location is supported. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

service_project_attachment ServiceProjectAttachment

Required. The resource being created. This corresponds to the service_project_attachment field on the request instance; if request is provided, this should not be set.

service_project_attachment_id str

Required. The service project attachment identifier must contain the project id of the service project specified in the service_project_attachment.service_project field. This corresponds to the service_project_attachment_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be ServiceProjectAttachment ServiceProjectAttachment represents an attachment from a service project to a host project. Service projects contain the underlying cloud infrastructure resources, and expose these resources to the host project through a ServiceProjectAttachment. With the attachments, the host project can provide an aggregated view of resources across all service projects.

create_workload

create_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.CreateWorkloadRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    workload: typing.Optional[google.cloud.apphub_v1.types.workload.Workload] = None,
    workload_id: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Creates a Workload in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_create_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    workload = apphub_v1.Workload()
    workload.discovered_workload = "discovered_workload_value"

    request = apphub_v1.CreateWorkloadRequest(
        parent="parent_value",
        workload_id="workload_id_value",
        workload=workload,
    )

    # Make the request
    operation = client.create_workload(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.CreateWorkloadRequest, dict]]

The request object. Request for CreateWorkload.

parent str

Required. Fully qualified name of the Application to create Workload in. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

workload Workload

Required. The resource being created. This corresponds to the workload field on the request instance; if request is provided, this should not be set.

workload_id str

Required. The Workload identifier. Must contain only lowercase letters, numbers or hyphens, with the first character a letter, the last a letter or a number, and a 63 character maximum. This corresponds to the workload_id field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Workload Workload is an App Hub data model that contains a discovered workload, which represents a binary deployment (such as managed instance groups (MIGs) and GKE deployments) that performs the smallest logical subset of business functionality.

delete_application

delete_application(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.DeleteApplicationRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Deletes an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_delete_application():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.DeleteApplicationRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_application(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.DeleteApplicationRequest, dict]]

The request object. Request for DeleteApplication.

name str

Required. Fully qualified name of the Application to delete. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be 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); }

delete_operation

delete_operation(
    request: typing.Optional[
        google.longrunning.operations_pb2.DeleteOperationRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> None

Deletes a long-running operation.

This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Parameters
Name Description
request .operations_pb2.DeleteOperationRequest

The request object. Request message for DeleteOperation method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

delete_service

delete_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.DeleteServiceRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Deletes a Service from an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_delete_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.DeleteServiceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_service(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.DeleteServiceRequest, dict]]

The request object. Request for DeleteService.

name str

Required. Fully qualified name of the Service to delete from an Application. Expected format: projects/{project}/locations/{location}/applications/{application}/services/{service}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be 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); }

delete_service_project_attachment

delete_service_project_attachment(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.DeleteServiceProjectAttachmentRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Deletes a service project attachment.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_delete_service_project_attachment():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.DeleteServiceProjectAttachmentRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_service_project_attachment(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.DeleteServiceProjectAttachmentRequest, dict]]

The request object. Request for DeleteServiceProjectAttachment.

name str

Required. Fully qualified name of the service project attachment to delete. Expected format: projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be 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); }

delete_workload

delete_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.DeleteWorkloadRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Deletes a Workload from an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_delete_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.DeleteWorkloadRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_workload(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.DeleteWorkloadRequest, dict]]

The request object. Request for DeleteWorkload.

name str

Required. Fully qualified name of the Workload to delete from an Application. Expected format: projects/{project}/locations/{location}/applications/{application}/workloads/{workload}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be 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); }

detach_service_project_attachment

detach_service_project_attachment(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.DetachServiceProjectAttachmentRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.apphub_service.DetachServiceProjectAttachmentResponse

Detaches a service project from a host project. You can call this API from any service project without needing access to the host project that it is attached to.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_detach_service_project_attachment():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.DetachServiceProjectAttachmentRequest(
        name="name_value",
    )

    # Make the request
    response = await client.detach_service_project_attachment(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.DetachServiceProjectAttachmentRequest, dict]]

The request object. Request for DetachServiceProjectAttachment.

name str

Required. Service project id and location to detach from a host project. Only global location is supported. Expected format: projects/{project}/locations/{location}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.DetachServiceProjectAttachmentResponse Response for DetachServiceProjectAttachment.

discovered_service_path

discovered_service_path(
    project: str, location: str, discovered_service: str
) -> str

Returns a fully-qualified discovered_service string.

discovered_workload_path

discovered_workload_path(
    project: str, location: str, discovered_workload: str
) -> str

Returns a fully-qualified discovered_workload string.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
Name Description
filename str

The path to the service account private key json file.

Returns
Type Description
AppHubAsyncClient The constructed client.

from_service_account_info

from_service_account_info(info: dict, *args, **kwargs)

Creates an instance of this client using the provided credentials info.

Parameter
Name Description
info dict

The service account private key info.

Returns
Type Description
AppHubAsyncClient The constructed client.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
Name Description
filename str

The path to the service account private key json file.

Returns
Type Description
AppHubAsyncClient The constructed client.

get_application

get_application(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetApplicationRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.application.Application

Gets an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_application():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetApplicationRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_application(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetApplicationRequest, dict]]

The request object. Request for GetApplication.

name str

Required. Fully qualified name of the Application to fetch. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.Application Application defines the governance boundary for App Hub Entities that perform a logical end-to-end business function. App Hub supports application level IAM permission to align with governance requirements.

get_discovered_service

get_discovered_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetDiscoveredServiceRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.service.DiscoveredService

Gets a Discovered Service in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_discovered_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetDiscoveredServiceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_discovered_service(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetDiscoveredServiceRequest, dict]]

The request object. Request for GetDiscoveredService.

name str

Required. Fully qualified name of the Discovered Service to fetch. Expected format: projects/{project}/locations/{location}/discoveredServices/{discoveredService}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.DiscoveredService DiscoveredService is a network/api interface that exposes some functionality to clients for consumption over the network. A discovered service can be registered to a App Hub service.

get_discovered_workload

get_discovered_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetDiscoveredWorkloadRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.workload.DiscoveredWorkload

Gets a Discovered Workload in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_discovered_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetDiscoveredWorkloadRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_discovered_workload(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetDiscoveredWorkloadRequest, dict]]

The request object. Request for GetDiscoveredWorkload.

name str

Required. Fully qualified name of the Discovered Workload to fetch. Expected format: projects/{project}/locations/{location}/discoveredWorkloads/{discoveredWorkload}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.DiscoveredWorkload DiscoveredWorkload is a binary deployment (such as managed instance groups (MIGs) and GKE deployments) that performs the smallest logical subset of business functionality. A discovered workload can be registered to an App Hub Workload.

get_iam_policy

get_iam_policy(
    request: typing.Optional[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.iam.v1.policy_pb2.Policy

Gets the IAM access control policy for a function.

Returns an empty policy if the function exists and does not have a policy set.

Parameters
Name Description
request .iam_policy_pb2.GetIamPolicyRequest

The request object. Request message for GetIamPolicy method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.policy_pb2.Policy Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings. A binding binds one or more members to a single role. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __.

get_location

get_location(
    request: typing.Optional[
        google.cloud.location.locations_pb2.GetLocationRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.location.locations_pb2.Location

Gets information about a location.

Parameters
Name Description
request .location_pb2.GetLocationRequest

The request object. Request message for GetLocation method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.location_pb2.Location Location object.

get_mtls_endpoint_and_cert_source

get_mtls_endpoint_and_cert_source(
    client_options: typing.Optional[
        google.api_core.client_options.ClientOptions
    ] = None,
)

Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not "true", the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "always", use the default mTLS endpoint; if the environment variable is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameter
Name Description
client_options google.api_core.client_options.ClientOptions

Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Exceptions
Type Description
google.auth.exceptions.MutualTLSChannelError If any errors happen.
Returns
Type Description
Tuple[str, Callable[[], Tuple[bytes, bytes]]] returns the API endpoint and the client cert source to use.

get_operation

get_operation(
    request: typing.Optional[
        google.longrunning.operations_pb2.GetOperationRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.longrunning.operations_pb2.Operation

Gets the latest state of a long-running operation.

Parameters
Name Description
request .operations_pb2.GetOperationRequest

The request object. Request message for GetOperation method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.operations_pb2.Operation An Operation object.

get_service

get_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetServiceRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.service.Service

Gets a Service in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetServiceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_service(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetServiceRequest, dict]]

The request object. Request for GetService.

name str

Required. Fully qualified name of the Service to fetch. Expected format: projects/{project}/locations/{location}/applications/{application}/services/{service}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.Service Service is an App Hub data model that contains a discovered service, which represents a network/api interface that exposes some functionality to clients for consumption over the network.

get_service_project_attachment

get_service_project_attachment(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetServiceProjectAttachmentRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.service_project_attachment.ServiceProjectAttachment

Gets a service project attachment.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_service_project_attachment():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetServiceProjectAttachmentRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_service_project_attachment(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetServiceProjectAttachmentRequest, dict]]

The request object. Request for GetServiceProjectAttachment.

name str

Required. Fully qualified name of the service project attachment to retrieve. Expected format: projects/{project}/locations/{location}/serviceProjectAttachments/{serviceProjectAttachment}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.ServiceProjectAttachment ServiceProjectAttachment represents an attachment from a service project to a host project. Service projects contain the underlying cloud infrastructure resources, and expose these resources to the host project through a ServiceProjectAttachment. With the attachments, the host project can provide an aggregated view of resources across all service projects.

get_transport_class

get_transport_class(
    label: typing.Optional[str] = None,
) -> typing.Type[
    google.cloud.apphub_v1.services.app_hub.transports.base.AppHubTransport
]

Returns an appropriate transport class.

Parameter
Name Description
label typing.Optional[str]

The name of the desired transport. If none is provided, then the first transport in the registry is used.

get_workload

get_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.GetWorkloadRequest, dict
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.workload.Workload

Gets a Workload in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_get_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.GetWorkloadRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_workload(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.GetWorkloadRequest, dict]]

The request object. Request for GetWorkload.

name str

Required. Fully qualified name of the Workload to fetch. Expected format: projects/{project}/locations/{location}/applications/{application}/workloads/{workload}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.Workload Workload is an App Hub data model that contains a discovered workload, which represents a binary deployment (such as managed instance groups (MIGs) and GKE deployments) that performs the smallest logical subset of business functionality.

list_applications

list_applications(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListApplicationsRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.services.app_hub.pagers.ListApplicationsAsyncPager

Lists Applications in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_applications():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListApplicationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_applications(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListApplicationsRequest, dict]]

The request object. Request for ListApplications.

parent str

Required. Project and location to list Applications on. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListApplicationsAsyncPager Response for ListApplications. Iterating over this object will yield results and resolve additional pages automatically.

list_discovered_services

list_discovered_services(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListDiscoveredServicesRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.services.app_hub.pagers.ListDiscoveredServicesAsyncPager

Lists Discovered Services that can be added to an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_discovered_services():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListDiscoveredServicesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_discovered_services(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListDiscoveredServicesRequest, dict]]

The request object. Request for ListDiscoveredServices.

parent str

Required. Project and location to list Discovered Services on. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListDiscoveredServicesAsyncPager Response for ListDiscoveredServices. Iterating over this object will yield results and resolve additional pages automatically.

list_discovered_workloads

list_discovered_workloads(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListDiscoveredWorkloadsRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.services.app_hub.pagers.ListDiscoveredWorkloadsAsyncPager

Lists Discovered Workloads that can be added to an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_discovered_workloads():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListDiscoveredWorkloadsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_discovered_workloads(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListDiscoveredWorkloadsRequest, dict]]

The request object. Request for ListDiscoveredWorkloads.

parent str

Required. Project and location to list Discovered Workloads on. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListDiscoveredWorkloadsAsyncPager Response for ListDiscoveredWorkloads. Iterating over this object will yield results and resolve additional pages automatically.

list_locations

list_locations(
    request: typing.Optional[
        google.cloud.location.locations_pb2.ListLocationsRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.location.locations_pb2.ListLocationsResponse

Lists information about the supported locations for this service.

Parameters
Name Description
request .location_pb2.ListLocationsRequest

The request object. Request message for ListLocations method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.location_pb2.ListLocationsResponse Response message for ListLocations method.

list_operations

list_operations(
    request: typing.Optional[
        google.longrunning.operations_pb2.ListOperationsRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.longrunning.operations_pb2.ListOperationsResponse

Lists operations that match the specified filter in the request.

Parameters
Name Description
request .operations_pb2.ListOperationsRequest

The request object. Request message for ListOperations method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.operations_pb2.ListOperationsResponse Response message for ListOperations method.

list_service_project_attachments

list_service_project_attachments(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListServiceProjectAttachmentsRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
    google.cloud.apphub_v1.services.app_hub.pagers.ListServiceProjectAttachmentsAsyncPager
)

Lists service projects attached to the host project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_service_project_attachments():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListServiceProjectAttachmentsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_service_project_attachments(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListServiceProjectAttachmentsRequest, dict]]

The request object. Request for ListServiceProjectAttachments.

parent str

Required. Host project ID and location to list service project attachments. Only global location is supported. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListServiceProjectAttachmentsAsyncPager Response for ListServiceProjectAttachments. Iterating over this object will yield results and resolve additional pages automatically.

list_services

list_services(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListServicesRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.services.app_hub.pagers.ListServicesAsyncPager

Lists Services in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_services():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListServicesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_services(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListServicesRequest, dict]]

The request object. Request for ListServices.

parent str

Required. Fully qualified name of the parent Application to list Services for. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListServicesAsyncPager Response for ListServices. Iterating over this object will yield results and resolve additional pages automatically.

list_workloads

list_workloads(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.ListWorkloadsRequest, dict
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.services.app_hub.pagers.ListWorkloadsAsyncPager

Lists Workloads in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_list_workloads():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.ListWorkloadsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_workloads(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.ListWorkloadsRequest, dict]]

The request object. Request for ListWorkloads.

parent str

Required. Fully qualified name of the parent Application to list Workloads for. Expected format: projects/{project}/locations/{location}/applications/{application}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.services.app_hub.pagers.ListWorkloadsAsyncPager Response for ListWorkloads. Iterating over this object will yield results and resolve additional pages automatically.

lookup_discovered_service

lookup_discovered_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.LookupDiscoveredServiceRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    uri: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.apphub_service.LookupDiscoveredServiceResponse

Lists a Discovered Service in a host project and location, with a given resource URI.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_lookup_discovered_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.LookupDiscoveredServiceRequest(
        parent="parent_value",
        uri="uri_value",
    )

    # Make the request
    response = await client.lookup_discovered_service(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.LookupDiscoveredServiceRequest, dict]]

The request object. Request for LookupDiscoveredService.

parent str

Required. Host project ID and location to lookup Discovered Service in. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

uri str

Required. Resource URI to find DiscoveredService for. Accepts both project number and project ID and does translation when needed. This corresponds to the uri field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.LookupDiscoveredServiceResponse Response for LookupDiscoveredService.

lookup_discovered_workload

lookup_discovered_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.LookupDiscoveredWorkloadRequest,
            dict,
        ]
    ] = None,
    *,
    parent: typing.Optional[str] = None,
    uri: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.apphub_service.LookupDiscoveredWorkloadResponse

Lists a Discovered Workload in a host project and location, with a given resource URI.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_lookup_discovered_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.LookupDiscoveredWorkloadRequest(
        parent="parent_value",
        uri="uri_value",
    )

    # Make the request
    response = await client.lookup_discovered_workload(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.LookupDiscoveredWorkloadRequest, dict]]

The request object. Request for LookupDiscoveredWorkload.

parent str

Required. Host project ID and location to lookup Discovered Workload in. Expected format: projects/{project}/locations/{location}. This corresponds to the parent field on the request instance; if request is provided, this should not be set.

uri str

Required. Resource URI to find Discovered Workload for. Accepts both project number and project ID and does translation when needed. This corresponds to the uri field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.LookupDiscoveredWorkloadResponse Response for LookupDiscoveredWorkload.

lookup_service_project_attachment

lookup_service_project_attachment(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.LookupServiceProjectAttachmentRequest,
            dict,
        ]
    ] = None,
    *,
    name: typing.Optional[str] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.apphub_v1.types.apphub_service.LookupServiceProjectAttachmentResponse

Lists a service project attachment for a given service project. You can call this API from any project to find if it is attached to a host project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_lookup_service_project_attachment():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    request = apphub_v1.LookupServiceProjectAttachmentRequest(
        name="name_value",
    )

    # Make the request
    response = await client.lookup_service_project_attachment(request=request)

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.LookupServiceProjectAttachmentRequest, dict]]

The request object. Request for LookupServiceProjectAttachment.

name str

Required. Service project ID and location to lookup service project attachment for. Only global location is supported. Expected format: projects/{project}/locations/{location}. This corresponds to the name field on the request instance; if request is provided, this should not be set.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.cloud.apphub_v1.types.LookupServiceProjectAttachmentResponse Response for LookupServiceProjectAttachment.

parse_application_path

parse_application_path(path: str) -> typing.Dict[str, str]

Parses a application path into its component segments.

parse_common_billing_account_path

parse_common_billing_account_path(path: str) -> typing.Dict[str, str]

Parse a billing_account path into its component segments.

parse_common_folder_path

parse_common_folder_path(path: str) -> typing.Dict[str, str]

Parse a folder path into its component segments.

parse_common_location_path

parse_common_location_path(path: str) -> typing.Dict[str, str]

Parse a location path into its component segments.

parse_common_organization_path

parse_common_organization_path(path: str) -> typing.Dict[str, str]

Parse a organization path into its component segments.

parse_common_project_path

parse_common_project_path(path: str) -> typing.Dict[str, str]

Parse a project path into its component segments.

parse_discovered_service_path

parse_discovered_service_path(path: str) -> typing.Dict[str, str]

Parses a discovered_service path into its component segments.

parse_discovered_workload_path

parse_discovered_workload_path(path: str) -> typing.Dict[str, str]

Parses a discovered_workload path into its component segments.

parse_service_path

parse_service_path(path: str) -> typing.Dict[str, str]

Parses a service path into its component segments.

parse_service_project_attachment_path

parse_service_project_attachment_path(path: str) -> typing.Dict[str, str]

Parses a service_project_attachment path into its component segments.

parse_workload_path

parse_workload_path(path: str) -> typing.Dict[str, str]

Parses a workload path into its component segments.

service_path

service_path(project: str, location: str, application: str, service: str) -> str

Returns a fully-qualified service string.

service_project_attachment_path

service_project_attachment_path(
    project: str, location: str, service_project_attachment: str
) -> str

Returns a fully-qualified service_project_attachment string.

set_iam_policy

set_iam_policy(
    request: typing.Optional[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.iam.v1.policy_pb2.Policy

Sets the IAM access control policy on the specified function.

Replaces any existing policy.

Parameters
Name Description
request .iam_policy_pb2.SetIamPolicyRequest

The request object. Request message for SetIamPolicy method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.policy_pb2.Policy Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A Policy is a collection of bindings. A binding binds one or more members to a single role. Members can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions (defined by IAM or configured by users). A binding can optionally specify a condition, which is a logic expression that further constrains the role binding based on attributes about the request and/or target resource. **JSON Example** :: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": ["user:eve@example.com"], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01t00:00:00.000z')",="" }="" }="" ]="" }="" **yaml="" example**="" ::="" bindings:="" -="" members:="" -="" user:mike@example.com="" -="" group:admins@example.com="" -="" domain:google.com="" -="" serviceaccount:my-project-id@appspot.gserviceaccount.com="" role:="" roles/resourcemanager.organizationadmin="" -="" members:="" -="" user:eve@example.com="" role:="" roles/resourcemanager.organizationviewer="" condition:="" title:="" expirable="" access="" description:="" does="" not="" grant="" access="" after="" sep="" 2020="" expression:="" request.time="">< timestamp('2020-10-01t00:00:00.000z')="" for="" a="" description="" of="" iam="" and="" its="" features,="" see="" the="">IAM developer's guide __.

test_iam_permissions

test_iam_permissions(
    request: typing.Optional[
        google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest
    ] = None,
    *,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse

Tests the specified IAM permissions against the IAM access control policy for a function.

If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Parameters
Name Description
request .iam_policy_pb2.TestIamPermissionsRequest

The request object. Request message for TestIamPermissions method.

retry google.api_core.retry_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
.iam_policy_pb2.TestIamPermissionsResponse Response message for TestIamPermissions method.

update_application

update_application(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.UpdateApplicationRequest, dict
        ]
    ] = None,
    *,
    application: typing.Optional[
        google.cloud.apphub_v1.types.application.Application
    ] = None,
    update_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Updates an Application in a host project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_update_application():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    application = apphub_v1.Application()
    application.scope.type_ = "REGIONAL"

    request = apphub_v1.UpdateApplicationRequest(
        application=application,
    )

    # Make the request
    operation = client.update_application(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.UpdateApplicationRequest, dict]]

The request object. Request for UpdateApplication.

application Application

Required. The resource being updated. This corresponds to the application field on the request instance; if request is provided, this should not be set.

update_mask google.protobuf.field_mask_pb2.FieldMask

Required. Field mask is used to specify the fields to be overwritten in the Application resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. The API changes the values of the fields as specified in the update_mask. The API ignores the values of all fields not covered by the update_mask. You can also unset a field by not specifying it in the updated message, but adding the field to the mask. This clears whatever value the field previously had. 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_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Application Application defines the governance boundary for App Hub Entities that perform a logical end-to-end business function. App Hub supports application level IAM permission to align with governance requirements.

update_service

update_service(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.UpdateServiceRequest, dict
        ]
    ] = None,
    *,
    service: typing.Optional[google.cloud.apphub_v1.types.service.Service] = None,
    update_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Updates a Service in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_update_service():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    service = apphub_v1.Service()
    service.discovered_service = "discovered_service_value"

    request = apphub_v1.UpdateServiceRequest(
        service=service,
    )

    # Make the request
    operation = client.update_service(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.UpdateServiceRequest, dict]]

The request object. Request for UpdateService.

service Service

Required. The resource being updated. This corresponds to the service field on the request instance; if request is provided, this should not be set.

update_mask google.protobuf.field_mask_pb2.FieldMask

Required. Field mask is used to specify the fields to be overwritten in the Service resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. The API changes the values of the fields as specified in the update_mask. The API ignores the values of all fields not covered by the update_mask. You can also unset a field by not specifying it in the updated message, but adding the field to the mask. This clears whatever value the field previously had. 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_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Service Service is an App Hub data model that contains a discovered service, which represents a network/api interface that exposes some functionality to clients for consumption over the network.

update_workload

update_workload(
    request: typing.Optional[
        typing.Union[
            google.cloud.apphub_v1.types.apphub_service.UpdateWorkloadRequest, dict
        ]
    ] = None,
    *,
    workload: typing.Optional[google.cloud.apphub_v1.types.workload.Workload] = None,
    update_mask: typing.Optional[google.protobuf.field_mask_pb2.FieldMask] = None,
    retry: typing.Optional[
        typing.Union[
            google.api_core.retry.retry_unary_async.AsyncRetry,
            google.api_core.gapic_v1.method._MethodDefault,
        ]
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.api_core.operation_async.AsyncOperation

Updates a Workload in an Application.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import apphub_v1

async def sample_update_workload():
    # Create a client
    client = apphub_v1.AppHubAsyncClient()

    # Initialize request argument(s)
    workload = apphub_v1.Workload()
    workload.discovered_workload = "discovered_workload_value"

    request = apphub_v1.UpdateWorkloadRequest(
        workload=workload,
    )

    # Make the request
    operation = client.update_workload(request=request)

    print("Waiting for operation to complete...")

    response = (await operation).result()

    # Handle the response
    print(response)
Parameters
Name Description
request Optional[Union[google.cloud.apphub_v1.types.UpdateWorkloadRequest, dict]]

The request object. Request for UpdateWorkload.

workload Workload

Required. The resource being updated. This corresponds to the workload field on the request instance; if request is provided, this should not be set.

update_mask google.protobuf.field_mask_pb2.FieldMask

Required. Field mask is used to specify the fields to be overwritten in the Workload resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. The API changes the values of the fields as specified in the update_mask. The API ignores the values of all fields not covered by the update_mask. You can also unset a field by not specifying it in the updated message, but adding the field to the mask. This clears whatever value the field previously had. 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_async.AsyncRetry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, Union[str, bytes]]]

Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type str, but for metadata keys ending with the suffix -bin, the corresponding values must be of type bytes.

Returns
Type Description
google.api_core.operation_async.AsyncOperation An object representing a long-running operation. The result type for the operation will be Workload Workload is an App Hub data model that contains a discovered workload, which represents a binary deployment (such as managed instance groups (MIGs) and GKE deployments) that performs the smallest logical subset of business functionality.

workload_path

workload_path(project: str, location: str, application: str, workload: str) -> str

Returns a fully-qualified workload string.