Skip to content

Commit f76206d

Browse files
feat: add CmekSettings options (#89)
* [CHANGE ME] Re-generated to pick up changes in the API or client library generator. * allow proto interface changes Co-authored-by: Jeff Ching <[email protected]>
1 parent dee31b3 commit f76206d

File tree

73 files changed

+6480
-868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+6480
-868
lines changed

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
import com.google.cloud.logging.v2.stub.ConfigServiceV2Stub;
2929
import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
3030
import com.google.common.util.concurrent.MoreExecutors;
31+
import com.google.logging.v2.CmekSettings;
3132
import com.google.logging.v2.CreateExclusionRequest;
3233
import com.google.logging.v2.CreateSinkRequest;
3334
import com.google.logging.v2.DeleteExclusionRequest;
3435
import com.google.logging.v2.DeleteSinkRequest;
3536
import com.google.logging.v2.ExclusionName;
37+
import com.google.logging.v2.GetCmekSettingsRequest;
3638
import com.google.logging.v2.GetExclusionRequest;
3739
import com.google.logging.v2.GetSinkRequest;
3840
import com.google.logging.v2.ListExclusionsRequest;
@@ -43,6 +45,7 @@
4345
import com.google.logging.v2.LogSink;
4446
import com.google.logging.v2.ParentName;
4547
import com.google.logging.v2.SinkName;
48+
import com.google.logging.v2.UpdateCmekSettingsRequest;
4649
import com.google.logging.v2.UpdateExclusionRequest;
4750
import com.google.logging.v2.UpdateSinkRequest;
4851
import com.google.protobuf.Empty;
@@ -1435,6 +1438,118 @@ public final UnaryCallable<DeleteExclusionRequest, Empty> deleteExclusionCallabl
14351438
return stub.deleteExclusionCallable();
14361439
}
14371440

