@Generated(value="by gapic-generator") @BetaApi public class ConfigClient extends Object implements 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()) {
SinkName sinkName = ProjectSinkName.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 and Type | Class and Description |
---|---|
static class |
ConfigClient.ListExclusionsFixedSizeCollection |
static class |
ConfigClient.ListExclusionsPage |
static class |
ConfigClient.ListExclusionsPagedResponse |
static class |
ConfigClient.ListSinksFixedSizeCollection |
static class |
ConfigClient.ListSinksPage |
static class |
ConfigClient.ListSinksPagedResponse |
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.ParentName parent,
com.google.logging.v2.LogExclusion exclusion)
Creates a new exclusion in a specified parent resource.
|
com.google.logging.v2.LogExclusion |
createExclusion(String parent,
com.google.logging.v2.LogExclusion exclusion)
Creates a new exclusion in a specified parent resource.
|
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.ParentName parent,
com.google.logging.v2.LogSink sink)
Creates a sink that exports specified log entries to a destination.
|
com.google.logging.v2.LogSink |
createSink(String parent,
com.google.logging.v2.LogSink sink)
Creates a sink that exports specified log entries to a destination.
|
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.DeleteExclusionRequest request)
Deletes an exclusion.
|
void |
deleteExclusion(com.google.logging.v2.ExclusionName name)
Deletes an exclusion.
|
void |
deleteExclusion(String name)
Deletes an exclusion.
|
UnaryCallable<com.google.logging.v2.DeleteExclusionRequest,Empty> |
deleteExclusionCallable()
Deletes an exclusion.
|
void |
deleteSink(com.google.logging.v2.DeleteSinkRequest request)
Deletes a sink.
|
void |
deleteSink(com.google.logging.v2.SinkName sinkName)
Deletes a sink.
|
void |
deleteSink(String sinkName)
Deletes a sink.
|
UnaryCallable<com.google.logging.v2.DeleteSinkRequest,Empty> |
deleteSinkCallable()
Deletes a sink.
|
com.google.logging.v2.LogExclusion |
getExclusion(com.google.logging.v2.ExclusionName name)
Gets the description of an exclusion.
|
com.google.logging.v2.LogExclusion |
getExclusion(com.google.logging.v2.GetExclusionRequest request)
Gets the description of an exclusion.
|
com.google.logging.v2.LogExclusion |
getExclusion(String name)
Gets the description of an exclusion.
|
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.GetSinkRequest request)
Gets a sink.
|
com.google.logging.v2.LogSink |
getSink(com.google.logging.v2.SinkName sinkName)
Gets a sink.
|
com.google.logging.v2.LogSink |
getSink(String sinkName)
Gets a sink.
|
UnaryCallable<com.google.logging.v2.GetSinkRequest,com.google.logging.v2.LogSink> |
getSinkCallable()
Gets a sink.
|
ConfigServiceV2Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ConfigClient.ListExclusionsPagedResponse |
listExclusions(com.google.logging.v2.ListExclusionsRequest request)
Lists all the exclusions in a parent resource.
|
ConfigClient.ListExclusionsPagedResponse |
listExclusions(com.google.logging.v2.ParentName parent)
Lists all the exclusions in a parent resource.
|
ConfigClient.ListExclusionsPagedResponse |
listExclusions(String parent)
Lists all the exclusions in a parent resource.
|
UnaryCallable<com.google.logging.v2.ListExclusionsRequest,com.google.logging.v2.ListExclusionsResponse> |
listExclusionsCallable()
Lists all the exclusions in a parent resource.
|
UnaryCallable<com.google.logging.v2.ListExclusionsRequest,ConfigClient.ListExclusionsPagedResponse> |
listExclusionsPagedCallable()
Lists all the exclusions in a parent resource.
|
ConfigClient.ListSinksPagedResponse |
listSinks(com.google.logging.v2.ListSinksRequest request)
Lists sinks.
|
ConfigClient.ListSinksPagedResponse |
listSinks(com.google.logging.v2.ParentName parent)
Lists sinks.
|
ConfigClient.ListSinksPagedResponse |
listSinks(String parent)
Lists sinks.
|
UnaryCallable<com.google.logging.v2.ListSinksRequest,com.google.logging.v2.ListSinksResponse> |
listSinksCallable()
Lists sinks.
|
UnaryCallable<com.google.logging.v2.ListSinksRequest,ConfigClient.ListSinksPagedResponse> |
listSinksPagedCallable()
Lists sinks.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.logging.v2.LogExclusion |
updateExclusion(com.google.logging.v2.ExclusionName name,
com.google.logging.v2.LogExclusion exclusion,
FieldMask updateMask)
Changes one or more properties of an existing exclusion.
|
com.google.logging.v2.LogExclusion |
updateExclusion(String name,
com.google.logging.v2.LogExclusion exclusion,
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.
|
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.SinkName sinkName,
com.google.logging.v2.LogSink sink)
Updates a sink.
|
com.google.logging.v2.LogSink |
updateSink(com.google.logging.v2.SinkName sinkName,
com.google.logging.v2.LogSink sink,
FieldMask updateMask)
Updates a sink.
|
com.google.logging.v2.LogSink |
updateSink(String sinkName,
com.google.logging.v2.LogSink sink)
Updates a sink.
|
com.google.logging.v2.LogSink |
updateSink(String sinkName,
com.google.logging.v2.LogSink sink,
FieldMask updateMask)
Updates a sink.
|
com.google.logging.v2.LogSink |
updateSink(com.google.logging.v2.UpdateSinkRequest request)
Updates a sink.
|
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
IOException
public 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 ConfigClient.ListSinksPagedResponse listSinks(com.google.logging.v2.ParentName parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = 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]"
ApiException
- if the remote call failspublic final ConfigClient.ListSinksPagedResponse listSinks(String parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
for (LogSink element : configClient.listSinks(parent.toString()).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]"
ApiException
- if the remote call failspublic final ConfigClient.ListSinksPagedResponse listSinks(com.google.logging.v2.ListSinksRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParent(parent.toString())
.build();
for (LogSink element : configClient.listSinks(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.ListSinksRequest,ConfigClient.ListSinksPagedResponse> listSinksPagedCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListSinksPagedResponse> future = configClient.listSinksPagedCallable().futureCall(request);
// Do something
for (LogSink element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.logging.v2.ListSinksRequest,com.google.logging.v2.ListSinksResponse> listSinksCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListSinksRequest request = ListSinksRequest.newBuilder()
.setParent(parent.toString())
.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.SinkName sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.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"`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink getSink(String sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink response = configClient.getSink(sinkName.toString());
}
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"`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink getSink(com.google.logging.v2.GetSinkRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
GetSinkRequest request = GetSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.build();
LogSink response = configClient.getSink(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.GetSinkRequest,com.google.logging.v2.LogSink> getSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
GetSinkRequest request = GetSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.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.ParentName parent, com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = 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.ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink createSink(String parent, com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.createSink(parent.toString(), 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.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()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogSink sink = LogSink.newBuilder().build();
CreateSinkRequest request = CreateSinkRequest.newBuilder()
.setParent(parent.toString())
.setSink(sink)
.build();
LogSink response = configClient.createSink(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.CreateSinkRequest,com.google.logging.v2.LogSink> createSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogSink sink = LogSink.newBuilder().build();
CreateSinkRequest request = CreateSinkRequest.newBuilder()
.setParent(parent.toString())
.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.SinkName sinkName, com.google.logging.v2.LogSink sink, FieldMask updateMask)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
LogSink response = configClient.updateSink(sinkName, sink, updateMask);
}
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`.updateMask
- Optional. Field mask that specifies the fields in `sink` that need an update.
A sink field will be overwritten if, and only if, it is in the update mask. `name` and
output only fields cannot be updated.
An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.
For a detailed `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
Example: `updateMask=filter`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink updateSink(String sinkName, com.google.logging.v2.LogSink sink, FieldMask updateMask)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
LogSink response = configClient.updateSink(sinkName.toString(), sink, updateMask);
}
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`.updateMask
- Optional. Field mask that specifies the fields in `sink` that need an update.
A sink field will be overwritten if, and only if, it is in the update mask. `name` and
output only fields cannot be updated.
An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.
For a detailed `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
Example: `updateMask=filter`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink updateSink(com.google.logging.v2.SinkName sinkName, com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.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`.ApiException
- if the remote call failspublic final com.google.logging.v2.LogSink updateSink(String sinkName, com.google.logging.v2.LogSink sink)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.updateSink(sinkName.toString(), 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`.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()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.setSink(sink)
.build();
LogSink response = configClient.updateSink(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.UpdateSinkRequest,com.google.logging.v2.LogSink> updateSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
UpdateSinkRequest request = UpdateSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.setSink(sink)
.build();
ApiFuture<LogSink> future = configClient.updateSinkCallable().futureCall(request);
// Do something
LogSink response = future.get();
}
public final void deleteSink(com.google.logging.v2.SinkName sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.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"`.
ApiException
- if the remote call failspublic final void deleteSink(String sinkName)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
configClient.deleteSink(sinkName.toString());
}
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"`.
ApiException
- if the remote call failspublic final void deleteSink(com.google.logging.v2.DeleteSinkRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.build();
configClient.deleteSink(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.DeleteSinkRequest,Empty> deleteSinkCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
SinkName sinkName = ProjectSinkName.of("[PROJECT]", "[SINK]");
DeleteSinkRequest request = DeleteSinkRequest.newBuilder()
.setSinkName(sinkName.toString())
.build();
ApiFuture<Void> future = configClient.deleteSinkCallable().futureCall(request);
// Do something
future.get();
}
public final ConfigClient.ListExclusionsPagedResponse listExclusions(com.google.logging.v2.ParentName parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = 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]"
ApiException
- if the remote call failspublic final ConfigClient.ListExclusionsPagedResponse listExclusions(String parent)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
for (LogExclusion element : configClient.listExclusions(parent.toString()).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]"
ApiException
- if the remote call failspublic final ConfigClient.ListExclusionsPagedResponse listExclusions(com.google.logging.v2.ListExclusionsRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (LogExclusion element : configClient.listExclusions(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.ListExclusionsRequest,ConfigClient.ListExclusionsPagedResponse> listExclusionsPagedCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListExclusionsPagedResponse> future = configClient.listExclusionsPagedCallable().futureCall(request);
// Do something
for (LogExclusion element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.logging.v2.ListExclusionsRequest,com.google.logging.v2.ListExclusionsResponse> listExclusionsCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
ListExclusionsRequest request = ListExclusionsRequest.newBuilder()
.setParent(parent.toString())
.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.ExclusionName name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.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"`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogExclusion getExclusion(String name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
LogExclusion response = configClient.getExclusion(name.toString());
}
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"`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogExclusion getExclusion(com.google.logging.v2.GetExclusionRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
GetExclusionRequest request = GetExclusionRequest.newBuilder()
.setName(name.toString())
.build();
LogExclusion response = configClient.getExclusion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.GetExclusionRequest,com.google.logging.v2.LogExclusion> getExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
GetExclusionRequest request = GetExclusionRequest.newBuilder()
.setName(name.toString())
.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.ParentName parent, com.google.logging.v2.LogExclusion exclusion)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = 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.ApiException
- if the remote call failspublic final com.google.logging.v2.LogExclusion createExclusion(String parent, com.google.logging.v2.LogExclusion exclusion)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent.toString(), 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.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()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
.setParent(parent.toString())
.setExclusion(exclusion)
.build();
LogExclusion response = configClient.createExclusion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.CreateExclusionRequest,com.google.logging.v2.LogExclusion> createExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ParentName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
CreateExclusionRequest request = CreateExclusionRequest.newBuilder()
.setParent(parent.toString())
.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.ExclusionName name, com.google.logging.v2.LogExclusion exclusion, FieldMask updateMask)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.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"`.
ApiException
- if the remote call failspublic final com.google.logging.v2.LogExclusion updateExclusion(String name, com.google.logging.v2.LogExclusion exclusion, FieldMask updateMask)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
LogExclusion response = configClient.updateExclusion(name.toString(), 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"`.
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()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
.setName(name.toString())
.setExclusion(exclusion)
.setUpdateMask(updateMask)
.build();
LogExclusion response = configClient.updateExclusion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.UpdateExclusionRequest,com.google.logging.v2.LogExclusion> updateExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder()
.setName(name.toString())
.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.ExclusionName name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.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"`.
ApiException
- if the remote call failspublic final void deleteExclusion(String name)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
configClient.deleteExclusion(name.toString());
}
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"`.
ApiException
- if the remote call failspublic final void deleteExclusion(com.google.logging.v2.DeleteExclusionRequest request)
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
.setName(name.toString())
.build();
configClient.deleteExclusion(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.logging.v2.DeleteExclusionRequest,Empty> deleteExclusionCallable()
Sample code:
try (ConfigClient configClient = ConfigClient.create()) {
ExclusionName name = ProjectExclusionName.of("[PROJECT]", "[EXCLUSION]");
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = configClient.deleteExclusionCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.