Package com.google.cloud.run.v2 (0.4.0)

A client to Cloud Run Admin API

The interfaces provided are listed below, along with usage samples.

RevisionsClient

Service Description: Cloud Run Revision Control Plane API.

Sample for RevisionsClient:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RevisionsClient revisionsClient = RevisionsClient.create()) {
   RevisionName name = RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]");
   Revision response = revisionsClient.getRevision(name);
 }
 

ServicesClient

Service Description: Cloud Run Service Control Plane API

Sample for ServicesClient:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ServicesClient servicesClient = ServicesClient.create()) {
   ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   Service response = servicesClient.getService(name);
 }
 

Classes

BinaryAuthorization

Settings for Binary Authorization feature.

Protobuf type google.cloud.run.v2.BinaryAuthorization

BinaryAuthorization.Builder

Settings for Binary Authorization feature.

Protobuf type google.cloud.run.v2.BinaryAuthorization

CloudSqlInstance

Represents a specific Cloud SQL instance.

Protobuf type google.cloud.run.v2.CloudSqlInstance

CloudSqlInstance.Builder

Represents a specific Cloud SQL instance.

Protobuf type google.cloud.run.v2.CloudSqlInstance

Condition

Defines a status condition for a resource.

Protobuf type google.cloud.run.v2.Condition

Condition.Builder

Defines a status condition for a resource.

Protobuf type google.cloud.run.v2.Condition

ConditionProto

Container

A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments may be supplied by the system to the container at runtime.

Protobuf type google.cloud.run.v2.Container

Container.Builder

A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments may be supplied by the system to the container at runtime.

Protobuf type google.cloud.run.v2.Container

ContainerPort

ContainerPort represents a network port in a single container.

Protobuf type google.cloud.run.v2.ContainerPort

ContainerPort.Builder

ContainerPort represents a network port in a single container.

Protobuf type google.cloud.run.v2.ContainerPort

CreateServiceRequest

Request message for creating a Service.

Protobuf type google.cloud.run.v2.CreateServiceRequest

CreateServiceRequest.Builder

Request message for creating a Service.

Protobuf type google.cloud.run.v2.CreateServiceRequest

DeleteRevisionRequest

Request message for deleting a retired Revision. Revision lifecycle is usually managed by making changes to the parent Service. Only retired revisions can be deleted with this API.

Protobuf type google.cloud.run.v2.DeleteRevisionRequest

DeleteRevisionRequest.Builder

Request message for deleting a retired Revision. Revision lifecycle is usually managed by making changes to the parent Service. Only retired revisions can be deleted with this API.

Protobuf type google.cloud.run.v2.DeleteRevisionRequest

DeleteServiceRequest

Request message to delete a Service by its full name.

Protobuf type google.cloud.run.v2.DeleteServiceRequest

DeleteServiceRequest.Builder

Request message to delete a Service by its full name.

Protobuf type google.cloud.run.v2.DeleteServiceRequest

EnvVar

EnvVar represents an environment variable present in a Container.

Protobuf type google.cloud.run.v2.EnvVar

EnvVar.Builder

EnvVar represents an environment variable present in a Container.

Protobuf type google.cloud.run.v2.EnvVar

EnvVarSource

EnvVarSource represents a source for the value of an EnvVar.

Protobuf type google.cloud.run.v2.EnvVarSource

EnvVarSource.Builder

EnvVarSource represents a source for the value of an EnvVar.

Protobuf type google.cloud.run.v2.EnvVarSource

GetRevisionRequest

Request message for obtaining a Revision by its full name.

Protobuf type google.cloud.run.v2.GetRevisionRequest

GetRevisionRequest.Builder

Request message for obtaining a Revision by its full name.

Protobuf type google.cloud.run.v2.GetRevisionRequest

GetServiceRequest

Request message for obtaining a Service by its full name.

Protobuf type google.cloud.run.v2.GetServiceRequest

GetServiceRequest.Builder

Request message for obtaining a Service by its full name.

Protobuf type google.cloud.run.v2.GetServiceRequest

K8sMinProto

ListRevisionsRequest

Request message for retrieving a list of Revisions.

Protobuf type google.cloud.run.v2.ListRevisionsRequest

ListRevisionsRequest.Builder

Request message for retrieving a list of Revisions.

