google.logging.v2.config_service_v2_api¶
Accesses the google.logging.v2 ConfigServiceV2 API.
Classes
ConfigServiceV2Api ([service_path, port, ...]) |
Service for configuring sinks used to export log entries outside Stackdriver Logging. |
-
class
google.logging.v2.config_service_v2_api.
ConfigServiceV2Api
(service_path='logging.googleapis.com', port=443, channel=None, metadata_transformer=None, ssl_creds=None, scopes=None, client_config=None, timeout=30, app_name='gax', app_version='0.12.0')[source]¶ Service for configuring sinks used to export log entries outside 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.beta.implementations.Channel
) – AChannel
object through which to make calls. - ssl_creds (
grpc.beta.implementations.ClientCredentials
) – A ClientCredentials for use with an SSL-enabled channel. - 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. - metadata_transformer (Callable[[], list]) – A function that creates the metadata for requests.
- timeout (int) – The default timeout, in seconds, for calls made through this client
- app_name (string) – The codename of the calling service.
- app_version (string) – The version of the calling service.
Returns: A ConfigServiceV2Api 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, options=None)[source]¶ Creates a sink.
Example
>>> from google.logging.v2.config_service_v2_api import ConfigServiceV2Api >>> from google.logging.v2 import logging_config_pb2 >>> api = ConfigServiceV2Api() >>> parent = api.project_path('[PROJECT]') >>> sink = logging_config_pb2.LogSink() >>> response = api.create_sink(parent, sink)
Parameters: - parent (string) –
The resource in which to create the sink. Example:
"projects/my-project-id"
.The new sink must be provided in the request.
- sink (
google.logging.v2.logging_config_pb2.LogSink
) – The new sink, which must not have an identifier that already exists. - options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.- parent (string) –
-
delete_sink
(sink_name, options=None)[source]¶ Deletes a sink.
Example
>>> from google.logging.v2.config_service_v2_api import ConfigServiceV2Api >>> api = ConfigServiceV2Api() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> api.delete_sink(sink_name)
Parameters: - sink_name (string) – The resource name of the sink to delete.
Example:
"projects/my-project-id/sinks/my-sink-id"
. - 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.- sink_name (string) – The resource name of the sink to delete.
Example:
-
get_sink
(sink_name, options=None)[source]¶ Gets a sink.
Example
>>> from google.logging.v2.config_service_v2_api import ConfigServiceV2Api >>> api = ConfigServiceV2Api() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> response = api.get_sink(sink_name)
Parameters: - sink_name (string) – The resource name of the sink to return.
Example:
"projects/my-project-id/sinks/my-sink-id"
. - options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.- sink_name (string) – The resource name of the sink to return.
Example:
-
list_sinks
(parent, page_size=0, options=None)[source]¶ Lists sinks.
Example
>>> from google.logging.v2.config_service_v2_api import ConfigServiceV2Api >>> from google.gax import CallOptions, INITIAL_PAGE >>> api = ConfigServiceV2Api() >>> parent = api.project_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 containing the sinks.
Example:
"projects/my-logging-project"
. - 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.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.- parent (string) – Required. The resource name containing the sinks.
Example:
-
classmethod
match_project_from_project_name
(project_name)[source]¶ Parses the project from a project resource.
Parameters: project_name (string) – A fully-qualified path representing a project 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, options=None)[source]¶ Creates or updates a sink.
Example
>>> from google.logging.v2.config_service_v2_api import ConfigServiceV2Api >>> from google.logging.v2 import logging_config_pb2 >>> api = ConfigServiceV2Api() >>> sink_name = api.sink_path('[PROJECT]', '[SINK]') >>> sink = logging_config_pb2.LogSink() >>> response = api.update_sink(sink_name, sink)
Parameters: - sink_name (string) –
The resource name of the sink to update. Example:
"projects/my-project-id/sinks/my-sink-id"
.The updated sink must be provided in the request and have the same name that is specified in
sinkName
. If the sink does not exist, it is created. - sink (
google.logging.v2.logging_config_pb2.LogSink
) – The updated sink, whose name must be the same as the sink identifier insinkName
. IfsinkName
does not exist, then this method creates a new sink. - options (
google.gax.CallOptions
) – Overrides the default settings for this call, e.g, timeout, retries etc.
Returns: A
google.logging.v2.logging_config_pb2.LogSink
instance.Raises: google.gax.errors.GaxError
if the RPC is aborted.- sink_name (string) –