diff --git a/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py b/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py index 169087562dbd..c252e69bb860 100644 --- a/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py +++ b/logging/google/cloud/logging_v2/gapic/config_service_v2_client.py @@ -173,9 +173,10 @@ def __init__(self, ) if client_info is None: - client_info = ( - google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) - client_info.gapic_version = _GAPIC_LIBRARY_VERSION + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION, ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC @@ -217,7 +218,7 @@ def list_sinks(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_sinks(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_sinks(parent).pages: ... for element in page: ... # process element ... pass @@ -227,10 +228,10 @@ def list_sinks(self, :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_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 @@ -308,12 +309,12 @@ def get_sink(self, :: - \"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]\" + "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\"``. + Example: ``"projects/my-project-id/sinks/my-sink-id"``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -355,10 +356,10 @@ def create_sink(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Creates a sink that exports specified log entries to a destination. The - export of newly-ingested log entries begins immediately, unless the sink's - ``writer_identity`` is not permitted to write to the destination. A sink can - export log entries only from the resource owning the sink. + Creates a sink that exports specified log entries to a destination. The + export of newly-ingested log entries begins immediately, unless the + sink's ``writer_identity`` is not permitted to write to the destination. + A sink can export log entries only from the resource owning the sink. Example: >>> from google.cloud import logging_v2 @@ -367,7 +368,7 @@ def create_sink(self, >>> >>> parent = client.project_path('[PROJECT]') >>> - >>> # TODO: Initialize ``sink``: + >>> # TODO: Initialize `sink`: >>> sink = {} >>> >>> response = client.create_sink(parent, sink) @@ -377,27 +378,29 @@ def create_sink(self, :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_ID]" + + Examples: ``"projects/my-logging-project"``, + ``"organizations/123456789"``. + sink (Union[dict, ~google.cloud.logging_v2.types.LogSink]): Required. The new sink, whose ``name`` parameter is a sink identifier + that is not already in use. - Examples: ``\"projects/my-logging-project\"``, ``\"organizations/123456789\"``. - sink (Union[dict, ~google.cloud.logging_v2.types.LogSink]): Required. The new sink, whose ``name`` parameter is a sink identifier that - is not already in use. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogSink` - unique_writer_identity (bool): Optional. Determines the kind of IAM identity returned as ``writer_identity`` - in the new sink. If this value is omitted or set to false, and if the - sink's parent is a project, then the value returned as ``writer_identity`` is - the same group or service account used by Logging before the - addition of writer identities to this API. The sink's destination must be - in the same project as the sink itself. + unique_writer_identity (bool): Optional. Determines the kind of IAM identity returned as + ``writer_identity`` in the new sink. If this value is omitted or set to + false, and if the sink's parent is a project, then the value returned as + ``writer_identity`` is the same group or service account used by Logging + before the addition of writer identities to this API. The sink's + destination must be in the same project as the sink itself. If this field is set to true, or if the sink is owned by a non-project - resource such as an organization, then the value of ``writer_identity`` will - be a unique service account used only for exports from the new sink. For - more information, see ``writer_identity`` in ``LogSink``. + resource such as an organization, then the value of ``writer_identity`` + will be a unique service account used only for exports from the new + sink. For more information, see ``writer_identity`` in ``LogSink``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -444,10 +447,10 @@ def update_sink(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Updates a sink. This method replaces the following fields in the existing - sink with values from the new sink: ``destination``, and ``filter``. - The updated sink might also have a new ``writer_identity``; see the - ``unique_writer_identity`` field. + Updates a sink. This method replaces the following fields in the + existing sink with values from the new sink: ``destination``, and + ``filter``. The updated sink might also have a new ``writer_identity``; + see the ``unique_writer_identity`` field. Example: >>> from google.cloud import logging_v2 @@ -456,7 +459,7 @@ def update_sink(self, >>> >>> sink_name = client.sink_path('[PROJECT]', '[SINK]') >>> - >>> # TODO: Initialize ``sink``: + >>> # TODO: Initialize `sink`: >>> sink = {} >>> >>> response = client.update_sink(sink_name, sink) @@ -467,41 +470,35 @@ def update_sink(self, :: - \"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]\" + "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 (Union[dict, ~google.cloud.logging_v2.types.LogSink]): Required. The updated sink, whose name is the same identifier that + appears as part of ``sink_name``. - Example: ``\"projects/my-project-id/sinks/my-sink-id\"``. - sink (Union[dict, ~google.cloud.logging_v2.types.LogSink]): Required. The updated sink, whose name is the same identifier that appears - as part of ``sink_name``. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogSink` unique_writer_identity (bool): Optional. See - `sinks.create `_ - for a description of this field. When updating a sink, the effect of this - field on the value of ``writer_identity`` in the updated sink depends on both - the old and new values of this field: - - + If the old and new values of this field are both false or both true, - :: - - then there is no change to the sink's `writer_identity`. - + If the old value is false and the new value is true, then - :: - - `writer_identity` is changed to a unique service account. - + It is an error if the old value is true and the new value is - :: - - set to false or defaulted to false. - update_mask (Union[dict, ~google.cloud.logging_v2.types.FieldMask]): 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. + `sinks.create `__ + for a description of this field. When updating a sink, the effect of + this field on the value of ``writer_identity`` in the updated sink + depends on both the old and new values of this field: + + - If the old and new values of this field are both false or both true, + then there is no change to the sink's ``writer_identity``. + - If the old value is false and the new value is true, then + ``writer_identity`` is changed to a unique service account. + - It is an error if the old value is true and the new value is set to + false or defaulted to false. + update_mask (Union[dict, ~google.cloud.logging_v2.types.FieldMask]): 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 + 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. @@ -509,6 +506,7 @@ def update_sink(self, https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask Example: ``updateMask=filter``. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.FieldMask` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -573,12 +571,12 @@ def delete_sink(self, :: - \"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]\" + "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\"``. + Example: ``"projects/my-project-id/sinks/my-sink-id"``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -634,7 +632,7 @@ def list_exclusions(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_exclusions(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_exclusions(parent).pages: ... for element in page: ... # process element ... pass @@ -644,10 +642,10 @@ def list_exclusions(self, :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_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 @@ -726,12 +724,12 @@ def get_exclusion(self, :: - \"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]\" + "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\"``. + Example: ``"projects/my-project-id/exclusions/my-exclusion-id"``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -784,7 +782,7 @@ def create_exclusion(self, >>> >>> parent = client.project_path('[PROJECT]') >>> - >>> # TODO: Initialize ``exclusion``: + >>> # TODO: Initialize `exclusion`: >>> exclusion = {} >>> >>> response = client.create_exclusion(parent, exclusion) @@ -794,14 +792,16 @@ def create_exclusion(self, :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_ID]" + + Examples: ``"projects/my-logging-project"``, + ``"organizations/123456789"``. + exclusion (Union[dict, ~google.cloud.logging_v2.types.LogExclusion]): Required. The new exclusion, whose ``name`` parameter is an exclusion + name that is not already used in the parent resource. - Examples: ``\"projects/my-logging-project\"``, ``\"organizations/123456789\"``. - exclusion (Union[dict, ~google.cloud.logging_v2.types.LogExclusion]): Required. The new exclusion, whose ``name`` parameter is an exclusion name - that is not already used in the parent resource. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogExclusion` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -859,10 +859,10 @@ def update_exclusion(self, >>> >>> name = client.exclusion_path('[PROJECT]', '[EXCLUSION]') >>> - >>> # TODO: Initialize ``exclusion``: + >>> # TODO: Initialize `exclusion`: >>> exclusion = {} >>> - >>> # TODO: Initialize ``update_mask``: + >>> # TODO: Initialize `update_mask`: >>> update_mask = {} >>> >>> response = client.update_exclusion(name, exclusion, update_mask) @@ -872,14 +872,15 @@ def update_exclusion(self, :: - \"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]\" + "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 (Union[dict, ~google.cloud.logging_v2.types.LogExclusion]): Required. New values for the existing exclusion. Only the fields + specified in ``update_mask`` are relevant. - Example: ``\"projects/my-project-id/exclusions/my-exclusion-id\"``. - exclusion (Union[dict, ~google.cloud.logging_v2.types.LogExclusion]): Required. New values for the existing exclusion. Only the fields specified - in ``update_mask`` are relevant. If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogExclusion` update_mask (Union[dict, ~google.cloud.logging_v2.types.FieldMask]): Required. A nonempty list of fields to change in the existing exclusion. @@ -888,7 +889,8 @@ def update_exclusion(self, ``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\"``. + specify an ``update_mask`` of ``"filter,description"``. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.FieldMask` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -952,12 +954,12 @@ def delete_exclusion(self, :: - \"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]\" + "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\"``. + Example: ``"projects/my-project-id/exclusions/my-exclusion-id"``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. diff --git a/logging/google/cloud/logging_v2/gapic/enums.py b/logging/google/cloud/logging_v2/gapic/enums.py index f448430659b1..e47d4def171e 100644 --- a/logging/google/cloud/logging_v2/gapic/enums.py +++ b/logging/google/cloud/logging_v2/gapic/enums.py @@ -20,8 +20,8 @@ class LaunchStage(enum.IntEnum): """ - The launch stage as defined by [Google Cloud Platform - Launch Stages](http://cloud.google.com/terms/launch-stages). + The launch stage as defined by `Google Cloud Platform Launch + Stages `__. Attributes: LAUNCH_STAGE_UNSPECIFIED (int): Do not use this default value. @@ -47,10 +47,10 @@ class LaunchStage(enum.IntEnum): GA (int): GA features are open to all developers and are considered stable and fully qualified for production use. DEPRECATED (int): Deprecated features are scheduled to be shut down and removed. For more - information, see the “Deprecation Policy” section of our [Terms of - Service](https://cloud.google.com/terms/) - and the [Google Cloud Platform Subject to the Deprecation - Policy](https://cloud.google.com/terms/deprecation) documentation. + information, see the “Deprecation Policy” section of our `Terms of + Service `__ and the `Google Cloud + Platform Subject to the Deprecation + Policy `__ documentation. """ LAUNCH_STAGE_UNSPECIFIED = 0 EARLY_ACCESS = 1 @@ -62,10 +62,10 @@ class LaunchStage(enum.IntEnum): class NullValue(enum.IntEnum): """ - ``NullValue`` is a singleton enumeration to represent the null value for the - ``Value`` type union. + ``NullValue`` is a singleton enumeration to represent the null value for + the ``Value`` type union. - The JSON representation for ``NullValue`` is JSON ``null``. + The JSON representation for ``NullValue`` is JSON ``null``. Attributes: NULL_VALUE (int): Null value. @@ -75,23 +75,24 @@ class NullValue(enum.IntEnum): class LogSeverity(enum.IntEnum): """ - The severity of the event described in a log entry, expressed as one of the - standard severity levels listed below. For your reference, the levels are - assigned the listed numeric values. The effect of using numeric values other - than those listed is undefined. + The severity of the event described in a log entry, expressed as one of + the standard severity levels listed below. For your reference, the + levels are assigned the listed numeric values. The effect of using + numeric values other than those listed is undefined. - You can filter for log entries by severity. For example, the following - filter expression will match log entries with severities ``INFO``, ``NOTICE``, - and ``WARNING``: + You can filter for log entries by severity. For example, the following + filter expression will match log entries with severities ``INFO``, + ``NOTICE``, and ``WARNING``: :: - severity > DEBUG AND severity <= WARNING + severity > DEBUG AND severity <= WARNING - If you are writing log entries, you should map other severity encodings to - one of these standard levels. For example, you might map all of Java's FINE, - FINER, and FINEST levels to ``LogSeverity.DEBUG``. You can preserve the - original severity level in the log entry payload if you wish. + If you are writing log entries, you should map other severity encodings + to one of these standard levels. For example, you might map all of + Java's FINE, FINER, and FINEST levels to ``LogSeverity.DEBUG``. You can + preserve the original severity level in the log entry payload if you + wish. Attributes: DEFAULT (int): (0) The log entry has no assigned severity level. @@ -157,13 +158,13 @@ class ValueType(enum.IntEnum): Attributes: VALUE_TYPE_UNSPECIFIED (int): Do not use this default value. - BOOL (int): The value is a boolean. - This value type can be used only if the metric kind is ``GAUGE``. + BOOL (int): The value is a boolean. This value type can be used only if the metric + kind is ``GAUGE``. INT64 (int): The value is a signed 64-bit integer. DOUBLE (int): The value is a double precision floating point number. - STRING (int): The value is a text string. - This value type can be used only if the metric kind is ``GAUGE``. - DISTRIBUTION (int): The value is a ````Distribution````. + STRING (int): The value is a text string. This value type can be used only if the + metric kind is ``GAUGE``. + DISTRIBUTION (int): The value is a ``Distribution``. MONEY (int): The value is money. """ VALUE_TYPE_UNSPECIFIED = 0 diff --git a/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py b/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py index f0a29707b9dc..2bf9ec6733c8 100644 --- a/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py +++ b/logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py @@ -158,9 +158,10 @@ def __init__(self, ) if client_info is None: - client_info = ( - google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) - client_info.gapic_version = _GAPIC_LIBRARY_VERSION + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION, ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC @@ -202,16 +203,15 @@ def delete_log(self, :: - \"projects/[PROJECT_ID]/logs/[LOG_ID]\" - \"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]\" - \"folders/[FOLDER_ID]/logs/[LOG_ID]\" + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + "folders/[FOLDER_ID]/logs/[LOG_ID]" ``[LOG_ID]`` must be URL-encoded. For example, - ``\"projects/my-project-id/logs/syslog\"``, - ``\"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\"``. - For more information about log names, see - ``LogEntry``. + ``"projects/my-project-id/logs/syslog"``, + ``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``. + For more information about log names, see ``LogEntry``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -266,79 +266,83 @@ def write_log_entries(self, >>> >>> client = logging_v2.LoggingServiceV2Client() >>> - >>> # TODO: Initialize ``entries``: + >>> # TODO: Initialize `entries`: >>> entries = [] >>> >>> response = client.write_log_entries(entries) Args: - entries (list[Union[dict, ~google.cloud.logging_v2.types.LogEntry]]): Required. The log entries to send to Logging. The order of log - entries in this list does not matter. Values supplied in this method's - ``log_name``, ``resource``, and ``labels`` fields are copied into those log - entries in this list that do not include values for their corresponding - fields. For more information, see the - ``LogEntry`` type. - - If the ``timestamp`` or ``insert_id`` fields are missing in log entries, then - this method supplies the current time or a unique identifier, respectively. - The supplied values are chosen so that, among the log entries that did not - supply their own values, the entries earlier in the list will sort before - the entries later in the list. See the ``entries.list`` method. - - Log entries with timestamps that are more than the - `logs retention period `_ in the past or more than - 24 hours in the future will not be available when calling ``entries.list``. - However, those log entries can still be exported with - `LogSinks `_. - - To improve throughput and to avoid exceeding the - `quota limit `_ for calls to ``entries.write``, - you should try to include several log entries in this list, - rather than calling this method for each individual log entry. + entries (list[Union[dict, ~google.cloud.logging_v2.types.LogEntry]]): Required. The log entries to send to Logging. The order of log entries + in this list does not matter. Values supplied in this method's + ``log_name``, ``resource``, and ``labels`` fields are copied into those + log entries in this list that do not include values for their + corresponding fields. For more information, see the ``LogEntry`` type. + + If the ``timestamp`` or ``insert_id`` fields are missing in log entries, + then this method supplies the current time or a unique identifier, + respectively. The supplied values are chosen so that, among the log + entries that did not supply their own values, the entries earlier in the + list will sort before the entries later in the list. See the + ``entries.list`` method. + + Log entries with timestamps that are more than the `logs retention + period `__ in the past or + more than 24 hours in the future will not be available when calling + ``entries.list``. However, those log entries can still be exported with + `LogSinks `__. + + To improve throughput and to avoid exceeding the `quota + limit `__ for calls to + ``entries.write``, you should try to include several log entries in this + list, rather than calling this method for each individual log entry. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogEntry` - log_name (str): Optional. A default log resource name that is assigned to all log entries - in ``entries`` that do not specify a value for ``log_name``: + log_name (str): Optional. A default log resource name that is assigned to all log + entries in ``entries`` that do not specify a value for ``log_name``: :: - \"projects/[PROJECT_ID]/logs/[LOG_ID]\" - \"organizations/[ORGANIZATION_ID]/logs/[LOG_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]\" - \"folders/[FOLDER_ID]/logs/[LOG_ID]\" + "projects/[PROJECT_ID]/logs/[LOG_ID]" + "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" + "folders/[FOLDER_ID]/logs/[LOG_ID]" ``[LOG_ID]`` must be URL-encoded. For example: :: - \"projects/my-project-id/logs/syslog\" - \"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity\" + "projects/my-project-id/logs/syslog" + "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity" - The permission logging.logEntries.create is needed on each - project, organization, billing account, or folder that is receiving - new log entries, whether the resource is specified in - logName or in an individual log entry. - resource (Union[dict, ~google.cloud.logging_v2.types.MonitoredResource]): Optional. A default monitored resource object that is assigned to all log - entries in ``entries`` that do not specify a value for ``resource``. Example: + The permission logging.logEntries.create is needed on each project, + organization, billing account, or folder that is receiving new log + entries, whether the resource is specified in logName or in an + individual log entry. + resource (Union[dict, ~google.cloud.logging_v2.types.MonitoredResource]): Optional. A default monitored resource object that is assigned to all + log entries in ``entries`` that do not specify a value for ``resource``. + Example: :: - { \"type\": \"gce_instance\", - \"labels\": { - \"zone\": \"us-central1-a\", \"instance_id\": \"00000000000000000000\" }} + { "type": "gce_instance", + "labels": { + "zone": "us-central1-a", "instance_id": "00000000000000000000" }} See ``LogEntry``. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.MonitoredResource` - labels (dict[str -> str]): Optional. Default labels that are added to the ``labels`` field of all log - entries in ``entries``. If a log entry already has a label with the same key - as a label in this parameter, then the log entry's label is not changed. - See ``LogEntry``. + labels (dict[str -> str]): Optional. Default labels that are added to the ``labels`` field of all + log entries in ``entries``. If a log entry already has a label with the + same key as a label in this parameter, then the log entry's label is not + changed. See ``LogEntry``. partial_success (bool): Optional. Whether valid entries should be written even if some other - entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - entry is not written, then the response status is the error associated - with one of the failed entries and the response includes error details - keyed by the entries' zero-based index in the ``entries.write`` method. + entries fail due to INVALID\_ARGUMENT or PERMISSION\_DENIED errors. If + any entry is not written, then the response status is the error + associated with one of the failed entries and the response includes + error details keyed by the entries' zero-based index in the + ``entries.write`` method. dry_run (bool): Optional. If true, the request should expect normal response, but the entries won't be persisted nor exported. Useful for checking whether the logging API endpoints are working properly before sending valuable data. @@ -394,16 +398,16 @@ def list_log_entries(self, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ - Lists log entries. Use this method to retrieve log entries from - Logging. For ways to export log entries, see - `Exporting Logs `_. + Lists log entries. Use this method to retrieve log entries from Logging. + For ways to export log entries, see `Exporting + Logs `__. Example: >>> from google.cloud import logging_v2 >>> >>> client = logging_v2.LoggingServiceV2Client() >>> - >>> # TODO: Initialize ``resource_names``: + >>> # TODO: Initialize `resource_names`: >>> resource_names = [] >>> >>> # Iterate over all results @@ -415,41 +419,43 @@ def list_log_entries(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_log_entries(resource_names, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_log_entries(resource_names).pages: ... for element in page: ... # process element ... pass Args: - resource_names (list[str]): Required. Names of one or more parent resources from which to - retrieve log entries: + resource_names (list[str]): Required. Names of one or more parent resources from which to retrieve + log entries: :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_ID]" Projects listed in the ``project_ids`` field are added to this list. - project_ids (list[str]): Deprecated. Use ``resource_names`` instead. One or more project identifiers - or project numbers from which to retrieve log entries. Example: - ``\"my-project-1A\"``. If present, these project identifiers are converted to - resource name format and added to the list of resources in + project_ids (list[str]): Deprecated. Use ``resource_names`` instead. One or more project + identifiers or project numbers from which to retrieve log entries. + Example: ``"my-project-1A"``. If present, these project identifiers are + converted to resource name format and added to the list of resources in ``resource_names``. - filter_ (str): Optional. A filter that chooses which log entries to return. See [Advanced - Logs Filters](/logging/docs/view/advanced_filters). Only log entries that - match the filter are returned. An empty filter matches all log entries in - the resources listed in ``resource_names``. Referencing a parent resource - that is not listed in ``resource_names`` will cause the filter to return no - results. - The maximum length of the filter is 20000 characters. - order_by (str): Optional. How the results should be sorted. Presently, the only permitted - values are ``\"timestamp asc\"`` (default) and ``\"timestamp desc\"``. The first - option returns entries in order of increasing values of - ``LogEntry.timestamp`` (oldest first), and the second option returns entries - in order of decreasing timestamps (newest first). Entries with equal - timestamps are returned in order of their ``insert_id`` values. + filter_ (str): Optional. A filter that chooses which log entries to return. See + `Advanced Logs + Filters `__. + Only log entries that match the filter are returned. An empty filter + matches all log entries in the resources listed in ``resource_names``. + Referencing a parent resource that is not listed in ``resource_names`` + will cause the filter to return no results. The maximum length of the + filter is 20000 characters. + order_by (str): Optional. How the results should be sorted. Presently, the only + permitted values are ``"timestamp asc"`` (default) and + ``"timestamp desc"``. The first option returns entries in order of + increasing values of ``LogEntry.timestamp`` (oldest first), and the + second option returns entries in order of decreasing timestamps (newest + first). Entries with equal timestamps are returned in order of their + ``insert_id`` values. 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 @@ -532,7 +538,7 @@ def list_monitored_resource_descriptors( >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_monitored_resource_descriptors(options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_monitored_resource_descriptors().pages: ... for element in page: ... # process element ... pass @@ -619,7 +625,7 @@ def list_logs(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_logs(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_logs(parent).pages: ... for element in page: ... # process element ... pass @@ -629,10 +635,10 @@ def list_logs(self, :: - \"projects/[PROJECT_ID]\" - \"organizations/[ORGANIZATION_ID]\" - \"billingAccounts/[BILLING_ACCOUNT_ID]\" - \"folders/[FOLDER_ID]\" + "projects/[PROJECT_ID]" + "organizations/[ORGANIZATION_ID]" + "billingAccounts/[BILLING_ACCOUNT_ID]" + "folders/[FOLDER_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 diff --git a/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py b/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py index 6dde895a5e3e..581b2ef16c17 100644 --- a/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py +++ b/logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py @@ -163,9 +163,10 @@ def __init__(self, ) if client_info is None: - client_info = ( - google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO) - client_info.gapic_version = _GAPIC_LIBRARY_VERSION + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION, ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION self._client_info = client_info # Parse out the default settings for retry and timeout for each RPC @@ -207,7 +208,7 @@ def list_log_metrics(self, >>> # Alternatively: >>> >>> # Iterate over results one page at a time - >>> for page in client.list_log_metrics(parent, options=CallOptions(page_token=INITIAL_PAGE)): + >>> for page in client.list_log_metrics(parent).pages: ... for element in page: ... # process element ... pass @@ -217,7 +218,7 @@ def list_log_metrics(self, :: - \"projects/[PROJECT_ID]\" + "projects/[PROJECT_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 @@ -296,7 +297,7 @@ def get_log_metric(self, :: - \"projects/[PROJECT_ID]/metrics/[METRIC_ID]\" + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -348,7 +349,7 @@ def create_log_metric(self, >>> >>> parent = client.project_path('[PROJECT]') >>> - >>> # TODO: Initialize ``metric``: + >>> # TODO: Initialize `metric`: >>> metric = {} >>> >>> response = client.create_log_metric(parent, metric) @@ -358,11 +359,12 @@ def create_log_metric(self, :: - \"projects/[PROJECT_ID]\" + "projects/[PROJECT_ID]" The new metric must be provided in the request. metric (Union[dict, ~google.cloud.logging_v2.types.LogMetric]): The new logs-based metric, which must not have an identifier that already exists. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogMetric` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -419,7 +421,7 @@ def update_log_metric(self, >>> >>> metric_name = client.metric_path('[PROJECT]', '[METRIC]') >>> - >>> # TODO: Initialize ``metric``: + >>> # TODO: Initialize `metric`: >>> metric = {} >>> >>> response = client.update_log_metric(metric_name, metric) @@ -429,12 +431,13 @@ def update_log_metric(self, :: - \"projects/[PROJECT_ID]/metrics/[METRIC_ID]\" + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - The updated metric must be provided in the request and it's - ``name`` field must be the same as ``[METRIC_ID]`` If the metric - does not exist in ``[PROJECT_ID]``, then a new metric is created. + The updated metric must be provided in the request and it's ``name`` + field must be the same as ``[METRIC_ID]`` If the metric does not exist + in ``[PROJECT_ID]``, then a new metric is created. metric (Union[dict, ~google.cloud.logging_v2.types.LogMetric]): The updated metric. + If a dict is provided, it must be of the same form as the protobuf message :class:`~google.cloud.logging_v2.types.LogMetric` retry (Optional[google.api_core.retry.Retry]): A retry object used @@ -497,7 +500,7 @@ def delete_log_metric(self, :: - \"projects/[PROJECT_ID]/metrics/[METRIC_ID]\" + "projects/[PROJECT_ID]/metrics/[METRIC_ID]" retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. diff --git a/logging/google/cloud/logging_v2/gapic/transports/config_service_v2_grpc_transport.py b/logging/google/cloud/logging_v2/gapic/transports/config_service_v2_grpc_transport.py index be5b43eda2fa..e3e0b0de0ac8 100644 --- a/logging/google/cloud/logging_v2/gapic/transports/config_service_v2_grpc_transport.py +++ b/logging/google/cloud/logging_v2/gapic/transports/config_service_v2_grpc_transport.py @@ -128,10 +128,10 @@ def get_sink(self): def create_sink(self): """Return the gRPC stub for {$apiMethod.name}. - Creates a sink that exports specified log entries to a destination. The - export of newly-ingested log entries begins immediately, unless the sink's - ``writer_identity`` is not permitted to write to the destination. A sink can - export log entries only from the resource owning the sink. + Creates a sink that exports specified log entries to a destination. The + export of newly-ingested log entries begins immediately, unless the + sink's ``writer_identity`` is not permitted to write to the destination. + A sink can export log entries only from the resource owning the sink. Returns: Callable: A callable which accepts the appropriate @@ -144,10 +144,10 @@ def create_sink(self): def update_sink(self): """Return the gRPC stub for {$apiMethod.name}. - Updates a sink. This method replaces the following fields in the existing - sink with values from the new sink: ``destination``, and ``filter``. - The updated sink might also have a new ``writer_identity``; see the - ``unique_writer_identity`` field. + Updates a sink. This method replaces the following fields in the + existing sink with values from the new sink: ``destination``, and + ``filter``. The updated sink might also have a new ``writer_identity``; + see the ``unique_writer_identity`` field. Returns: Callable: A callable which accepts the appropriate diff --git a/logging/google/cloud/logging_v2/gapic/transports/logging_service_v2_grpc_transport.py b/logging/google/cloud/logging_v2/gapic/transports/logging_service_v2_grpc_transport.py index 19ac7878636d..8824a74e6e2f 100644 --- a/logging/google/cloud/logging_v2/gapic/transports/logging_service_v2_grpc_transport.py +++ b/logging/google/cloud/logging_v2/gapic/transports/logging_service_v2_grpc_transport.py @@ -137,9 +137,9 @@ def write_log_entries(self): def list_log_entries(self): """Return the gRPC stub for {$apiMethod.name}. - Lists log entries. Use this method to retrieve log entries from - Logging. For ways to export log entries, see - `Exporting Logs `_. + Lists log entries. Use this method to retrieve log entries from Logging. + For ways to export log entries, see `Exporting + Logs `__. Returns: Callable: A callable which accepts the appropriate