Skip to content

chore: [compute] update Compute to generate Snippetgen Phase 1 samples for Java (#788) #9262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 29, 2023
  •  
  •  
  •  
14 changes: 8 additions & 6 deletions java-compute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,29 @@ Java idiomatic client for [Compute Engine][product-docs].


If you are using Maven, add this to your pom.xml file:
<!-- {x-version-update-start:google-cloud-compute:released} -->


```xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-compute</artifactId>
<version>1.22.0</version>
<version>1.23.0</version>
</dependency>
```

If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-compute:1.22.0'
implementation 'com.google.cloud:google-cloud-compute:1.23.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-compute" % "1.22.0"
libraryDependencies += "com.google.cloud" % "google-cloud-compute" % "1.23.0"
```
<!-- {x-version-update-end} -->

## Authentication

Expand All @@ -50,7 +52,7 @@ The client application making API calls must be granted [authorization scopes][a
You will need a [Google Cloud Platform Console][developer-console] project with the Compute Engine [API enabled][enable-api].
You will need to [enable billing][enable-billing] to use Google Compute Engine.
[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by
[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line:
[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line:
`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`.

### Installation and setup
Expand Down Expand Up @@ -236,14 +238,14 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-compute.svg
[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-compute&core=gav
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-compute/1.23.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy
[developer-console]: https://console.developers.google.com/
[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
[cloud-sdk]: https://cloud.google.com/sdk/
[cloud-cli]: https://cloud.google.com/cli
[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting
[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md
[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,159 @@ public final UnaryCallable<SetNodeTemplateNodeGroupRequest, Operation> setNodeTe
return stub.setNodeTemplateCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates maintenance event on specified nodes from the node group.
*
* <p>Sample code:
*
* <pre>{@code
* // 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 (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) {
* String project = "project-309310695";
* String zone = "zone3744684";
* String nodeGroup = "nodeGroup443599261";
* NodeGroupsSimulateMaintenanceEventRequest nodeGroupsSimulateMaintenanceEventRequestResource =
* NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build();
* Operation response =
* nodeGroupsClient
* .simulateMaintenanceEventAsync(
* project, zone, nodeGroup, nodeGroupsSimulateMaintenanceEventRequestResource)
* .get();
* }
* }</pre>
*
* @param project Project ID for this request.
* @param zone The name of the zone for this request.
* @param nodeGroup Name of the NodeGroup resource whose nodes will go under maintenance
* simulation.
* @param nodeGroupsSimulateMaintenanceEventRequestResource The body resource for this request
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync(
String project,
String zone,
String nodeGroup,
NodeGroupsSimulateMaintenanceEventRequest nodeGroupsSimulateMaintenanceEventRequestResource) {
SimulateMaintenanceEventNodeGroupRequest request =
SimulateMaintenanceEventNodeGroupRequest.newBuilder()
.setProject(project)
.setZone(zone)
.setNodeGroup(nodeGroup)
.setNodeGroupsSimulateMaintenanceEventRequestResource(
nodeGroupsSimulateMaintenanceEventRequestResource)
.build();
return simulateMaintenanceEventAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates maintenance event on specified nodes from the node group.
*
* <p>Sample code:
*
* <pre>{@code
* // 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 (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) {
* SimulateMaintenanceEventNodeGroupRequest request =
* SimulateMaintenanceEventNodeGroupRequest.newBuilder()
* .setNodeGroup("nodeGroup443599261")
* .setNodeGroupsSimulateMaintenanceEventRequestResource(
* NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build())
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setZone("zone3744684")
* .build();
* Operation response = nodeGroupsClient.simulateMaintenanceEventAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync(
SimulateMaintenanceEventNodeGroupRequest request) {
return simulateMaintenanceEventOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates maintenance event on specified nodes from the node group.
*
* <p>Sample code:
*
* <pre>{@code
* // 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 (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) {
* SimulateMaintenanceEventNodeGroupRequest request =
* SimulateMaintenanceEventNodeGroupRequest.newBuilder()
* .setNodeGroup("nodeGroup443599261")
* .setNodeGroupsSimulateMaintenanceEventRequestResource(
* NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build())
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setZone("zone3744684")
* .build();
* OperationFuture<Operation, Operation> future =
* nodeGroupsClient.simulateMaintenanceEventOperationCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final OperationCallable<SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
simulateMaintenanceEventOperationCallable() {
return stub.simulateMaintenanceEventOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Simulates maintenance event on specified nodes from the node group.
*
* <p>Sample code:
*
* <pre>{@code
* // 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 (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) {
* SimulateMaintenanceEventNodeGroupRequest request =
* SimulateMaintenanceEventNodeGroupRequest.newBuilder()
* .setNodeGroup("nodeGroup443599261")
* .setNodeGroupsSimulateMaintenanceEventRequestResource(
* NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build())
* .setProject("project-309310695")
* .setRequestId("requestId693933066")
* .setZone("zone3744684")
* .build();
* ApiFuture<Operation> future =
* nodeGroupsClient.simulateMaintenanceEventCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SimulateMaintenanceEventNodeGroupRequest, Operation>
simulateMaintenanceEventCallable() {
return stub.simulateMaintenanceEventCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns permissions that a caller has on the specified resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ public UnaryCallSettings<SetNodeTemplateNodeGroupRequest, Operation> setNodeTemp
return ((NodeGroupsStubSettings) getStubSettings()).setNodeTemplateOperationSettings();
}

/** Returns the object with the settings used for calls to simulateMaintenanceEvent. */
public UnaryCallSettings<SimulateMaintenanceEventNodeGroupRequest, Operation>
simulateMaintenanceEventSettings() {
return ((NodeGroupsStubSettings) getStubSettings()).simulateMaintenanceEventSettings();
}

/** Returns the object with the settings used for calls to simulateMaintenanceEvent. */
public OperationCallSettings<SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
simulateMaintenanceEventOperationSettings() {
return ((NodeGroupsStubSettings) getStubSettings()).simulateMaintenanceEventOperationSettings();
}

/** Returns the object with the settings used for calls to testIamPermissions. */
public UnaryCallSettings<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
testIamPermissionsSettings() {
Expand Down Expand Up @@ -380,6 +392,19 @@ public UnaryCallSettings.Builder<SetIamPolicyNodeGroupRequest, Policy> setIamPol
return getStubSettingsBuilder().setNodeTemplateOperationSettings();
}

/** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */
public UnaryCallSettings.Builder<SimulateMaintenanceEventNodeGroupRequest, Operation>
simulateMaintenanceEventSettings() {
return getStubSettingsBuilder().simulateMaintenanceEventSettings();
}

/** Returns the builder for the settings used for calls to simulateMaintenanceEvent. */
public OperationCallSettings.Builder<
SimulateMaintenanceEventNodeGroupRequest, Operation, Operation>
simulateMaintenanceEventOperationSettings() {
return getStubSettingsBuilder().simulateMaintenanceEventOperationSettings();
}

/** Returns the builder for the settings used for calls to testIamPermissions. */
public UnaryCallSettings.Builder<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse>
testIamPermissionsSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,9 @@
"SetNodeTemplate": {
"methods": ["setNodeTemplateAsync", "setNodeTemplateAsync", "setNodeTemplateOperationCallable", "setNodeTemplateCallable"]
},
"SimulateMaintenanceEvent": {
"methods": ["simulateMaintenanceEventAsync", "simulateMaintenanceEventAsync", "simulateMaintenanceEventOperationCallable", "simulateMaintenanceEventCallable"]
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"]
}
Expand Down
Loading