1441+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1442+
/**
1443+
* Gets the Logs Router CMEK settings for the given resource.
1444+
*
1445+
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
1446+
* configured, it applies to all projects and folders in the GCP organization.
1447+
*
1448+
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
1449+
* information.
1450+
*
1451+
* <p>Sample code:
1452+
*
1453+
* <pre><code>
1454+
* try (ConfigClient configClient = ConfigClient.create()) {
1455+
* GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().build();
1456+
* CmekSettings response = configClient.getCmekSettings(request);
1457+
* }
1458+
* </code></pre>
1459+
*
1460+
* @param request The request object containing all of the parameters for the API call.
1461+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1462+
*/
1463+
public final CmekSettings getCmekSettings(GetCmekSettingsRequest request) {
1464+
return getCmekSettingsCallable().call(request);
1465+
}
1466+
1467+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1468+
/**
1469+
* Gets the Logs Router CMEK settings for the given resource.
1470+
*
1471+
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
1472+
* configured, it applies to all projects and folders in the GCP organization.
1473+
*
1474+
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
1475+
* information.
1476+
*
1477+
* <p>Sample code:
1478+
*
1479+
* <pre><code>
1480+
* try (ConfigClient configClient = ConfigClient.create()) {
1481+
* GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().build();
1482+
* ApiFuture&lt;CmekSettings&gt; future = configClient.getCmekSettingsCallable().futureCall(request);
1483+
* // Do something
1484+
* CmekSettings response = future.get();
1485+
* }
1486+
* </code></pre>
1487+
*/
1488+
public final UnaryCallable<GetCmekSettingsRequest, CmekSettings> getCmekSettingsCallable() {
1489+
return stub.getCmekSettingsCallable();
1490+
}
1491+
1492+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1493+
/**
1494+
* Updates the Logs Router CMEK settings for the given resource.
1495+
*
1496+
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
1497+
* configured, it applies to all projects and folders in the GCP organization.
1498+
*
1499+
* <p>[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1)
1500+
* `kms_key_name` is invalid, or 2) the associated service account does not have the required
1501+
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key
1502+
* is disabled.
1503+
*
1504+
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
1505+
* information.
1506+
*
1507+
* <p>Sample code:
1508+
*
1509+
* <pre><code>
1510+
* try (ConfigClient configClient = ConfigClient.create()) {
1511+
* UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder().build();
1512+
* CmekSettings response = configClient.updateCmekSettings(request);
1513+
* }
1514+
* </code></pre>
1515+
*
1516+
* @param request The request object containing all of the parameters for the API call.
1517+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1518+
*/
1519+
public final CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request) {
1520+
return updateCmekSettingsCallable().call(request);
1521+
}
1522+
1523+
// AUTO-GENERATED DOCUMENTATION AND METHOD
1524+
/**
1525+
* Updates the Logs Router CMEK settings for the given resource.
1526+
*
1527+
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
1528+
* configured, it applies to all projects and folders in the GCP organization.
1529+
*
1530+
* <p>[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1)
1531+
* `kms_key_name` is invalid, or 2) the associated service account does not have the required
1532+
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key
1533+
* is disabled.
1534+
*
1535+
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
1536+
* information.
1537+
*
1538+
* <p>Sample code:
1539+
*
1540+
* <pre><code>
1541+
* try (ConfigClient configClient = ConfigClient.create()) {
1542+
* UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder().build();
1543+
* ApiFuture&lt;CmekSettings&gt; future = configClient.updateCmekSettingsCallable().futureCall(request);
1544+
* // Do something
1545+
* CmekSettings response = future.get();
1546+
* }
1547+
* </code></pre>
1548+
*/
1549+
public final UnaryCallable<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsCallable() {
1550+
return stub.updateCmekSettingsCallable();
1551+
}
1552+
14381553
@Override
14391554
public final void close() {
14401555
stub.close();

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigSettings.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
import com.google.api.gax.rpc.TransportChannelProvider;
3131
import com.google.api.gax.rpc.UnaryCallSettings;
3232
import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
33+
import com.google.logging.v2.CmekSettings;
3334
import com.google.logging.v2.CreateExclusionRequest;
3435
import com.google.logging.v2.CreateSinkRequest;
3536
import com.google.logging.v2.DeleteExclusionRequest;
3637
import com.google.logging.v2.DeleteSinkRequest;
38+
import com.google.logging.v2.GetCmekSettingsRequest;
3739
import com.google.logging.v2.GetExclusionRequest;
3840
import com.google.logging.v2.GetSinkRequest;
3941
import com.google.logging.v2.ListExclusionsRequest;
@@ -42,6 +44,7 @@
4244
import com.google.logging.v2.ListSinksResponse;
4345
import com.google.logging.v2.LogExclusion;
4446
import com.google.logging.v2.LogSink;
47+
import com.google.logging.v2.UpdateCmekSettingsRequest;
4548
import com.google.logging.v2.UpdateExclusionRequest;
4649
import com.google.logging.v2.UpdateSinkRequest;
4750
import com.google.protobuf.Empty;
@@ -132,6 +135,16 @@ public UnaryCallSettings<DeleteExclusionRequest, Empty> deleteExclusionSettings(
132135
return ((ConfigServiceV2StubSettings) getStubSettings()).deleteExclusionSettings();
133136
}
134137

138+
/** Returns the object with the settings used for calls to getCmekSettings. */
139+
public UnaryCallSettings<GetCmekSettingsRequest, CmekSettings> getCmekSettingsSettings() {
140+
return ((ConfigServiceV2StubSettings) getStubSettings()).getCmekSettingsSettings();
141+
}
142+
143+
/** Returns the object with the settings used for calls to updateCmekSettings. */
144+
public UnaryCallSettings<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsSettings() {
145+
return ((ConfigServiceV2StubSettings) getStubSettings()).updateCmekSettingsSettings();
146+
}
147+
135148
public static final ConfigSettings create(ConfigServiceV2StubSettings stub) throws IOException {
136149
return new ConfigSettings.Builder(stub.toBuilder()).build();
137150
}
@@ -283,6 +296,18 @@ public UnaryCallSettings.Builder<DeleteExclusionRequest, Empty> deleteExclusionS
283296
return getStubSettingsBuilder().deleteExclusionSettings();
284297
}
285298

