Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

fix: migrate to grpc_service_config #202

Merged
merged 2 commits into from Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>7.0.0</version>
<version>8.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Expand Up @@ -60,7 +60,7 @@
* <code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* alertPolicyServiceClient.deleteAlertPolicy(name);
* AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
* }
* </code>
* </pre>
Expand Down Expand Up @@ -169,100 +169,6 @@ public AlertPolicyServiceStub getStub() {
return stub;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* alertPolicyServiceClient.deleteAlertPolicy(name);
* }
* </code></pre>
*
* @param name Required. The alerting policy to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
* <p>For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteAlertPolicy(AlertPolicyName name) {
DeleteAlertPolicyRequest request =
DeleteAlertPolicyRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
deleteAlertPolicy(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* alertPolicyServiceClient.deleteAlertPolicy(name.toString());
* }
* </code></pre>
*
* @param name Required. The alerting policy to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
* <p>For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteAlertPolicy(String name) {
DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder().setName(name).build();
deleteAlertPolicy(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
* .setName(name.toString())
* .build();
* alertPolicyServiceClient.deleteAlertPolicy(request);
* }
* </code></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
*/
public final void deleteAlertPolicy(DeleteAlertPolicyRequest request) {
deleteAlertPolicyCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Void&gt; future = alertPolicyServiceClient.deleteAlertPolicyCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<DeleteAlertPolicyRequest, Empty> deleteAlertPolicyCallable() {
return stub.deleteAlertPolicyCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists the existing alerting policies for the project.
Expand Down Expand Up @@ -608,6 +514,100 @@ public final UnaryCallable<CreateAlertPolicyRequest, AlertPolicy> createAlertPol
return stub.createAlertPolicyCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* alertPolicyServiceClient.deleteAlertPolicy(name);
* }
* </code></pre>
*
* @param name Required. The alerting policy to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
* <p>For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteAlertPolicy(AlertPolicyName name) {
DeleteAlertPolicyRequest request =
DeleteAlertPolicyRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
deleteAlertPolicy(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* alertPolicyServiceClient.deleteAlertPolicy(name.toString());
* }
* </code></pre>
*
* @param name Required. The alerting policy to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
* <p>For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteAlertPolicy(String name) {
DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder().setName(name).build();
deleteAlertPolicy(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
* .setName(name.toString())
* .build();
* alertPolicyServiceClient.deleteAlertPolicy(request);
* }
* </code></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
*/
public final void deleteAlertPolicy(DeleteAlertPolicyRequest request) {
deleteAlertPolicyCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes an alerting policy.
*
* <p>Sample code:
*
* <pre><code>
* try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
* AlertPolicyName name = AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
* DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
* .setName(name.toString())
* .build();
* ApiFuture&lt;Void&gt; future = alertPolicyServiceClient.deleteAlertPolicyCallable().futureCall(request);
* // Do something
* future.get();
* }
* </code></pre>
*/
public final UnaryCallable<DeleteAlertPolicyRequest, Empty> deleteAlertPolicyCallable() {
return stub.deleteAlertPolicyCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Updates an alerting policy. You can either replace the entire policy with a new one or replace
Expand Down
Expand Up @@ -56,16 +56,16 @@
* <p>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.
*
* <p>For example, to set the total timeout of deleteAlertPolicy to 30 seconds:
* <p>For example, to set the total timeout of getAlertPolicy to 30 seconds:
*
* <pre>
* <code>
* AlertPolicyServiceSettings.Builder alertPolicyServiceSettingsBuilder =
* AlertPolicyServiceSettings.newBuilder();
* alertPolicyServiceSettingsBuilder
* .deleteAlertPolicySettings()
* .getAlertPolicySettings()
* .setRetrySettings(
* alertPolicyServiceSettingsBuilder.deleteAlertPolicySettings().getRetrySettings().toBuilder()
* alertPolicyServiceSettingsBuilder.getAlertPolicySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AlertPolicyServiceSettings alertPolicyServiceSettings = alertPolicyServiceSettingsBuilder.build();
Expand All @@ -74,11 +74,6 @@
*/
@Generated("by gapic-generator")
public class AlertPolicyServiceSettings extends ClientSettings<AlertPolicyServiceSettings> {
/** Returns the object with the settings used for calls to deleteAlertPolicy. */
public UnaryCallSettings<DeleteAlertPolicyRequest, Empty> deleteAlertPolicySettings() {
return ((AlertPolicyServiceStubSettings) getStubSettings()).deleteAlertPolicySettings();
}

/** Returns the object with the settings used for calls to listAlertPolicies. */
public PagedCallSettings<
ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse>
Expand All @@ -96,6 +91,11 @@ public UnaryCallSettings<CreateAlertPolicyRequest, AlertPolicy> createAlertPolic
return ((AlertPolicyServiceStubSettings) getStubSettings()).createAlertPolicySettings();
}

/** Returns the object with the settings used for calls to deleteAlertPolicy. */
public UnaryCallSettings<DeleteAlertPolicyRequest, Empty> deleteAlertPolicySettings() {
return ((AlertPolicyServiceStubSettings) getStubSettings()).deleteAlertPolicySettings();
}

/** Returns the object with the settings used for calls to updateAlertPolicy. */
public UnaryCallSettings<UpdateAlertPolicyRequest, AlertPolicy> updateAlertPolicySettings() {
return ((AlertPolicyServiceStubSettings) getStubSettings()).updateAlertPolicySettings();
Expand Down Expand Up @@ -198,11 +198,6 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to deleteAlertPolicy. */
public UnaryCallSettings.Builder<DeleteAlertPolicyRequest, Empty> deleteAlertPolicySettings() {
return getStubSettingsBuilder().deleteAlertPolicySettings();
}

/** Returns the builder for the settings used for calls to listAlertPolicies. */
public PagedCallSettings.Builder<
ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse>
Expand All @@ -221,6 +216,11 @@ public UnaryCallSettings.Builder<GetAlertPolicyRequest, AlertPolicy> getAlertPol
return getStubSettingsBuilder().createAlertPolicySettings();
}

/** Returns the builder for the settings used for calls to deleteAlertPolicy. */
public UnaryCallSettings.Builder<DeleteAlertPolicyRequest, Empty> deleteAlertPolicySettings() {
return getStubSettingsBuilder().deleteAlertPolicySettings();
}

/** Returns the builder for the settings used for calls to updateAlertPolicy. */
public UnaryCallSettings.Builder<UpdateAlertPolicyRequest, AlertPolicy>
updateAlertPolicySettings() {
Expand Down