@Generated(value="by gapic-generator") @BetaApi public class ProjectClient extends Object implements BackgroundResource
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:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Operation response = projectClient.disableXpnHostProject(project);
}
Note: close() needs to be called on the projectClient 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:
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 ProjectSettings to create(). For example:
To customize credentials:
ProjectSettings projectSettings =
ProjectSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ProjectClient projectClient =
ProjectClient.create(projectSettings);
To customize the endpoint:
ProjectSettings projectSettings =
ProjectSettings.newBuilder().setEndpoint(myEndpoint).build();
ProjectClient projectClient =
ProjectClient.create(projectSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ProjectClient.GetXpnResourcesProjectsFixedSizeCollection |
static class |
ProjectClient.GetXpnResourcesProjectsPage |
static class |
ProjectClient.GetXpnResourcesProjectsPagedResponse |
static class |
ProjectClient.ListXpnHostsProjectsFixedSizeCollection |
static class |
ProjectClient.ListXpnHostsProjectsPage |
static class |
ProjectClient.ListXpnHostsProjectsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ProjectClient(ProjectSettings settings)
Constructs an instance of ProjectClient, using the given settings.
|
protected |
ProjectClient(ProjectStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ProjectClient |
create()
Constructs an instance of ProjectClient with default settings.
|
static ProjectClient |
create(ProjectSettings settings)
Constructs an instance of ProjectClient, using the given settings.
|
static ProjectClient |
create(ProjectStub stub)
Constructs an instance of ProjectClient, using the given stub for making calls.
|
Operation |
disableXpnHostProject(DisableXpnHostProjectHttpRequest request)
Disable this project as a shared VPC host project.
|
Operation |
disableXpnHostProject(ProjectName project)
Disable this project as a shared VPC host project.
|
Operation |
disableXpnHostProject(String project)
Disable this project as a shared VPC host project.
|
UnaryCallable<DisableXpnHostProjectHttpRequest,Operation> |
disableXpnHostProjectCallable()
Disable this project as a shared VPC host project.
|
Operation |
disableXpnResourceProject(DisableXpnResourceProjectHttpRequest request)
Disable a serivce resource (a.k.a service project) associated with this host project.
|
Operation |
disableXpnResourceProject(ProjectName project,
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)
Disable a serivce resource (a.k.a service project) associated with this host project.
|
Operation |
disableXpnResourceProject(String project,
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)
Disable a serivce resource (a.k.a service project) associated with this host project.
|
UnaryCallable<DisableXpnResourceProjectHttpRequest,Operation> |
disableXpnResourceProjectCallable()
Disable a serivce resource (a.k.a service project) associated with this host project.
|
Operation |
enableXpnHostProject(EnableXpnHostProjectHttpRequest request)
Enable this project as a shared VPC host project.
|
Operation |
enableXpnHostProject(ProjectName project)
Enable this project as a shared VPC host project.
|
Operation |
enableXpnHostProject(String project)
Enable this project as a shared VPC host project.
|
UnaryCallable<EnableXpnHostProjectHttpRequest,Operation> |
enableXpnHostProjectCallable()
Enable this project as a shared VPC host project.
|
Operation |
enableXpnResourceProject(EnableXpnResourceProjectHttpRequest request)
Enable service resource (a.k.a service project) for a host project, so that subnets in the host
project can be used by instances in the service project.
|
Operation |
enableXpnResourceProject(ProjectName project,
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)
Enable service resource (a.k.a service project) for a host project, so that subnets in the host
project can be used by instances in the service project.
|
Operation |
enableXpnResourceProject(String project,
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)
Enable service resource (a.k.a service project) for a host project, so that subnets in the host
project can be used by instances in the service project.
|
UnaryCallable<EnableXpnResourceProjectHttpRequest,Operation> |
enableXpnResourceProjectCallable()
Enable service resource (a.k.a service project) for a host project, so that subnets in the host
project can be used by instances in the service project.
|
Project |
getProject(GetProjectHttpRequest request)
Returns the specified Project resource.
|
Project |
getProject(ProjectName project)
Returns the specified Project resource.
|
Project |
getProject(String project)
Returns the specified Project resource.
|
UnaryCallable<GetProjectHttpRequest,Project> |
getProjectCallable()
Returns the specified Project resource.
|
ProjectSettings |
getSettings() |
ProjectStub |
getStub() |
Project |
getXpnHostProject(GetXpnHostProjectHttpRequest request)
Gets the shared VPC host project that this project links to.
|
Project |
getXpnHostProject(ProjectName project)
Gets the shared VPC host project that this project links to.
|
Project |
getXpnHostProject(String project)
Gets the shared VPC host project that this project links to.
|
UnaryCallable<GetXpnHostProjectHttpRequest,Project> |
getXpnHostProjectCallable()
Gets the shared VPC host project that this project links to.
|
ProjectClient.GetXpnResourcesProjectsPagedResponse |
getXpnResourcesProjects(GetXpnResourcesProjectsHttpRequest request)
Gets service resources (a.k.a service project) associated with this host project.
|
ProjectClient.GetXpnResourcesProjectsPagedResponse |
getXpnResourcesProjects(ProjectName project)
Gets service resources (a.k.a service project) associated with this host project.
|
ProjectClient.GetXpnResourcesProjectsPagedResponse |
getXpnResourcesProjects(String project)
Gets service resources (a.k.a service project) associated with this host project.
|
UnaryCallable<GetXpnResourcesProjectsHttpRequest,ProjectsGetXpnResources> |
getXpnResourcesProjectsCallable()
Gets service resources (a.k.a service project) associated with this host project.
|
UnaryCallable<GetXpnResourcesProjectsHttpRequest,ProjectClient.GetXpnResourcesProjectsPagedResponse> |
getXpnResourcesProjectsPagedCallable()
Gets service resources (a.k.a service project) associated with this host project.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
ProjectClient.ListXpnHostsProjectsPagedResponse |
listXpnHostsProjects(ListXpnHostsProjectsHttpRequest request)
Lists all shared VPC host projects visible to the user in an organization.
|
ProjectClient.ListXpnHostsProjectsPagedResponse |
listXpnHostsProjects(ProjectName project,
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)
Lists all shared VPC host projects visible to the user in an organization.
|
ProjectClient.ListXpnHostsProjectsPagedResponse |
listXpnHostsProjects(String project,
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)
Lists all shared VPC host projects visible to the user in an organization.
|
UnaryCallable<ListXpnHostsProjectsHttpRequest,XpnHostList> |
listXpnHostsProjectsCallable()
Lists all shared VPC host projects visible to the user in an organization.
|
UnaryCallable<ListXpnHostsProjectsHttpRequest,ProjectClient.ListXpnHostsProjectsPagedResponse> |
listXpnHostsProjectsPagedCallable()
Lists all shared VPC host projects visible to the user in an organization.
|
Operation |
moveDiskProject(MoveDiskProjectHttpRequest request)
Moves a persistent disk from one zone to another.
|
Operation |
moveDiskProject(ProjectName project,
DiskMoveRequest diskMoveRequestResource)
Moves a persistent disk from one zone to another.
|
Operation |
moveDiskProject(String project,
DiskMoveRequest diskMoveRequestResource)
Moves a persistent disk from one zone to another.
|
UnaryCallable<MoveDiskProjectHttpRequest,Operation> |
moveDiskProjectCallable()
Moves a persistent disk from one zone to another.
|
Operation |
moveInstanceProject(MoveInstanceProjectHttpRequest request)
Moves an instance and its attached persistent disks from one zone to another.
|
Operation |
moveInstanceProject(ProjectName project,
InstanceMoveRequest instanceMoveRequestResource)
Moves an instance and its attached persistent disks from one zone to another.
|
Operation |
moveInstanceProject(String project,
InstanceMoveRequest instanceMoveRequestResource)
Moves an instance and its attached persistent disks from one zone to another.
|
UnaryCallable<MoveInstanceProjectHttpRequest,Operation> |
moveInstanceProjectCallable()
Moves an instance and its attached persistent disks from one zone to another.
|
Operation |
setCommonInstanceMetadataProject(ProjectName project,
Metadata metadataResource)
Sets metadata common to all instances within the specified project using the data included in
the request.
|
Operation |
setCommonInstanceMetadataProject(SetCommonInstanceMetadataProjectHttpRequest request)
Sets metadata common to all instances within the specified project using the data included in
the request.
|
Operation |
setCommonInstanceMetadataProject(String project,
Metadata metadataResource)
Sets metadata common to all instances within the specified project using the data included in
the request.
|
UnaryCallable<SetCommonInstanceMetadataProjectHttpRequest,Operation> |
setCommonInstanceMetadataProjectCallable()
Sets metadata common to all instances within the specified project using the data included in
the request.
|
Operation |
setDefaultNetworkTierProject(ProjectName project,
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)
Sets the default network tier of the project.
|
Operation |
setDefaultNetworkTierProject(SetDefaultNetworkTierProjectHttpRequest request)
Sets the default network tier of the project.
|
Operation |
setDefaultNetworkTierProject(String project,
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)
Sets the default network tier of the project.
|
UnaryCallable<SetDefaultNetworkTierProjectHttpRequest,Operation> |
setDefaultNetworkTierProjectCallable()
Sets the default network tier of the project.
|
Operation |
setUsageExportBucketProject(ProjectName project,
UsageExportLocation usageExportLocationResource)
Enables the usage export feature and sets the usage export bucket where reports are stored.
|
Operation |
setUsageExportBucketProject(SetUsageExportBucketProjectHttpRequest request)
Enables the usage export feature and sets the usage export bucket where reports are stored.
|
Operation |
setUsageExportBucketProject(String project,
UsageExportLocation usageExportLocationResource)
Enables the usage export feature and sets the usage export bucket where reports are stored.
|
UnaryCallable<SetUsageExportBucketProjectHttpRequest,Operation> |
setUsageExportBucketProjectCallable()
Enables the usage export feature and sets the usage export bucket where reports are stored.
|
void |
shutdown() |
void |
shutdownNow() |
protected ProjectClient(ProjectSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ProjectClient(ProjectStub stub)
public static final ProjectClient create() throws IOException
IOException
public static final ProjectClient create(ProjectSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ProjectClient create(ProjectStub stub)
public final ProjectSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ProjectStub getStub()
@BetaApi public final Operation disableXpnHostProject(ProjectName project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Operation response = projectClient.disableXpnHostProject(project);
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Operation disableXpnHostProject(String project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Operation response = projectClient.disableXpnHostProject(project.toString());
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Operation disableXpnHostProject(DisableXpnHostProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
DisableXpnHostProjectHttpRequest request = DisableXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
Operation response = projectClient.disableXpnHostProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DisableXpnHostProjectHttpRequest,Operation> disableXpnHostProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
DisableXpnHostProjectHttpRequest request = DisableXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<Operation> future = projectClient.disableXpnHostProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation disableXpnResourceProject(ProjectName project, ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
Operation response = projectClient.disableXpnResourceProject(project, projectsDisableXpnResourceRequestResource);
}
project
- Project ID for this request.projectsDisableXpnResourceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation disableXpnResourceProject(String project, ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
Operation response = projectClient.disableXpnResourceProject(project.toString(), projectsDisableXpnResourceRequestResource);
}
project
- Project ID for this request.projectsDisableXpnResourceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation disableXpnResourceProject(DisableXpnResourceProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
DisableXpnResourceProjectHttpRequest request = DisableXpnResourceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource)
.build();
Operation response = projectClient.disableXpnResourceProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DisableXpnResourceProjectHttpRequest,Operation> disableXpnResourceProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsDisableXpnResourceRequest projectsDisableXpnResourceRequestResource = ProjectsDisableXpnResourceRequest.newBuilder().build();
DisableXpnResourceProjectHttpRequest request = DisableXpnResourceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsDisableXpnResourceRequestResource(projectsDisableXpnResourceRequestResource)
.build();
ApiFuture<Operation> future = projectClient.disableXpnResourceProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation enableXpnHostProject(ProjectName project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Operation response = projectClient.enableXpnHostProject(project);
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Operation enableXpnHostProject(String project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Operation response = projectClient.enableXpnHostProject(project.toString());
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Operation enableXpnHostProject(EnableXpnHostProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
EnableXpnHostProjectHttpRequest request = EnableXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
Operation response = projectClient.enableXpnHostProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<EnableXpnHostProjectHttpRequest,Operation> enableXpnHostProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
EnableXpnHostProjectHttpRequest request = EnableXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<Operation> future = projectClient.enableXpnHostProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation enableXpnResourceProject(ProjectName project, ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
Operation response = projectClient.enableXpnResourceProject(project, projectsEnableXpnResourceRequestResource);
}
project
- Project ID for this request.projectsEnableXpnResourceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation enableXpnResourceProject(String project, ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
Operation response = projectClient.enableXpnResourceProject(project.toString(), projectsEnableXpnResourceRequestResource);
}
project
- Project ID for this request.projectsEnableXpnResourceRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation enableXpnResourceProject(EnableXpnResourceProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
EnableXpnResourceProjectHttpRequest request = EnableXpnResourceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource)
.build();
Operation response = projectClient.enableXpnResourceProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<EnableXpnResourceProjectHttpRequest,Operation> enableXpnResourceProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = ProjectsEnableXpnResourceRequest.newBuilder().build();
EnableXpnResourceProjectHttpRequest request = EnableXpnResourceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsEnableXpnResourceRequestResource(projectsEnableXpnResourceRequestResource)
.build();
ApiFuture<Operation> future = projectClient.enableXpnResourceProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Project getProject(ProjectName project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Project response = projectClient.getProject(project);
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Project getProject(String project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Project response = projectClient.getProject(project.toString());
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Project getProject(GetProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetProjectHttpRequest request = GetProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
Project response = projectClient.getProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetProjectHttpRequest,Project> getProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetProjectHttpRequest request = GetProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<Project> future = projectClient.getProjectCallable().futureCall(request);
// Do something
Project response = future.get();
}
@BetaApi public final Project getXpnHostProject(ProjectName project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Project response = projectClient.getXpnHostProject(project);
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Project getXpnHostProject(String project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Project response = projectClient.getXpnHostProject(project.toString());
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final Project getXpnHostProject(GetXpnHostProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetXpnHostProjectHttpRequest request = GetXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
Project response = projectClient.getXpnHostProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetXpnHostProjectHttpRequest,Project> getXpnHostProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetXpnHostProjectHttpRequest request = GetXpnHostProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<Project> future = projectClient.getXpnHostProjectCallable().futureCall(request);
// Do something
Project response = future.get();
}
@BetaApi public final ProjectClient.GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects(ProjectName project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (XpnResourceId element : projectClient.getXpnResourcesProjects(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final ProjectClient.GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects(String project)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (XpnResourceId element : projectClient.getXpnResourcesProjects(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final ProjectClient.GetXpnResourcesProjectsPagedResponse getXpnResourcesProjects(GetXpnResourcesProjectsHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (XpnResourceId element : projectClient.getXpnResourcesProjects(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetXpnResourcesProjectsHttpRequest,ProjectClient.GetXpnResourcesProjectsPagedResponse> getXpnResourcesProjectsPagedCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<GetXpnResourcesProjectsPagedResponse> future = projectClient.getXpnResourcesProjectsPagedCallable().futureCall(request);
// Do something
for (XpnResourceId element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<GetXpnResourcesProjectsHttpRequest,ProjectsGetXpnResources> getXpnResourcesProjectsCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
GetXpnResourcesProjectsHttpRequest request = GetXpnResourcesProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
ProjectsGetXpnResources response = projectClient.getXpnResourcesProjectsCallable().call(request);
for (XpnResourceId element : response.getResourcesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final ProjectClient.ListXpnHostsProjectsPagedResponse listXpnHostsProjects(ProjectName project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
for (Project element : projectClient.listXpnHostsProjects(project, projectsListXpnHostsRequestResource).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.projectsListXpnHostsRequestResource
- ApiException
- if the remote call fails@BetaApi public final ProjectClient.ListXpnHostsProjectsPagedResponse listXpnHostsProjects(String project, ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
for (Project element : projectClient.listXpnHostsProjects(project.toString(), projectsListXpnHostsRequestResource).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.projectsListXpnHostsRequestResource
- ApiException
- if the remote call fails@BetaApi public final ProjectClient.ListXpnHostsProjectsPagedResponse listXpnHostsProjects(ListXpnHostsProjectsHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
.build();
for (Project element : projectClient.listXpnHostsProjects(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListXpnHostsProjectsHttpRequest,ProjectClient.ListXpnHostsProjectsPagedResponse> listXpnHostsProjectsPagedCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
.build();
ApiFuture<ListXpnHostsProjectsPagedResponse> future = projectClient.listXpnHostsProjectsPagedCallable().futureCall(request);
// Do something
for (Project element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListXpnHostsProjectsHttpRequest,XpnHostList> listXpnHostsProjectsCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsListXpnHostsRequest projectsListXpnHostsRequestResource = ProjectsListXpnHostsRequest.newBuilder().build();
ListXpnHostsProjectsHttpRequest request = ListXpnHostsProjectsHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsListXpnHostsRequestResource(projectsListXpnHostsRequestResource)
.build();
while (true) {
XpnHostList response = projectClient.listXpnHostsProjectsCallable().call(request);
for (Project element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation moveDiskProject(ProjectName project, DiskMoveRequest diskMoveRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
Operation response = projectClient.moveDiskProject(project, diskMoveRequestResource);
}
project
- Project ID for this request.diskMoveRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation moveDiskProject(String project, DiskMoveRequest diskMoveRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
Operation response = projectClient.moveDiskProject(project.toString(), diskMoveRequestResource);
}
project
- Project ID for this request.diskMoveRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation moveDiskProject(MoveDiskProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
MoveDiskProjectHttpRequest request = MoveDiskProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setDiskMoveRequestResource(diskMoveRequestResource)
.build();
Operation response = projectClient.moveDiskProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<MoveDiskProjectHttpRequest,Operation> moveDiskProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
DiskMoveRequest diskMoveRequestResource = DiskMoveRequest.newBuilder().build();
MoveDiskProjectHttpRequest request = MoveDiskProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setDiskMoveRequestResource(diskMoveRequestResource)
.build();
ApiFuture<Operation> future = projectClient.moveDiskProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation moveInstanceProject(ProjectName project, InstanceMoveRequest instanceMoveRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
Operation response = projectClient.moveInstanceProject(project, instanceMoveRequestResource);
}
project
- Project ID for this request.instanceMoveRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation moveInstanceProject(String project, InstanceMoveRequest instanceMoveRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
Operation response = projectClient.moveInstanceProject(project.toString(), instanceMoveRequestResource);
}
project
- Project ID for this request.instanceMoveRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation moveInstanceProject(MoveInstanceProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
MoveInstanceProjectHttpRequest request = MoveInstanceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setInstanceMoveRequestResource(instanceMoveRequestResource)
.build();
Operation response = projectClient.moveInstanceProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<MoveInstanceProjectHttpRequest,Operation> moveInstanceProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
InstanceMoveRequest instanceMoveRequestResource = InstanceMoveRequest.newBuilder().build();
MoveInstanceProjectHttpRequest request = MoveInstanceProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setInstanceMoveRequestResource(instanceMoveRequestResource)
.build();
ApiFuture<Operation> future = projectClient.moveInstanceProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setCommonInstanceMetadataProject(ProjectName project, Metadata metadataResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Metadata metadataResource = Metadata.newBuilder().build();
Operation response = projectClient.setCommonInstanceMetadataProject(project, metadataResource);
}
project
- Project ID for this request.metadataResource
- A metadata key/value entry.ApiException
- if the remote call fails@BetaApi public final Operation setCommonInstanceMetadataProject(String project, Metadata metadataResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Metadata metadataResource = Metadata.newBuilder().build();
Operation response = projectClient.setCommonInstanceMetadataProject(project.toString(), metadataResource);
}
project
- Project ID for this request.metadataResource
- A metadata key/value entry.ApiException
- if the remote call fails@BetaApi public final Operation setCommonInstanceMetadataProject(SetCommonInstanceMetadataProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Metadata metadataResource = Metadata.newBuilder().build();
SetCommonInstanceMetadataProjectHttpRequest request = SetCommonInstanceMetadataProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setMetadataResource(metadataResource)
.build();
Operation response = projectClient.setCommonInstanceMetadataProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetCommonInstanceMetadataProjectHttpRequest,Operation> setCommonInstanceMetadataProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
Metadata metadataResource = Metadata.newBuilder().build();
SetCommonInstanceMetadataProjectHttpRequest request = SetCommonInstanceMetadataProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setMetadataResource(metadataResource)
.build();
ApiFuture<Operation> future = projectClient.setCommonInstanceMetadataProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setDefaultNetworkTierProject(ProjectName project, ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource = ProjectsSetDefaultNetworkTierRequest.newBuilder().build();
Operation response = projectClient.setDefaultNetworkTierProject(project, projectsSetDefaultNetworkTierRequestResource);
}
project
- Project ID for this request.projectsSetDefaultNetworkTierRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setDefaultNetworkTierProject(String project, ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource = ProjectsSetDefaultNetworkTierRequest.newBuilder().build();
Operation response = projectClient.setDefaultNetworkTierProject(project.toString(), projectsSetDefaultNetworkTierRequestResource);
}
project
- Project ID for this request.projectsSetDefaultNetworkTierRequestResource
- ApiException
- if the remote call fails@BetaApi public final Operation setDefaultNetworkTierProject(SetDefaultNetworkTierProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource = ProjectsSetDefaultNetworkTierRequest.newBuilder().build();
SetDefaultNetworkTierProjectHttpRequest request = SetDefaultNetworkTierProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsSetDefaultNetworkTierRequestResource(projectsSetDefaultNetworkTierRequestResource)
.build();
Operation response = projectClient.setDefaultNetworkTierProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetDefaultNetworkTierProjectHttpRequest,Operation> setDefaultNetworkTierProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ProjectsSetDefaultNetworkTierRequest projectsSetDefaultNetworkTierRequestResource = ProjectsSetDefaultNetworkTierRequest.newBuilder().build();
SetDefaultNetworkTierProjectHttpRequest request = SetDefaultNetworkTierProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setProjectsSetDefaultNetworkTierRequestResource(projectsSetDefaultNetworkTierRequestResource)
.build();
ApiFuture<Operation> future = projectClient.setDefaultNetworkTierProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setUsageExportBucketProject(ProjectName project, UsageExportLocation usageExportLocationResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
Operation response = projectClient.setUsageExportBucketProject(project, usageExportLocationResource);
}
project
- Project ID for this request.usageExportLocationResource
- The location in Cloud Storage and naming method of the daily
usage report. Contains bucket_name and report_name prefix.ApiException
- if the remote call fails@BetaApi public final Operation setUsageExportBucketProject(String project, UsageExportLocation usageExportLocationResource)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
Operation response = projectClient.setUsageExportBucketProject(project.toString(), usageExportLocationResource);
}
project
- Project ID for this request.usageExportLocationResource
- The location in Cloud Storage and naming method of the daily
usage report. Contains bucket_name and report_name prefix.ApiException
- if the remote call fails@BetaApi public final Operation setUsageExportBucketProject(SetUsageExportBucketProjectHttpRequest request)
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
SetUsageExportBucketProjectHttpRequest request = SetUsageExportBucketProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setUsageExportLocationResource(usageExportLocationResource)
.build();
Operation response = projectClient.setUsageExportBucketProject(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetUsageExportBucketProjectHttpRequest,Operation> setUsageExportBucketProjectCallable()
Sample code:
try (ProjectClient projectClient = ProjectClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
UsageExportLocation usageExportLocationResource = UsageExportLocation.newBuilder().build();
SetUsageExportBucketProjectHttpRequest request = SetUsageExportBucketProjectHttpRequest.newBuilder()
.setProject(formattedProject)
.setUsageExportLocationResource(usageExportLocationResource)
.build();
ApiFuture<Operation> future = projectClient.setUsageExportBucketProjectCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.