@Generated(value="by gapic-generator") @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()) {
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.
|
LogExclusion |
createExclusion(CreateExclusionRequest request)
Creates a new exclusion in a specified parent resource.
|
LogExclusion |
createExclusion(ParentName parent,
LogExclusion exclusion)
Creates a new exclusion in a specified parent resource.
|
LogExclusion |
createExclusion(String parent,
LogExclusion exclusion)
Creates a new exclusion in a specified parent resource.
|
com.google.api.gax.rpc.UnaryCallable<CreateExclusionRequest,LogExclusion> |
createExclusionCallable()
Creates a new exclusion in a specified parent resource.
|
LogSink |
createSink(CreateSinkRequest request)
Creates a sink that exports specified log entries to a destination.
|
LogSink |
createSink(ParentName parent,
LogSink sink)
Creates a sink that exports specified log entries to a destination.
|
LogSink |
createSink(String parent,
LogSink sink)
Creates a sink that exports specified log entries to a destination.
|
com.google.api.gax.rpc.UnaryCallable<CreateSinkRequest,LogSink> |
createSinkCallable()
Creates a sink that exports specified log entries to a destination.
|
void |
deleteExclusion(DeleteExclusionRequest request)
Deletes an exclusion.
|
void |
deleteExclusion(ExclusionName name)
Deletes an exclusion.
|
void |
deleteExclusion(String name)
Deletes an exclusion.
|
com.google.api.gax.rpc.UnaryCallable<DeleteExclusionRequest,Empty> |
deleteExclusionCallable()
Deletes an exclusion.
|
void |
deleteSink(DeleteSinkRequest request)
Deletes a sink.
|
void |
deleteSink(SinkName sinkName)
Deletes a sink.
|
void |
deleteSink(String sinkName)
Deletes a sink.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSinkRequest,Empty> |
deleteSinkCallable()
Deletes a sink.
|
LogExclusion |
getExclusion(ExclusionName name)
Gets the description of an exclusion.
|
LogExclusion |
getExclusion(GetExclusionRequest request)
Gets the description of an exclusion.
|
LogExclusion |
getExclusion(String name)
Gets the description of an exclusion.
|
com.google.api.gax.rpc.UnaryCallable<GetExclusionRequest,LogExclusion> |
getExclusionCallable()
Gets the description of an exclusion.
|
ConfigSettings |
getSettings() |
LogSink |
getSink(GetSinkRequest request)
Gets a sink.
|
LogSink |
getSink(SinkName sinkName)
Gets a sink.
|
LogSink |
getSink(String sinkName)
Gets a sink.
|
com.google.api.gax.rpc.UnaryCallable<GetSinkRequest,LogSink> |
getSinkCallable()
Gets a sink.
|
ConfigServiceV2Stub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ConfigClient.ListExclusionsPagedResponse |
listExclusions(ListExclusionsRequest request)
Lists all the exclusions in a parent resource.
|
ConfigClient.ListExclusionsPagedResponse |
listExclusions(ParentName parent)
Lists all the exclusions in a parent resource.
|
ConfigClient.ListExclusionsPagedResponse |
listExclusions(String parent)
Lists all the exclusions in a parent resource.
|
com.google.api.gax.rpc.UnaryCallable<ListExclusionsRequest,ListExclusionsResponse> |
listExclusionsCallable()
Lists all the exclusions in a parent resource.
|
com.google.api.gax.rpc.UnaryCallable<ListExclusionsRequest,ConfigClient.ListExclusionsPagedResponse> |
listExclusionsPagedCallable()
Lists all the exclusions in a parent resource.
|
ConfigClient.ListSinksPagedResponse |
listSinks(ListSinksRequest request)
Lists sinks.
|
ConfigClient.ListSinksPagedResponse |
listSinks(ParentName parent)
Lists sinks.
|
ConfigClient.ListSinksPagedResponse |
listSinks(String parent)
Lists sinks.
|
com.google.api.gax.rpc.UnaryCallable<ListSinksRequest,ListSinksResponse> |
listSinksCallable()
Lists sinks.
|
com.google.api.gax.rpc.UnaryCallable<ListSinksRequest,ConfigClient.ListSinksPagedResponse> |
listSinksPagedCallable()
Lists sinks.
|
void |
shutdown() |
void |
shutdownNow() |
LogExclusion |
updateExclusion(ExclusionName name,
LogExclusion exclusion,
FieldMask updateMask)
Changes one or more properties of an existing exclusion.
|
LogExclusion |
updateExclusion(String name,
LogExclusion exclusion,
FieldMask updateMask)
Changes one or more properties of an existing exclusion.
|
LogExclusion |
updateExclusion(UpdateExclusionRequest request)
Changes one or more properties of an existing exclusion.
|
com.google.api.gax.rpc.UnaryCallable<UpdateExclusionRequest,LogExclusion> |
updateExclusionCallable()
Changes one or more properties of an existing exclusion.
|
LogSink |
updateSink(SinkName sinkName,
LogSink sink)
Updates a sink.
|
LogSink |
updateSink(SinkName sinkName,
LogSink sink,
FieldMask updateMask)
Updates a sink.
|
LogSink |
updateSink(String sinkName,
LogSink sink)
Updates a sink.
|
LogSink |
updateSink(String sinkName,
LogSink sink,
FieldMask updateMask)
Updates a sink.
|
LogSink |
updateSink(UpdateSinkRequest request)
Updates a sink.
|
com.google.api.gax.rpc.UnaryCallable<UpdateSinkRequest,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(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]"
com.google.api.gax.rpc.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]"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ConfigClient.ListSinksPagedResponse listSinks(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.rpc.UnaryCallable<ListSinksRequest,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 LogSink getSink(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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink getSink(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSinkRequest,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 LogSink createSink(ParentName parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink createSink(String parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink createSink(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateSinkRequest,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 LogSink updateSink(SinkName sinkName, LogSink sink, FieldMask updateMask)
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink updateSink(String sinkName, LogSink sink, FieldMask updateMask)
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink updateSink(SinkName sinkName, LogSink sink)
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink updateSink(String sinkName, LogSink sink)
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogSink updateSink(UpdateSinkRequest request)
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateSinkRequest,LogSink> updateSinkCallable()
The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.
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(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"`.
com.google.api.gax.rpc.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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteSink(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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(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]"
com.google.api.gax.rpc.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]"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ConfigClient.ListExclusionsPagedResponse listExclusions(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.rpc.UnaryCallable<ListExclusionsRequest,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 LogExclusion getExclusion(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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogExclusion getExclusion(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetExclusionRequest,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 LogExclusion createExclusion(ParentName parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogExclusion createExclusion(String parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final LogExclusion createExclusion(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateExclusionRequest,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 LogExclusion updateExclusion(ExclusionName name, 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 non-empty 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 LogExclusion updateExclusion(String name, 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 non-empty 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 LogExclusion updateExclusion(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateExclusionRequest,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(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"`.
com.google.api.gax.rpc.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"`.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteExclusion(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.