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: add CmekSettings options #89

Merged
merged 2 commits into from Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -28,11 +28,13 @@
import com.google.cloud.logging.v2.stub.ConfigServiceV2Stub;
import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.logging.v2.CmekSettings;
import com.google.logging.v2.CreateExclusionRequest;
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteExclusionRequest;
import com.google.logging.v2.DeleteSinkRequest;
import com.google.logging.v2.ExclusionName;
import com.google.logging.v2.GetCmekSettingsRequest;
import com.google.logging.v2.GetExclusionRequest;
import com.google.logging.v2.GetSinkRequest;
import com.google.logging.v2.ListExclusionsRequest;
Expand All @@ -43,6 +45,7 @@
import com.google.logging.v2.LogSink;
import com.google.logging.v2.ParentName;
import com.google.logging.v2.SinkName;
import com.google.logging.v2.UpdateCmekSettingsRequest;
import com.google.logging.v2.UpdateExclusionRequest;
import com.google.logging.v2.UpdateSinkRequest;
import com.google.protobuf.Empty;
Expand Down Expand Up @@ -1435,6 +1438,118 @@ public final UnaryCallable<DeleteExclusionRequest, Empty> deleteExclusionCallabl
return stub.deleteExclusionCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the Logs Router CMEK settings for the given resource.
*
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
* configured, it applies to all projects and folders in the GCP organization.
*
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
* information.
*
* <p>Sample code:
*
* <pre><code>
* try (ConfigClient configClient = ConfigClient.create()) {
* GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().build();
* CmekSettings response = configClient.getCmekSettings(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 CmekSettings getCmekSettings(GetCmekSettingsRequest request) {
return getCmekSettingsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the Logs Router CMEK settings for the given resource.
*
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
* configured, it applies to all projects and folders in the GCP organization.
*
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
* information.
*
* <p>Sample code:
*
* <pre><code>
* try (ConfigClient configClient = ConfigClient.create()) {
* GetCmekSettingsRequest request = GetCmekSettingsRequest.newBuilder().build();
* ApiFuture&lt;CmekSettings&gt; future = configClient.getCmekSettingsCallable().futureCall(request);
* // Do something
* CmekSettings response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<GetCmekSettingsRequest, CmekSettings> getCmekSettingsCallable() {
return stub.getCmekSettingsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Updates the Logs Router CMEK settings for the given resource.
*
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
* configured, it applies to all projects and folders in the GCP organization.
*
* <p>[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1)
* `kms_key_name` is invalid, or 2) the associated service account does not have the required
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key
* is disabled.
*
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
* information.
*
* <p>Sample code:
*
* <pre><code>
* try (ConfigClient configClient = ConfigClient.create()) {
* UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder().build();
* CmekSettings response = configClient.updateCmekSettings(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 CmekSettings updateCmekSettings(UpdateCmekSettingsRequest request) {
return updateCmekSettingsCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Updates the Logs Router CMEK settings for the given resource.
*
* <p>Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once
* configured, it applies to all projects and folders in the GCP organization.
*
* <p>[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1)
* `kms_key_name` is invalid, or 2) the associated service account does not have the required
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key
* is disabled.
*
* <p>See [Enabling CMEK for Logs Router](/logging/docs/routing/managed-encryption) for more
* information.
*
* <p>Sample code:
*
* <pre><code>
* try (ConfigClient configClient = ConfigClient.create()) {
* UpdateCmekSettingsRequest request = UpdateCmekSettingsRequest.newBuilder().build();
* ApiFuture&lt;CmekSettings&gt; future = configClient.updateCmekSettingsCallable().futureCall(request);
* // Do something
* CmekSettings response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsCallable() {
return stub.updateCmekSettingsCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Expand Up @@ -30,10 +30,12 @@
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.logging.v2.stub.ConfigServiceV2StubSettings;
import com.google.logging.v2.CmekSettings;
import com.google.logging.v2.CreateExclusionRequest;
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteExclusionRequest;
import com.google.logging.v2.DeleteSinkRequest;
import com.google.logging.v2.GetCmekSettingsRequest;
import com.google.logging.v2.GetExclusionRequest;
import com.google.logging.v2.GetSinkRequest;
import com.google.logging.v2.ListExclusionsRequest;
Expand All @@ -42,6 +44,7 @@
import com.google.logging.v2.ListSinksResponse;
import com.google.logging.v2.LogExclusion;
import com.google.logging.v2.LogSink;
import com.google.logging.v2.UpdateCmekSettingsRequest;
import com.google.logging.v2.UpdateExclusionRequest;
import com.google.logging.v2.UpdateSinkRequest;
import com.google.protobuf.Empty;
Expand Down Expand Up @@ -132,6 +135,16 @@ public UnaryCallSettings<DeleteExclusionRequest, Empty> deleteExclusionSettings(
return ((ConfigServiceV2StubSettings) getStubSettings()).deleteExclusionSettings();
}

/** Returns the object with the settings used for calls to getCmekSettings. */
public UnaryCallSettings<GetCmekSettingsRequest, CmekSettings> getCmekSettingsSettings() {
return ((ConfigServiceV2StubSettings) getStubSettings()).getCmekSettingsSettings();
}

/** Returns the object with the settings used for calls to updateCmekSettings. */
public UnaryCallSettings<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsSettings() {
return ((ConfigServiceV2StubSettings) getStubSettings()).updateCmekSettingsSettings();
}

public static final ConfigSettings create(ConfigServiceV2StubSettings stub) throws IOException {
return new ConfigSettings.Builder(stub.toBuilder()).build();
}
Expand Down Expand Up @@ -283,6 +296,18 @@ public UnaryCallSettings.Builder<DeleteExclusionRequest, Empty> deleteExclusionS
return getStubSettingsBuilder().deleteExclusionSettings();
}

/** Returns the builder for the settings used for calls to getCmekSettings. */
public UnaryCallSettings.Builder<GetCmekSettingsRequest, CmekSettings>
getCmekSettingsSettings() {
return getStubSettingsBuilder().getCmekSettingsSettings();
}

/** Returns the builder for the settings used for calls to updateCmekSettings. */
public UnaryCallSettings.Builder<UpdateCmekSettingsRequest, CmekSettings>
updateCmekSettingsSettings() {
return getStubSettingsBuilder().updateCmekSettingsSettings();
}

@Override
public ConfigSettings build() throws IOException {
return new ConfigSettings(this);
Expand Down
Expand Up @@ -170,7 +170,8 @@ public LoggingServiceV2Stub getStub() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
* written shortly before the delete operation might not be deleted.
* written shortly before the delete operation might not be deleted. Entries received after the
* delete operation with a timestamp before the operation will be deleted.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -200,7 +201,8 @@ public final void deleteLog(LogName logName) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
* written shortly before the delete operation might not be deleted.
* written shortly before the delete operation might not be deleted. Entries received after the
* delete operation with a timestamp before the operation will be deleted.
*
* <p>Sample code:
*
Expand All @@ -227,7 +229,8 @@ public final void deleteLog(String logName) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
* written shortly before the delete operation might not be deleted.
* written shortly before the delete operation might not be deleted. Entries received after the
* delete operation with a timestamp before the operation will be deleted.
*
* <p>Sample code:
*
Expand All @@ -251,7 +254,8 @@ public final void deleteLog(DeleteLogRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
* written shortly before the delete operation might not be deleted.
* written shortly before the delete operation might not be deleted. Entries received after the
* delete operation with a timestamp before the operation will be deleted.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -494,7 +498,7 @@ public final WriteLogEntriesResponse writeLogEntries(WriteLogEntriesRequest requ
* "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
* <p>Projects listed in the `project_ids` field are added to this list.
* @param filter Optional. A filter that chooses which log entries to return. See [Advanced Logs
* Filters](/logging/docs/view/advanced_filters). Only log entries that match the filter are
* Queries](/logging/docs/view/advanced-queries). Only log entries that match the filter are
* returned. An empty filter matches all log entries in the resources listed in
* `resource_names`. Referencing a parent resource that is not listed in `resource_names` will
* cause the filter to return no results. The maximum length of the filter is 20000
Expand Down
Expand Up @@ -307,7 +307,7 @@ public final ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest re
* }
* </code></pre>
*
* @param metricName The resource name of the desired metric:
* @param metricName Required. The resource name of the desired metric:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -332,7 +332,7 @@ public final LogMetric getLogMetric(MetricName metricName) {
* }
* </code></pre>
*
* @param metricName The resource name of the desired metric:
* @param metricName Required. The resource name of the desired metric:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down Expand Up @@ -401,10 +401,11 @@ public final UnaryCallable<GetLogMetricRequest, LogMetric> getLogMetricCallable(
* }
* </code></pre>
*
* @param parent The resource name of the project in which to create the metric:
* @param parent Required. The resource name of the project in which to create the metric:
* <p>"projects/[PROJECT_ID]"
* <p>The new metric must be provided in the request.
* @param metric The new logs-based metric, which must not have an identifier that already exists.
* @param metric Required. The new logs-based metric, which must not have an identifier that
* already exists.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final LogMetric createLogMetric(ParentName parent, LogMetric metric) {
Expand All @@ -430,10 +431,11 @@ public final LogMetric createLogMetric(ParentName parent, LogMetric metric) {
* }
* </code></pre>
*
* @param parent The resource name of the project in which to create the metric:
* @param parent Required. The resource name of the project in which to create the metric:
* <p>"projects/[PROJECT_ID]"
* <p>The new metric must be provided in the request.
* @param metric The new logs-based metric, which must not have an identifier that already exists.
* @param metric Required. The new logs-based metric, which must not have an identifier that
* already exists.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final LogMetric createLogMetric(String parent, LogMetric metric) {
Expand Down Expand Up @@ -505,12 +507,12 @@ public final UnaryCallable<CreateLogMetricRequest, LogMetric> createLogMetricCal
* }
* </code></pre>
*
* @param metricName The resource name of the metric to update:
* @param metricName Required. The resource name of the metric to update:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* <p>The updated metric must be provided in the request and it's `name` field must be the
* same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
* created.
* @param metric The updated metric.
* @param metric Required. The updated metric.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric) {
Expand All @@ -536,12 +538,12 @@ public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric)
* }
* </code></pre>
*
* @param metricName The resource name of the metric to update:
* @param metricName Required. The resource name of the metric to update:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* <p>The updated metric must be provided in the request and it's `name` field must be the
* same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is
* created.
* @param metric The updated metric.
* @param metric Required. The updated metric.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final LogMetric updateLogMetric(String metricName, LogMetric metric) {
Expand Down Expand Up @@ -612,7 +614,7 @@ public final UnaryCallable<UpdateLogMetricRequest, LogMetric> updateLogMetricCal
* }
* </code></pre>
*
* @param metricName The resource name of the metric to delete:
* @param metricName Required. The resource name of the metric to delete:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -637,7 +639,7 @@ public final void deleteLogMetric(MetricName metricName) {
* }
* </code></pre>
*
* @param metricName The resource name of the metric to delete:
* @param metricName Required. The resource name of the metric to delete:
* <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down
Expand Up @@ -21,10 +21,12 @@
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.logging.v2.CmekSettings;
import com.google.logging.v2.CreateExclusionRequest;
import com.google.logging.v2.CreateSinkRequest;
import com.google.logging.v2.DeleteExclusionRequest;
import com.google.logging.v2.DeleteSinkRequest;
import com.google.logging.v2.GetCmekSettingsRequest;
import com.google.logging.v2.GetExclusionRequest;
import com.google.logging.v2.GetSinkRequest;
import com.google.logging.v2.ListExclusionsRequest;
Expand All @@ -33,6 +35,7 @@
import com.google.logging.v2.ListSinksResponse;
import com.google.logging.v2.LogExclusion;
import com.google.logging.v2.LogSink;
import com.google.logging.v2.UpdateCmekSettingsRequest;
import com.google.logging.v2.UpdateExclusionRequest;
import com.google.logging.v2.UpdateSinkRequest;
import com.google.protobuf.Empty;
Expand Down Expand Up @@ -97,6 +100,14 @@ public UnaryCallable<DeleteExclusionRequest, Empty> deleteExclusionCallable() {
throw new UnsupportedOperationException("Not implemented: deleteExclusionCallable()");
}

public UnaryCallable<GetCmekSettingsRequest, CmekSettings> getCmekSettingsCallable() {
throw new UnsupportedOperationException("Not implemented: getCmekSettingsCallable()");
}

public UnaryCallable<UpdateCmekSettingsRequest, CmekSettings> updateCmekSettingsCallable() {
throw new UnsupportedOperationException("Not implemented: updateCmekSettingsCallable()");
}

@Override
public abstract void close();
}