Protobuf type google.cloud.run.v2.ListRevisionsRequest

ListRevisionsResponse

Response message containing a list of Revisions.

Protobuf type google.cloud.run.v2.ListRevisionsResponse

ListRevisionsResponse.Builder

Response message containing a list of Revisions.

Protobuf type google.cloud.run.v2.ListRevisionsResponse

ListServicesRequest

Request message for retrieving a list of Services.

Protobuf type google.cloud.run.v2.ListServicesRequest

ListServicesRequest.Builder

Request message for retrieving a list of Services.

Protobuf type google.cloud.run.v2.ListServicesRequest

ListServicesResponse

Response message containing a list of Services.

Protobuf type google.cloud.run.v2.ListServicesResponse

ListServicesResponse.Builder

Response message containing a list of Services.

Protobuf type google.cloud.run.v2.ListServicesResponse

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

ResourceRequirements

ResourceRequirements describes the compute resource requirements.

Protobuf type google.cloud.run.v2.ResourceRequirements

ResourceRequirements.Builder

ResourceRequirements describes the compute resource requirements.

Protobuf type google.cloud.run.v2.ResourceRequirements

Revision

A Revision is an immutable snapshot of code and configuration. A Revision references a container image. Revisions are only created by updates to its parent Service.

Protobuf type google.cloud.run.v2.Revision

Revision.Builder

A Revision is an immutable snapshot of code and configuration. A Revision references a container image. Revisions are only created by updates to its parent Service.

Protobuf type google.cloud.run.v2.Revision

RevisionName

RevisionName.Builder

Builder for projects/{project}/locations/{location}/services/{service}/revisions/{revision}.

RevisionProto

RevisionScaling

Settings for revision-level scaling settings.

Protobuf type google.cloud.run.v2.RevisionScaling

RevisionScaling.Builder

Settings for revision-level scaling settings.

Protobuf type google.cloud.run.v2.RevisionScaling

RevisionTemplate

RevisionTemplate describes the data a revision should have when created from a template.

Protobuf type google.cloud.run.v2.RevisionTemplate

RevisionTemplate.Builder

RevisionTemplate describes the data a revision should have when created from a template.

Protobuf type google.cloud.run.v2.RevisionTemplate

RevisionTemplateProto

RevisionsClient

Service Description: Cloud Run Revision Control Plane API.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (RevisionsClient revisionsClient = RevisionsClient.create()) {
   RevisionName name = RevisionName.of("[PROJECT]", "[LOCATION]", "[SERVICE]", "[REVISION]");
   Revision response = revisionsClient.getRevision(name);
 }
 

Note: close() needs to be called on the RevisionsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of RevisionsSettings to create(). For example:

To customize credentials:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 RevisionsSettings revisionsSettings =
     RevisionsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 RevisionsClient revisionsClient = RevisionsClient.create(revisionsSettings);
 

