@Generated(value="by GAPIC v0.0.5") @BetaApi public class ConfigClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
LogSink response = configClient.getSink(sinkName);
}
Note: close() needs to be called on the configClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ConfigSettings to create(). For example:
To customize credentials:
ConfigSettings configSettings =
ConfigSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ConfigClient configClient =
ConfigClient.create(configSettings);
To customize the endpoint:
ConfigSettings configSettings =
ConfigSettings.newBuilder().setEndpoint(myEndpoint).build();
ConfigClient configClient =
ConfigClient.create(configSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
ConfigClient(ConfigServiceV2Stub stub) |
protected |
ConfigClient(ConfigSettings settings)
Constructs an instance of ConfigClient, using the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ConfigClient |
create()
Constructs an instance of ConfigClient with default settings.
|
static ConfigClient |
create(ConfigServiceV2Stub stub)
Constructs an instance of ConfigClient, using the given stub for making calls.
|
static ConfigClient |
create(ConfigSettings settings)
Constructs an instance of ConfigClient, using the given settings.
|
com.google.logging.v2.LogExclusion |
createExclusion(com.google.logging.v2.CreateExclusionRequest request)
Creates a new exclusion in a specified parent resource.
|
com.google.logging.v2.LogExclusion |
createExclusion(com.google.logging.v2.ParentNameOneof parent,
com.google.logging.v2.LogExclusion exclusion)
Creates a new exclusion in a specified parent resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.CreateExclusionRequest,com.google.logging.v2.LogExclusion> |
createExclusionCallable()
Creates a new exclusion in a specified parent resource.
|
com.google.logging.v2.LogSink |
createSink(com.google.logging.v2.CreateSinkRequest request)
Creates a sink that exports specified log entries to a destination.
|
com.google.logging.v2.LogSink |
createSink(com.google.logging.v2.ParentNameOneof parent,
com.google.logging.v2.LogSink sink)
Creates a sink that exports specified log entries to a destination.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.CreateSinkRequest,com.google.logging.v2.LogSink> |
createSinkCallable()
Creates a sink that exports specified log entries to a destination.
|
void |
deleteExclusion(com.google.logging.v2.ExclusionNameOneof name)
Deletes an exclusion.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.DeleteExclusionRequest,com.google.protobuf.Empty> |
deleteExclusionCallable()
Deletes an exclusion.
|
void |
deleteSink(com.google.logging.v2.SinkNameOneof sinkName)
Deletes a sink.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.DeleteSinkRequest,com.google.protobuf.Empty> |
deleteSinkCallable()
Deletes a sink.
|
com.google.logging.v2.LogExclusion |
getExclusion(com.google.logging.v2.ExclusionNameOneof name)
Gets the description of an exclusion.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.GetExclusionRequest,com.google.logging.v2.LogExclusion> |
getExclusionCallable()
Gets the description of an exclusion.
|
ConfigSettings |
getSettings() |
com.google.logging.v2.LogSink |
getSink(com.google.logging.v2.SinkNameOneof sinkName)
Gets a sink.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.GetSinkRequest,com.google.logging.v2.LogSink> |
getSinkCallable()
Gets a sink.
|
ConfigServiceV2Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
PagedResponseWrappers.ListExclusionsPagedResponse |
listExclusions(com.google.logging.v2.ListExclusionsRequest request)
Lists all the exclusions in a parent resource.
|
PagedResponseWrappers.ListExclusionsPagedResponse |
listExclusions(com.google.logging.v2.ParentNameOneof parent)
Lists all the exclusions in a parent resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListExclusionsRequest,com.google.logging.v2.ListExclusionsResponse> |
listExclusionsCallable()
Lists all the exclusions in a parent resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListExclusionsRequest,PagedResponseWrappers.ListExclusionsPagedResponse> |
listExclusionsPagedCallable()
Lists all the exclusions in a parent resource.
|
PagedResponseWrappers.ListSinksPagedResponse |
listSinks(com.google.logging.v2.ListSinksRequest request)
Lists sinks.
|
PagedResponseWrappers.ListSinksPagedResponse |
listSinks(com.google.logging.v2.ParentNameOneof parent)
Lists sinks.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListSinksRequest,com.google.logging.v2.ListSinksResponse> |
listSinksCallable()
Lists sinks.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListSinksRequest,PagedResponseWrappers.ListSinksPagedResponse> |
listSinksPagedCallable()
Lists sinks.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.logging.v2.LogExclusion |
updateExclusion(com.google.logging.v2.ExclusionNameOneof name,
com.google.logging.v2.LogExclusion exclusion,
com.google.protobuf.FieldMask updateMask)
Changes one or more properties of an existing exclusion.
|
com.google.logging.v2.LogExclusion |
updateExclusion(com.google.logging.v2.UpdateExclusionRequest request)
Changes one or more properties of an existing exclusion.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.UpdateExclusionRequest,com.google.logging.v2.LogExclusion> |
updateExclusionCallable()
Changes one or more properties of an existing exclusion.
|
com.google.logging.v2.LogSink |
updateSink(com.google.logging.v2.SinkNameOneof sinkName,
com.google.logging.v2.LogSink sink)
Updates a sink.
|
com.google.logging.v2.LogSink |
updateSink(com.google.logging.v2.UpdateSinkRequest request)
Updates a sink.
|
com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.UpdateSinkRequest,com.google.logging.v2.LogSink> |
updateSinkCallable()
Updates a sink.
|
protected ConfigClient(ConfigSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ConfigClient(ConfigServiceV2Stub stub)
public static final ConfigClient create() throws IOException
IOExceptionpublic static final ConfigClient create(ConfigSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ConfigClient create(ConfigServiceV2Stub stub)
public final ConfigSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ConfigServiceV2Stub getStub()
public final PagedResponseWrappers.ListSinksPagedResponse listSinks(com.google.logging.v2.ParentNameOneof parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
for (LogSink element : configClient.listSinks(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent resource whose sinks are to be listed:
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
com.google.api.gax.rpc.ApiException - if the remote call failspublic final PagedResponseWrappers.ListSinksPagedResponse listSinks(com.google.logging.v2.ListSinksRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
for (LogSink element : configClient.listSinks(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListSinksRequest,PagedResponseWrappers.ListSinksPagedResponse> listSinksPagedCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
ApiFuture<ListSinksPagedResponse> future = configClient.listSinksPagedCallable().futureCall(request);
// Do something
for (LogSink element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListSinksRequest,com.google.logging.v2.ListSinksResponse> listSinksCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
while (true) {
ListSinksResponse response = configClient.listSinksCallable().call(request);
for (LogSink element : response.getSinksList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.logging.v2.LogSink getSink(com.google.logging.v2.SinkNameOneof sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
LogSink response = configClient.getSink(sinkName);
}
sinkName - Required. The resource name of the sink:
"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"
Example: `"projects/my-project-id/sinks/my-sink-id"`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.GetSinkRequest,com.google.logging.v2.LogSink> getSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
GetSinkRequest request = GetSinkRequest.newBuilder()
.setSinkNameWithSinkNameOneof(sinkName)
.build();
ApiFuture<LogSink> future = configClient.getSinkCallable().futureCall(request);
// Do something
LogSink response = future.get();
}
public final com.google.logging.v2.LogSink createSink(com.google.logging.v2.ParentNameOneof parent,
com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.createSink(parent, sink);
}
parent - Required. The resource in which to create the sink:
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
sink - Required. The new sink, whose `name` parameter is a sink identifier that is not
already in use.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.logging.v2.LogSink createSink(com.google.logging.v2.CreateSinkRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogSink sink = LogSink.newBuilder().build();
CreateSinkRequest request = CreateSinkRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.setSink(sink)
.build();
LogSink response = configClient.createSink(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.CreateSinkRequest,com.google.logging.v2.LogSink> createSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogSink sink = LogSink.newBuilder().build();
CreateSinkRequest request = CreateSinkRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.setSink(sink)
.build();
ApiFuture<LogSink> future = configClient.createSinkCallable().futureCall(request);
// Do something
LogSink response = future.get();
}
public final com.google.logging.v2.LogSink updateSink(com.google.logging.v2.SinkNameOneof sinkName,
com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.updateSink(sinkName, sink);
}
sinkName - Required. The full resource name of the sink to update, including the parent
resource and the sink identifier:
"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"
Example: `"projects/my-project-id/sinks/my-sink-id"`.
sink - Required. The updated sink, whose name is the same identifier that appears as part
of `sink_name`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.logging.v2.LogSink updateSink(com.google.logging.v2.UpdateSinkRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
LogSink sink = LogSink.newBuilder().build();
UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
.setSinkNameWithSinkNameOneof(sinkName)
.setSink(sink)
.build();
LogSink response = configClient.updateSink(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.UpdateSinkRequest,com.google.logging.v2.LogSink> updateSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
LogSink sink = LogSink.newBuilder().build();
UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
.setSinkNameWithSinkNameOneof(sinkName)
.setSink(sink)
.build();
ApiFuture<LogSink> future = configClient.updateSinkCallable().futureCall(request);
// Do something
LogSink response = future.get();
}
public final void deleteSink(com.google.logging.v2.SinkNameOneof sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
configClient.deleteSink(sinkName);
}
sinkName - Required. The full resource name of the sink to delete, including the parent
resource and the sink identifier:
"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" "folders/[FOLDER_ID]/sinks/[SINK_ID]"
Example: `"projects/my-project-id/sinks/my-sink-id"`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.DeleteSinkRequest,com.google.protobuf.Empty> deleteSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkNameOneof sinkName = SinkNameOneof.from(SinkName.of("[PROJECT]", "[SINK]"));
DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
.setSinkNameWithSinkNameOneof(sinkName)
.build();
ApiFuture<Void> future = configClient.deleteSinkCallable().futureCall(request);
// Do something
future.get();
}
public final PagedResponseWrappers.ListExclusionsPagedResponse listExclusions(com.google.logging.v2.ParentNameOneof parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
for (LogExclusion element : configClient.listExclusions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent resource whose exclusions are to be listed.
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
com.google.api.gax.rpc.ApiException - if the remote call failspublic final PagedResponseWrappers.ListExclusionsPagedResponse listExclusions(com.google.logging.v2.ListExclusionsRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
for (LogExclusion element : configClient.listExclusions(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListExclusionsRequest,PagedResponseWrappers.ListExclusionsPagedResponse> listExclusionsPagedCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
ApiFuture<ListExclusionsPagedResponse> future = configClient.listExclusionsPagedCallable().futureCall(request);
// Do something
for (LogExclusion element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.ListExclusionsRequest,com.google.logging.v2.ListExclusionsResponse> listExclusionsCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.build();
while (true) {
ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
for (LogExclusion element : response.getExclusionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.logging.v2.LogExclusion getExclusion(com.google.logging.v2.ExclusionNameOneof name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
LogExclusion response = configClient.getExclusion(name);
}
name - Required. The resource name of an existing exclusion:
"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.GetExclusionRequest,com.google.logging.v2.LogExclusion> getExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
GetExclusionRequest request = GetExclusionRequest.newBuilder()
.setNameWithExclusionNameOneof(name)
.build();
ApiFuture<LogExclusion> future = configClient.getExclusionCallable().futureCall(request);
// Do something
LogExclusion response = future.get();
}
public final com.google.logging.v2.LogExclusion createExclusion(com.google.logging.v2.ParentNameOneof parent,
com.google.logging.v2.LogExclusion exclusion)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent, exclusion);
}
parent - Required. The parent resource in which to create the exclusion:
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
Examples: `"projects/my-logging-project"`, `"organizations/123456789"`.
exclusion - Required. The new exclusion, whose `name` parameter is an exclusion name that
is not already used in the parent resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.logging.v2.LogExclusion createExclusion(com.google.logging.v2.CreateExclusionRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.setExclusion(exclusion)
.build();
LogExclusion response = configClient.createExclusion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.CreateExclusionRequest,com.google.logging.v2.LogExclusion> createExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentNameOneof parent = ParentNameOneof.from(ProjectName.of("[PROJECT]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
.setParentWithParentNameOneof(parent)
.setExclusion(exclusion)
.build();
ApiFuture<LogExclusion> future = configClient.createExclusionCallable().futureCall(request);
// Do something
LogExclusion response = future.get();
}
public final com.google.logging.v2.LogExclusion updateExclusion(com.google.logging.v2.ExclusionNameOneof name,
com.google.logging.v2.LogExclusion exclusion,
com.google.protobuf.FieldMask updateMask)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
}
name - Required. The resource name of the exclusion to update:
"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
exclusion - Required. New values for the existing exclusion. Only the fields specified in
`update_mask` are relevant.updateMask - Required. A nonempty list of fields to change in the existing exclusion. New
values for the fields are taken from the corresponding fields in the
[LogExclusion][google.logging.v2.LogExclusion] included in this request. Fields not
mentioned in `update_mask` are not changed and are ignored in the request.
For example, to change the filter and description of an exclusion, specify an `update_mask` of `"filter,description"`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.logging.v2.LogExclusion updateExclusion(com.google.logging.v2.UpdateExclusionRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
.setNameWithExclusionNameOneof(name)
.setExclusion(exclusion)
.setUpdateMask(updateMask)
.build();
LogExclusion response = configClient.updateExclusion(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.UpdateExclusionRequest,com.google.logging.v2.LogExclusion> updateExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
.setNameWithExclusionNameOneof(name)
.setExclusion(exclusion)
.setUpdateMask(updateMask)
.build();
ApiFuture<LogExclusion> future = configClient.updateExclusionCallable().futureCall(request);
// Do something
LogExclusion response = future.get();
}
public final void deleteExclusion(com.google.logging.v2.ExclusionNameOneof name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
configClient.deleteExclusion(name);
}
name - Required. The resource name of an existing exclusion to delete:
"projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
Example: `"projects/my-project-id/exclusions/my-exclusion-id"`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.logging.v2.DeleteExclusionRequest,com.google.protobuf.Empty> deleteExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionNameOneof name = ExclusionNameOneof.from(ExclusionName.of("[PROJECT]", "[EXCLUSION]"));
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
.setNameWithExclusionNameOneof(name)
.build();
ApiFuture<Void> future = configClient.deleteExclusionCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
throws Exception
close in interface AutoCloseableExceptionpublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2017 Google. All rights reserved.