299+
/** Returns the builder for the settings used for calls to getCmekSettings. */
300+
public UnaryCallSettings.Builder<GetCmekSettingsRequest, CmekSettings>
301+
getCmekSettingsSettings() {
302+
return getStubSettingsBuilder().getCmekSettingsSettings();
303+
}
304+
305+
/** Returns the builder for the settings used for calls to updateCmekSettings. */
306+
public UnaryCallSettings.Builder<UpdateCmekSettingsRequest, CmekSettings>
307+
updateCmekSettingsSettings() {
308+
return getStubSettingsBuilder().updateCmekSettingsSettings();
309+
}
310+
286311
@Override
287312
public ConfigSettings build() throws IOException {
288313
return new ConfigSettings(this);

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/LoggingClient.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ public LoggingServiceV2Stub getStub() {
170170
// AUTO-GENERATED DOCUMENTATION AND METHOD
171171
/**
172172
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
173-
* written shortly before the delete operation might not be deleted.
173+
* written shortly before the delete operation might not be deleted. Entries received after the
174+
* delete operation with a timestamp before the operation will be deleted.
174175
*
175176
* <p>Sample code:
176177
*
@@ -200,7 +201,8 @@ public final void deleteLog(LogName logName) {
200201
// AUTO-GENERATED DOCUMENTATION AND METHOD
201202
/**
202203
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
203-
* written shortly before the delete operation might not be deleted.
204+
* written shortly before the delete operation might not be deleted. Entries received after the
205+
* delete operation with a timestamp before the operation will be deleted.
204206
*
205207
* <p>Sample code:
206208
*
@@ -227,7 +229,8 @@ public final void deleteLog(String logName) {
227229
// AUTO-GENERATED DOCUMENTATION AND METHOD
228230
/**
229231
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
230-
* written shortly before the delete operation might not be deleted.
232+
* written shortly before the delete operation might not be deleted. Entries received after the
233+
* delete operation with a timestamp before the operation will be deleted.
231234
*
232235
* <p>Sample code:
233236
*
@@ -251,7 +254,8 @@ public final void deleteLog(DeleteLogRequest request) {
251254
// AUTO-GENERATED DOCUMENTATION AND METHOD
252255
/**
253256
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
254-
* written shortly before the delete operation might not be deleted.
257+
* written shortly before the delete operation might not be deleted. Entries received after the
258+
* delete operation with a timestamp before the operation will be deleted.
255259
*
256260
* <p>Sample code:
257261
*
@@ -494,7 +498,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
494498
* "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
495499
* <p>Projects listed in the `project_ids` field are added to this list.
496500
* @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
497-
* Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are
501+
* Queries](/logging/docs/view/advanced-queries). Only log entries that match the filter are
498502
* returned. An empty filter matches all log entries in the resources listed in
499503
* `resource_names`. Referencing a parent resource that is not listed in `resource_names` will
500504
* cause the filter to return no results. The maximum length of the filter is 20000

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
307307
* }
308308
* </code></pre>
309309
*
310-
* @param metricName The resource name of the desired metric:
310+
* @param metricName Required. The resource name of the desired metric:
311311
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
312312
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
313313
*/
@@ -332,7 +332,7 @@ public final LogMetric getLogMetric(MetricName metricName) {
332332
* }
333333
* </code></pre>
334334
*
335-
* @param metricName The resource name of the desired metric:
335+
* @param metricName Required. The resource name of the desired metric:
336336
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
337337
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
338338
*/
@@ -401,10 +401,11 @@ public final UnaryCallable<GetLogMetricRequest, LogMetric> getLogMetricCallable(
401401
* }
402402
* </code></pre>
403403
*
404-
* @param parent The resource name of the project in which to create the metric:
404+
* @param parent Required. The resource name of the project in which to create the metric:
405405
* <p>"projects/[PROJECT_ID]"
406406
* <p>The new metric must be provided in the request.
407-
* @param metric The new logs-based metric, which must not have an identifier that already exists.
407+
* @param metric Required. The new logs-based metric, which must not have an identifier that
408+
* already exists.
408409
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
409410
*/
410411
public final LogMetric createLogMetric(ParentName parent, LogMetric metric) {
@@ -430,10 +431,11 @@ public final LogMetric createLogMetric(ParentName parent, LogMetric metric) {
430431
* }
431432
* </code></pre>
432433
*
433-
* @param parent The resource name of the project in which to create the metric:
434+
* @param parent Required. The resource name of the project in which to create the metric:
434435
* <p>"projects/[PROJECT_ID]"
435436
* <p>The new metric must be provided in the request.
436-
* @param metric The new logs-based metric, which must not have an identifier that already exists.
437+
* @param metric Required. The new logs-based metric, which must not have an identifier that
438+
* already exists.
437439
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
438440
*/
439441
public final LogMetric createLogMetric(String parent, LogMetric metric) {
@@ -505,12 +507,12 @@ public final UnaryCallable<CreateLogMetricRequest, LogMetric> createLogMetricCal
505507
* }
506508
* </code></pre>
507509
*
508-
* @param metricName The resource name of the metric to update:
510+
* @param metricName Required. The resource name of the metric to update:
509511
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
510512
* <p>The updated metric must be provided in the request and it's `name` field must be the
511513
* same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
512514
* created.
513-
* @param metric The updated metric.
515+
* @param metric Required. The updated metric.
514516
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
515517
*/
516518
public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric) {
@@ -536,12 +538,12 @@ public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric)
536538
* }
537539
* </code></pre>
538540
*
539-
* @param metricName The resource name of the metric to update:
541+
* @param metricName Required. The resource name of the metric to update:
540542
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
541543
* <p>The updated metric must be provided in the request and it's `name` field must be the
542544
* same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
543545
* created.
544-
* @param metric The updated metric.
546+
* @param metric Required. The updated metric.
545547
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
546548
*/
547549
public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
@@ -612,7 +614,7 @@ public final UnaryCallable<UpdateLogMetricRequest, LogMetric> updateLogMetricCal
612614
* }
613615
* </code></pre>
614616
*
615-
* @param metricName The resource name of the metric to delete:
617+
* @param metricName Required. The resource name of the metric to delete:
616618
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
617619
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
618620
*/
@@ -637,7 +639,7 @@ public final void deleteLogMetric(MetricName metricName) {
637639
* }
638640
* </code></pre>
639641
*
640-
* @param metricName The resource name of the metric to delete:
642+
* @param metricName Required. The resource name of the metric to delete:
641643
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
642644
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
643645
*/