To customize the endpoint:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 RevisionsSettings revisionsSettings =
     RevisionsSettings.newBuilder().setEndpoint(myEndpoint).build();
 RevisionsClient revisionsClient = RevisionsClient.create(revisionsSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 RevisionsSettings revisionsSettings =
     RevisionsSettings.newBuilder()
         .setTransportChannelProvider(
             RevisionsSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 RevisionsClient revisionsClient = RevisionsClient.create(revisionsSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

RevisionsClient.ListRevisionsFixedSizeCollection

RevisionsClient.ListRevisionsPage

RevisionsClient.ListRevisionsPagedResponse

RevisionsGrpc

Cloud Run Revision Control Plane API.

RevisionsGrpc.RevisionsBlockingStub

Cloud Run Revision Control Plane API.

RevisionsGrpc.RevisionsFutureStub

Cloud Run Revision Control Plane API.

RevisionsGrpc.RevisionsImplBase

Cloud Run Revision Control Plane API.

RevisionsGrpc.RevisionsStub

Cloud Run Revision Control Plane API.

RevisionsSettings

Settings class to configure an instance of RevisionsClient.

The default instance has everything set to sensible defaults:

  • The default service address (run.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getRevision to 30 seconds:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 RevisionsSettings.Builder revisionsSettingsBuilder = RevisionsSettings.newBuilder();
 revisionsSettingsBuilder
     .getRevisionSettings()
     .setRetrySettings(
         revisionsSettingsBuilder.getRevisionSettings().getRetrySettings().toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 RevisionsSettings revisionsSettings = revisionsSettingsBuilder.build();
 

RevisionsSettings.Builder

Builder for RevisionsSettings.

SecretKeySelector

SecretEnvVarSource represents a source for the value of an EnvVar.

Protobuf type google.cloud.run.v2.SecretKeySelector

SecretKeySelector.Builder

SecretEnvVarSource represents a source for the value of an EnvVar.

Protobuf type google.cloud.run.v2.SecretKeySelector

SecretVolumeSource

The secret's value will be presented as the content of a file whose name is defined in the item path. If no items are defined, the name of the file is the secret.

Protobuf type google.cloud.run.v2.SecretVolumeSource

SecretVolumeSource.Builder

The secret's value will be presented as the content of a file whose name is defined in the item path. If no items are defined, the name of the file is the secret.

Protobuf type google.cloud.run.v2.SecretVolumeSource

Service

Service acts as a top-level container that manages a set of configurations and revision templates which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership.

Protobuf type google.cloud.run.v2.Service

Service.Builder

Service acts as a top-level container that manages a set of configurations and revision templates which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership.

Protobuf type google.cloud.run.v2.Service

ServiceName

ServiceName.Builder

Builder for projects/{project}/locations/{location}/services/{service}.

ServiceProto

ServicesClient

Service Description: Cloud Run Service Control Plane API

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (ServicesClient servicesClient = ServicesClient.create()) {
   ServiceName name = ServiceName.of("[PROJECT]", "[LOCATION]", "[SERVICE]");
   Service response = servicesClient.getService(name);
 }
 

Note: close() needs to be called on the ServicesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of ServicesSettings to create(). For example:

To customize credentials:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ServicesSettings servicesSettings =
     ServicesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ServicesClient servicesClient = ServicesClient.create(servicesSettings);
 

To customize the endpoint:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ServicesSettings servicesSettings =
     ServicesSettings.newBuilder().setEndpoint(myEndpoint).build();
 ServicesClient servicesClient = ServicesClient.create(servicesSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ServicesSettings servicesSettings =
     ServicesSettings.newBuilder()
         .setTransportChannelProvider(
             ServicesSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 ServicesClient servicesClient = ServicesClient.create(servicesSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

ServicesClient.ListServicesFixedSizeCollection

ServicesClient.ListServicesPage

ServicesClient.ListServicesPagedResponse

ServicesGrpc

Cloud Run Service Control Plane API

ServicesGrpc.ServicesBlockingStub

Cloud Run Service Control Plane API

ServicesGrpc.ServicesFutureStub

Cloud Run Service Control Plane API

ServicesGrpc.ServicesImplBase

Cloud Run Service Control Plane API

ServicesGrpc.ServicesStub

Cloud Run Service Control Plane API

ServicesSettings

Settings class to configure an instance of ServicesClient.

The default instance has everything set to sensible defaults:

  • The default service address (run.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getService to 30 seconds:


 // 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 ServicesSettings.Builder servicesSettingsBuilder = ServicesSettings.newBuilder();
 servicesSettingsBuilder
     .getServiceSettings()
     .setRetrySettings(
         servicesSettingsBuilder.getServiceSettings().getRetrySettings().toBuilder()
             .setTotalTimeout(Duration.ofSeconds(30))
             .build());
 ServicesSettings servicesSettings = servicesSettingsBuilder.build();
 

ServicesSettings.Builder

Builder for ServicesSettings.

TrafficTarget

Holds a single traffic routing entry for the Service. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.

Protobuf type google.cloud.run.v2.TrafficTarget

TrafficTarget.Builder

Holds a single traffic routing entry for the Service. Allocations can be done to a specific Revision name, or pointing to the latest Ready Revision.

Protobuf type google.cloud.run.v2.TrafficTarget

TrafficTargetProto

TrafficTargetStatus

Represents the observed state of a single TrafficTarget entry.

Protobuf type google.cloud.run.v2.TrafficTargetStatus

TrafficTargetStatus.Builder

Represents the observed state of a single TrafficTarget entry.

Protobuf type google.cloud.run.v2.TrafficTargetStatus

UpdateServiceRequest

Request message for updating a service.

Protobuf type google.cloud.run.v2.UpdateServiceRequest

UpdateServiceRequest.Builder

Request message for updating a service.

Protobuf type google.cloud.run.v2.UpdateServiceRequest

VendorSettingsProto

VersionToPath

VersionToPath maps a specific version of a secret to a relative file to mount to, relative to VolumeMount's mount_path.

Protobuf type google.cloud.run.v2.VersionToPath

VersionToPath.Builder

VersionToPath maps a specific version of a secret to a relative file to mount to, relative to VolumeMount's mount_path.

Protobuf type google.cloud.run.v2.VersionToPath

Volume

Volume represents a named volume in a container.

Protobuf type google.cloud.run.v2.Volume

Volume.Builder

Volume represents a named volume in a container.

Protobuf type google.cloud.run.v2.Volume

VolumeMount

VolumeMount describes a mounting of a Volume within a container.

Protobuf type google.cloud.run.v2.VolumeMount

VolumeMount.Builder

VolumeMount describes a mounting of a Volume within a container.

Protobuf type google.cloud.run.v2.VolumeMount

VpcAccess

VPC Access settings. For more information on creating a VPC Connector, visit https://cloud.google.com/vpc/docs/configure-serverless-vpc-access For information on how to configure Cloud Run with an existing VPC Connector, visit https://cloud.google.com/run/docs/configuring/connecting-vpc

Protobuf type google.cloud.run.v2.VpcAccess

VpcAccess.Builder

VPC Access settings. For more information on creating a VPC Connector, visit https://cloud.google.com/vpc/docs/configure-serverless-vpc-access For information on how to configure Cloud Run with an existing VPC Connector, visit https://cloud.google.com/run/docs/configuring/connecting-vpc

Protobuf type google.cloud.run.v2.VpcAccess

Interfaces

BinaryAuthorizationOrBuilder

CloudSqlInstanceOrBuilder

ConditionOrBuilder

ContainerOrBuilder

ContainerPortOrBuilder

CreateServiceRequestOrBuilder

DeleteRevisionRequestOrBuilder

DeleteServiceRequestOrBuilder

EnvVarOrBuilder

EnvVarSourceOrBuilder

GetRevisionRequestOrBuilder

GetServiceRequestOrBuilder

ListRevisionsRequestOrBuilder

ListRevisionsResponseOrBuilder

ListServicesRequestOrBuilder

ListServicesResponseOrBuilder

ResourceRequirementsOrBuilder

RevisionOrBuilder

RevisionScalingOrBuilder

RevisionTemplateOrBuilder

SecretKeySelectorOrBuilder

SecretVolumeSourceOrBuilder

ServiceOrBuilder

TrafficTargetOrBuilder

TrafficTargetStatusOrBuilder

UpdateServiceRequestOrBuilder

VersionToPathOrBuilder

VolumeMountOrBuilder

VolumeOrBuilder

VpcAccessOrBuilder

Enums

BinaryAuthorization.BinauthzMethodCase

Condition.CommonReason

Reasons common to all types of conditions.

Protobuf enum google.cloud.run.v2.Condition.CommonReason

Condition.ExecutionReason

Reasons specific to Execution resource.

Protobuf enum google.cloud.run.v2.Condition.ExecutionReason

Condition.ReasonsCase

Condition.RevisionReason

Reasons specific to Revision resource.

Protobuf enum google.cloud.run.v2.Condition.RevisionReason

Condition.Severity

Represents the severity of the condition failures.

Protobuf enum google.cloud.run.v2.Condition.Severity

Condition.State

Represents the possible Condition states.

Protobuf enum google.cloud.run.v2.Condition.State

EnvVar.ValuesCase

ExecutionEnvironment

Alternatives for execution environments.

Protobuf enum google.cloud.run.v2.ExecutionEnvironment

IngressTraffic

Allowed ingress traffic for the Container.

Protobuf enum google.cloud.run.v2.IngressTraffic

TrafficTargetAllocationType

The type of instance allocation.

Protobuf enum google.cloud.run.v2.TrafficTargetAllocationType

Volume.VolumeTypeCase

VpcAccess.VpcEgress

Egress options for VPC access.

Protobuf enum google.cloud.run.v2.VpcAccess.VpcEgress