Skip to content
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

feat: [advisorynotifications] add new RPCs GetSettings, UpdateSettings and new messages Settings, NotificationSettings, GetSettingsRequest, UpdateSettingsRequest #9882

Merged
merged 2 commits into from
Sep 25, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java-advisorynotifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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>26.22.0</version>
<version>26.23.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-advisorynotifications/java11.html
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-advisorynotifications.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-advisorynotifications/0.12.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-advisorynotifications/0.13.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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,203 @@ public final UnaryCallable<GetNotificationRequest, Notification> getNotification
return stub.getNotificationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* SettingsName name = SettingsName.of("[ORGANIZATION]", "[LOCATION]");
* Settings response = advisoryNotificationsServiceClient.getSettings(name);
* }
* }</pre>
*
* @param name Required. The resource name of the settings to retrieve. Format:
* organizations/{organization}/locations/{location}/settings.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings getSettings(SettingsName name) {
GetSettingsRequest request =
GetSettingsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getSettings(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* String name = SettingsName.of("[ORGANIZATION]", "[LOCATION]").toString();
* Settings response = advisoryNotificationsServiceClient.getSettings(name);
* }
* }</pre>
*
* @param name Required. The resource name of the settings to retrieve. Format:
* organizations/{organization}/locations/{location}/settings.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings getSettings(String name) {
GetSettingsRequest request = GetSettingsRequest.newBuilder().setName(name).build();
return getSettings(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* GetSettingsRequest request =
* GetSettingsRequest.newBuilder()
* .setName(SettingsName.of("[ORGANIZATION]", "[LOCATION]").toString())
* .build();
* Settings response = advisoryNotificationsServiceClient.getSettings(request);
* }
* }</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 Settings getSettings(GetSettingsRequest request) {
return getSettingsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Get notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* GetSettingsRequest request =
* GetSettingsRequest.newBuilder()
* .setName(SettingsName.of("[ORGANIZATION]", "[LOCATION]").toString())
* .build();
* ApiFuture<Settings> future =
* advisoryNotificationsServiceClient.getSettingsCallable().futureCall(request);
* // Do something.
* Settings response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetSettingsRequest, Settings> getSettingsCallable() {
return stub.getSettingsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* Settings settings = Settings.newBuilder().build();
* Settings response = advisoryNotificationsServiceClient.updateSettings(settings);
* }
* }</pre>
*
* @param settings Required. New settings.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings updateSettings(Settings settings) {
UpdateSettingsRequest request =
UpdateSettingsRequest.newBuilder().setSettings(settings).build();
return updateSettings(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* UpdateSettingsRequest request =
* UpdateSettingsRequest.newBuilder().setSettings(Settings.newBuilder().build()).build();
* Settings response = advisoryNotificationsServiceClient.updateSettings(request);
* }
* }</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 Settings updateSettings(UpdateSettingsRequest request) {
return updateSettingsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Update notification settings.
*
* <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 (AdvisoryNotificationsServiceClient advisoryNotificationsServiceClient =
* AdvisoryNotificationsServiceClient.create()) {
* UpdateSettingsRequest request =
* UpdateSettingsRequest.newBuilder().setSettings(Settings.newBuilder().build()).build();
* ApiFuture<Settings> future =
* advisoryNotificationsServiceClient.updateSettingsCallable().futureCall(request);
* // Do something.
* Settings response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<UpdateSettingsRequest, Settings> updateSettingsCallable() {
return stub.updateSettingsCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ public UnaryCallSettings<GetNotificationRequest, Notification> getNotificationSe
return ((AdvisoryNotificationsServiceStubSettings) getStubSettings()).getNotificationSettings();
}

/** Returns the object with the settings used for calls to getSettings. */
public UnaryCallSettings<GetSettingsRequest, Settings> getSettingsSettings() {
return ((AdvisoryNotificationsServiceStubSettings) getStubSettings()).getSettingsSettings();
}

/** Returns the object with the settings used for calls to updateSettings. */
public UnaryCallSettings<UpdateSettingsRequest, Settings> updateSettingsSettings() {
return ((AdvisoryNotificationsServiceStubSettings) getStubSettings()).updateSettingsSettings();
}

public static final AdvisoryNotificationsServiceSettings create(
AdvisoryNotificationsServiceStubSettings stub) throws IOException {
return new AdvisoryNotificationsServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -220,6 +230,16 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().getNotificationSettings();
}

/** Returns the builder for the settings used for calls to getSettings. */
public UnaryCallSettings.Builder<GetSettingsRequest, Settings> getSettingsSettings() {
return getStubSettingsBuilder().getSettingsSettings();
}

/** Returns the builder for the settings used for calls to updateSettings. */
public UnaryCallSettings.Builder<UpdateSettingsRequest, Settings> updateSettingsSettings() {
return getStubSettingsBuilder().updateSettingsSettings();
}

@Override
public AdvisoryNotificationsServiceSettings build() throws IOException {
return new AdvisoryNotificationsServiceSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
"GetNotification": {
"methods": ["getNotification", "getNotification", "getNotification", "getNotificationCallable"]
},
"GetSettings": {
"methods": ["getSettings", "getSettings", "getSettings", "getSettingsCallable"]
},
"ListNotifications": {
"methods": ["listNotifications", "listNotifications", "listNotifications", "listNotificationsPagedCallable", "listNotificationsCallable"]
},
"UpdateSettings": {
"methods": ["updateSettings", "updateSettings", "updateSettingsCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.advisorynotifications.v1.GetNotificationRequest;
import com.google.cloud.advisorynotifications.v1.GetSettingsRequest;
import com.google.cloud.advisorynotifications.v1.ListNotificationsRequest;
import com.google.cloud.advisorynotifications.v1.ListNotificationsResponse;
import com.google.cloud.advisorynotifications.v1.Notification;
import com.google.cloud.advisorynotifications.v1.Settings;
import com.google.cloud.advisorynotifications.v1.UpdateSettingsRequest;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
Expand All @@ -49,6 +52,14 @@ public UnaryCallable<GetNotificationRequest, Notification> getNotificationCallab
throw new UnsupportedOperationException("Not implemented: getNotificationCallable()");
}

public UnaryCallable<GetSettingsRequest, Settings> getSettingsCallable() {
throw new UnsupportedOperationException("Not implemented: getSettingsCallable()");
}

public UnaryCallable<UpdateSettingsRequest, Settings> updateSettingsCallable() {
throw new UnsupportedOperationException("Not implemented: updateSettingsCallable()");
}

@Override
public abstract void close();
}
Loading