google-cloud-logging/src/main/java/com/google/cloud/logging/v2/stub/ConfigServiceV2Stub.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
import com.google.api.core.BetaApi;
2222
import com.google.api.gax.core.BackgroundResource;
2323
import com.google.api.gax.rpc.UnaryCallable;
24+
import com.google.logging.v2.CmekSettings;
2425
import com.google.logging.v2.CreateExclusionRequest;
2526
import com.google.logging.v2.CreateSinkRequest;
2627
import com.google.logging.v2.DeleteExclusionRequest;
2728
import com.google.logging.v2.DeleteSinkRequest;
29+
import com.google.logging.v2.GetCmekSettingsRequest;
2830
import com.google.logging.v2.GetExclusionRequest;
2931
import com.google.logging.v2.GetSinkRequest;
3032
import com.google.logging.v2.ListExclusionsRequest;
@@ -33,6 +35,7 @@
3335
import com.google.logging.v2.ListSinksResponse;
3436
import com.google.logging.v2.LogExclusion;
3537
import com.google.logging.v2.LogSink;
38+
import com.google.logging.v2.UpdateCmekSettingsRequest;
3639
import com.google.logging.v2.UpdateExclusionRequest;
3740
import com.google.logging.v2.UpdateSinkRequest;
3841
import com.google.protobuf.Empty;
@@ -97,6 +100,14 @@ public UnaryCallable<DeleteExclusionRequest, Empty> deleteExclusionCallable() {
97100
throw new UnsupportedOperationException("Not implemented: deleteExclusionCallable()");
98101
}
99102

103+
public UnaryCallable<GetCmekSettingsRequest, CmekSettings> getCmekSettingsCallable() {
104+
throw new UnsupportedOperationException("Not implemented: getCmekSettingsCallable()");
105+
}
106+
107+
public UnaryCallable<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsCallable() {
108+
throw new UnsupportedOperationException("Not implemented: updateCmekSettingsCallable()");
109+
}
110+
100111
@Override
101112
public abstract void close();
102113
}

0 commit comments

Comments
 (0)