google.cloud.gapic.logging.v2.config_service_v2_client¶
Accesses the google.logging.v2 ConfigServiceV2 API.
Classes
ConfigServiceV2Client ([service_path, port, ...]) |
Service for configuring sinks used to export log entries outside of Stackdriver Logging. |
-
class
google.cloud.gapic.logging.v2.config_service_v2_client.
ConfigServiceV2Client
(service_path='logging.googleapis.com', port=443, channel=None, credentials=None, ssl_credentials=None, scopes=None, client_config=None, app_name='gax', app_version='0.15.0')[source]¶ Service for configuring sinks used to export log entries outside of Stackdriver Logging.
Constructor.
Parameters: - service_path (string) – The domain name of the API remote host.
- port (int) – The port on which to connect to the remote host.
- channel (
grpc.Channel
) – AChannel
instance through which to make calls. - credentials (object) – The authorization credentials to attach to requests. These credentials identify this application to the service.
- ssl_credentials (
grpc.ChannelCredentials
) – AChannelCredentials
instance for use with an SSL-enabled channel. - scopes (list[string]) – A list of OAuth2 scopes to attach to requests.
- client_config (dict) – A dictionary for call options for each method. See
google.gax.construct_settings()
for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points. - app_name (string) – The codename of the calling service.
- app_version (string) – The version of the calling service.
Returns: A ConfigServiceV2Client object.
-
DEFAULT_SERVICE_PORT
= 443¶ The default port of the service.
-
SERVICE_ADDRESS
= 'logging.googleapis.com'¶ The default address of the service.
-
create_sink
(parent, sink, unique_writer_identity=False, options=None)[source]¶ Creates a sink.
Example
>>> from google.cloud.gapic.logging.v2 import config_service_v2_client >>> from google.cloud.grpc.logging.v2 import logging_config_pb2 >>> api = config_service_v2_client.ConfigServiceV2Client() >>> parent = api.parent_path('[PROJECT]') >>> sink = logging_config_pb2.LogSink() >>> response = api.create_sink(parent, sink)
Parameters: - parent (string) –
Required. The resource in which to create the sink:
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
- sink (
google.cloud.grpc.logging.v2.logging_config_pb2.LogSink
) – Required. The new sink, whosename
parameter is a sink identifier that is not already in use. - unique_writer_identity (bool) – Optional. Whether the sink will have a dedicated service account returned in the sink’s writer_identity. Set this field to be true to export logs from one project to a different project. This field is ignored for non-project sinks (e.g. organization sinks) because those sinks are required to have dedicated service accounts.
- options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.cloud.grpc.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.ValueError
if the parameters are invalid.
- parent (string) –
-
delete_sink
(sink_name, options=None)[source]¶ Deletes a sink.
Example
>>> from google.cloud.gapic.logging.v2 import config_service_v2_client >>> api = config_service_v2_client.ConfigServiceV2Client() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> api.delete_sink(sink_name)
Parameters: - sink_name (string) –
Required. The 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]"
It is an error if the sink does not exist.
- options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Raises: google.gax.errors.GaxError
if the RPC is aborted.ValueError
if the parameters are invalid.
- sink_name (string) –
-
get_sink
(sink_name, options=None)[source]¶ Gets a sink.
Example
>>> from google.cloud.gapic.logging.v2 import config_service_v2_client >>> api = config_service_v2_client.ConfigServiceV2Client() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> response = api.get_sink(sink_name)
Parameters: - sink_name (string) –
Required. The resource name of the sink to return:
"projects/[PROJECT_ID]/sinks/[SINK_ID]" "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
- options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.cloud.grpc.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.ValueError
if the parameters are invalid.
- sink_name (string) –
-
list_sinks
(parent, page_size=0, options=None)[source]¶ Lists sinks.
Example
>>> from google.cloud.gapic.logging.v2 import config_service_v2_client >>> from google.gax import CallOptions, INITIAL_PAGE >>> api = config_service_v2_client.ConfigServiceV2Client() >>> parent = api.parent_path('[PROJECT]') >>> >>> # Iterate over all results >>> for element in api.list_sinks(parent): >>> # process element >>> pass >>> >>> # Or iterate over results one page at a time >>> for page in api.list_sinks(parent, options=CallOptions(page_token=INITIAL_PAGE)): >>> for element in page: >>> # process element >>> pass
Parameters: - parent (string) –
Required. The resource name where this sink was created:
"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
- page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
- options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.gax.PageIterator
instance. By default, this is an iterable ofgoogle.cloud.grpc.logging.v2.logging_config_pb2.LogSink
instances. This object can also be configured to iterate over the pages of the response through the CallOptions parameter.Raises: google.gax.errors.GaxError
if the RPC is aborted.ValueError
if the parameters are invalid.
- parent (string) –
-
classmethod
match_project_from_parent_name
(parent_name)[source]¶ Parses the project from a parent resource.
Parameters: parent_name (string) – A fully-qualified path representing a parent resource. Returns: A string representing the project.
-
classmethod
match_project_from_sink_name
(sink_name)[source]¶ Parses the project from a sink resource.
Parameters: sink_name (string) – A fully-qualified path representing a sink resource. Returns: A string representing the project.
-
classmethod
match_sink_from_sink_name
(sink_name)[source]¶ Parses the sink from a sink resource.
Parameters: sink_name (string) – A fully-qualified path representing a sink resource. Returns: A string representing the sink.
-
update_sink
(sink_name, sink, unique_writer_identity=False, options=None)[source]¶ Updates or creates a sink.
Example
>>> from google.cloud.gapic.logging.v2 import config_service_v2_client >>> from google.cloud.grpc.logging.v2 import logging_config_pb2 >>> api = config_service_v2_client.ConfigServiceV2Client() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> sink = logging_config_pb2.LogSink() >>> response = api.update_sink(sink_name, sink)
Parameters: - sink_name (string) –
Required. The 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]"
Example:
"projects/my-project-id/sinks/my-sink-id"
. - sink (
google.cloud.grpc.logging.v2.logging_config_pb2.LogSink
) – Required. The updated sink, whose name is the same identifier that appears as part ofsinkName
. IfsinkName
does not exist, then this method creates a new sink. - unique_writer_identity (bool) – Optional. Whether the sink will have a dedicated service account returned in the sink’s writer_identity. Set this field to be true to export logs from one project to a different project. This field is ignored for non-project sinks (e.g. organization sinks) because those sinks are required to have dedicated service accounts.
- options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.cloud.grpc.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.ValueError
if the parameters are invalid.
- sink_name (string) –