INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
The database string corresponding to this client s project. | def _database_string(self):
"""The database string corresponding to this client's project.
This value is lazy-loaded and cached.
Will be of the form
``projects/{project_id}/databases/{database_id}``
but ``database_id == '(default)'`` for the time being.
Returns:
... |
The RPC metadata for this client s associated database. | def _rpc_metadata(self):
"""The RPC metadata for this client's associated database.
Returns:
Sequence[Tuple(str, str)]: RPC metadata with resource prefix
for the database associated with this client.
"""
if self._rpc_metadata_internal is None:
self._r... |
Get a reference to a collection. | def collection(self, *collection_path):
"""Get a reference to a collection.
For a top-level collection:
.. code-block:: python
>>> client.collection('top')
For a sub-collection:
.. code-block:: python
>>> client.collection('mydocs/doc/subcol')
... |
Get a reference to a document in a collection. | def document(self, *document_path):
"""Get a reference to a document in a collection.
For a top-level document:
.. code-block:: python
>>> client.document('collek/shun')
>>> # is the same as
>>> client.document('collek', 'shun')
For a document in a... |
Create a write option for write operations. | def write_option(**kwargs):
"""Create a write option for write operations.
Write operations include :meth:`~.DocumentReference.set`,
:meth:`~.DocumentReference.update` and
:meth:`~.DocumentReference.delete`.
One of the following keyword arguments must be provided:
* ``... |
Retrieve a batch of documents. | def get_all(self, references, field_paths=None, transaction=None):
"""Retrieve a batch of documents.
.. note::
Documents returned by this method are not guaranteed to be
returned in the same order that they are given in ``references``.
.. note::
If multiple `... |
List top - level collections of the client s database. | def collections(self):
"""List top-level collections of the client's database.
Returns:
Sequence[~.firestore_v1beta1.collection.CollectionReference]:
iterator of subcollections of the current document.
"""
iterator = self._firestore_api.list_collection_ids(
... |
Helper for: meth: commit et al. | def _check_state(self):
"""Helper for :meth:`commit` et al.
:raises: :exc:`ValueError` if the object's state is invalid for making
API requests.
"""
if self._transaction_id is None:
raise ValueError("Transaction is not begun")
if self.committed is n... |
Begin a transaction on the database. | def begin(self):
"""Begin a transaction on the database.
:rtype: bytes
:returns: the ID for the newly-begun transaction.
:raises ValueError:
if the transaction is already begun, committed, or rolled back.
"""
if self._transaction_id is not None:
r... |
Roll back a transaction on the database. | def rollback(self):
"""Roll back a transaction on the database."""
self._check_state()
database = self._session._database
api = database.spanner_api
metadata = _metadata_with_prefix(database.name)
api.rollback(self._session.name, self._transaction_id, metadata=metadata)
... |
Commit mutations to the database. | def commit(self):
"""Commit mutations to the database.
:rtype: datetime
:returns: timestamp of the committed changes.
:raises ValueError: if there are no mutations to commit.
"""
self._check_state()
database = self._session._database
api = database.spann... |
Helper for: meth: execute_update. | def _make_params_pb(params, param_types):
"""Helper for :meth:`execute_update`.
:type params: dict, {str -> column value}
:param params: values for parameter replacement. Keys must match
the names used in ``dml``.
:type param_types: dict[str -> Union[dict, .type... |
Perform an ExecuteSql API request with DML. | def execute_update(self, dml, params=None, param_types=None, query_mode=None):
"""Perform an ``ExecuteSql`` API request with DML.
:type dml: str
:param dml: SQL DML statement
:type params: dict, {str -> column value}
:param params: values for parameter replacement. Keys must m... |
Perform a batch of DML statements via an ExecuteBatchDml request. | def batch_update(self, statements):
"""Perform a batch of DML statements via an ``ExecuteBatchDml`` request.
:type statements:
Sequence[Union[ str, Tuple[str, Dict[str, Any], Dict[str, Union[dict, .types.Type]]]]]
:param statements:
List of DML statements, with optional... |
Converts the: class: TimestampRange to a protobuf. | def to_pb(self):
"""Converts the :class:`TimestampRange` to a protobuf.
:rtype: :class:`.data_v2_pb2.TimestampRange`
:returns: The converted current object.
"""
timestamp_range_kwargs = {}
if self.start is not None:
timestamp_range_kwargs["start_timestamp_mic... |
Converts the row filter to a protobuf. | def to_pb(self):
"""Converts the row filter to a protobuf.
First converts to a :class:`.data_v2_pb2.ColumnRange` and then uses it
in the ``column_range_filter`` field.
:rtype: :class:`.data_v2_pb2.RowFilter`
:returns: The converted current object.
"""
column_ran... |
Converts the row filter to a protobuf. | def to_pb(self):
"""Converts the row filter to a protobuf.
First converts to a :class:`.data_v2_pb2.ValueRange` and then uses
it to create a row filter protobuf.
:rtype: :class:`.data_v2_pb2.RowFilter`
:returns: The converted current object.
"""
value_range_kwar... |
Converts the row filter to a protobuf. | def to_pb(self):
"""Converts the row filter to a protobuf.
:rtype: :class:`.data_v2_pb2.RowFilter`
:returns: The converted current object.
"""
chain = data_v2_pb2.RowFilter.Chain(
filters=[row_filter.to_pb() for row_filter in self.filters]
)
return da... |
Converts the row filter to a protobuf. | def to_pb(self):
"""Converts the row filter to a protobuf.
:rtype: :class:`.data_v2_pb2.RowFilter`
:returns: The converted current object.
"""
interleave = data_v2_pb2.RowFilter.Interleave(
filters=[row_filter.to_pb() for row_filter in self.filters]
)
... |
Converts the row filter to a protobuf. | def to_pb(self):
"""Converts the row filter to a protobuf.
:rtype: :class:`.data_v2_pb2.RowFilter`
:returns: The converted current object.
"""
condition_kwargs = {"predicate_filter": self.base_filter.to_pb()}
if self.true_filter is not None:
condition_kwargs[... |
Return a fully - qualified organization_deidentify_template string. | def organization_deidentify_template_path(cls, organization, deidentify_template):
"""Return a fully-qualified organization_deidentify_template string."""
return google.api_core.path_template.expand(
"organizations/{organization}/deidentifyTemplates/{deidentify_template}",
organi... |
Return a fully - qualified project_deidentify_template string. | def project_deidentify_template_path(cls, project, deidentify_template):
"""Return a fully-qualified project_deidentify_template string."""
return google.api_core.path_template.expand(
"projects/{project}/deidentifyTemplates/{deidentify_template}",
project=project,
de... |
Return a fully - qualified organization_inspect_template string. | def organization_inspect_template_path(cls, organization, inspect_template):
"""Return a fully-qualified organization_inspect_template string."""
return google.api_core.path_template.expand(
"organizations/{organization}/inspectTemplates/{inspect_template}",
organization=organiza... |
Return a fully - qualified project_inspect_template string. | def project_inspect_template_path(cls, project, inspect_template):
"""Return a fully-qualified project_inspect_template string."""
return google.api_core.path_template.expand(
"projects/{project}/inspectTemplates/{inspect_template}",
project=project,
inspect_template=... |
Return a fully - qualified project_job_trigger string. | def project_job_trigger_path(cls, project, job_trigger):
"""Return a fully-qualified project_job_trigger string."""
return google.api_core.path_template.expand(
"projects/{project}/jobTriggers/{job_trigger}",
project=project,
job_trigger=job_trigger,
) |
Return a fully - qualified dlp_job string. | def dlp_job_path(cls, project, dlp_job):
"""Return a fully-qualified dlp_job string."""
return google.api_core.path_template.expand(
"projects/{project}/dlpJobs/{dlp_job}", project=project, dlp_job=dlp_job
) |
Return a fully - qualified organization_stored_info_type string. | def organization_stored_info_type_path(cls, organization, stored_info_type):
"""Return a fully-qualified organization_stored_info_type string."""
return google.api_core.path_template.expand(
"organizations/{organization}/storedInfoTypes/{stored_info_type}",
organization=organizat... |
Return a fully - qualified project_stored_info_type string. | def project_stored_info_type_path(cls, project, stored_info_type):
"""Return a fully-qualified project_stored_info_type string."""
return google.api_core.path_template.expand(
"projects/{project}/storedInfoTypes/{stored_info_type}",
project=project,
stored_info_type=s... |
Redacts potentially sensitive info from an image. This method has limits on input size processing time and output size. See https:// cloud. google. com/ dlp/ docs/ redacting - sensitive - data - images to learn more. | def redact_image(
self,
parent,
inspect_config=None,
image_redaction_configs=None,
include_findings=None,
byte_item=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
... |
Re - identifies content that has been de - identified. See https:// cloud. google. com/ dlp/ docs/ pseudonymization#re - identification \ _in \ _free \ _text \ _code \ _example to learn more. | def reidentify_content(
self,
parent,
reidentify_config=None,
inspect_config=None,
item=None,
inspect_template_name=None,
reidentify_template_name=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,... |
Returns a list of the sensitive information types that the DLP API supports. See https:// cloud. google. com/ dlp/ docs/ infotypes - reference to learn more. | def list_info_types(
self,
language_code=None,
filter_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Returns a list of the sensitive information types that the DLP API
... |
Creates an InspectTemplate for re - using frequently used configuration for inspecting content images and storage. See https:// cloud. google. com/ dlp/ docs/ creating - templates to learn more. | def create_inspect_template(
self,
parent,
inspect_template=None,
template_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an InspectTemplate for re-using fr... |
Creates a new job to inspect storage or calculate risk metrics. See https:// cloud. google. com/ dlp/ docs/ inspecting - storage and https:// cloud. google. com/ dlp/ docs/ compute - risk - analysis to learn more. | def create_dlp_job(
self,
parent,
inspect_job=None,
risk_job=None,
job_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new job to inspect storage o... |
Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https:// cloud. google. com/ dlp/ docs/ creating - job - triggers to learn more. | def create_job_trigger(
self,
parent,
job_trigger=None,
trigger_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a job trigger to run DLP actions such as scan... |
Creates a pre - built stored infoType to be used for inspection. See https:// cloud. google. com/ dlp/ docs/ creating - stored - infotypes to learn more. | def create_stored_info_type(
self,
parent,
config=None,
stored_info_type_id=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a pre-built stored infoType to be us... |
Helper for trace - related API calls. | def trace_api(self):
"""
Helper for trace-related API calls.
See
https://cloud.google.com/trace/docs/reference/v2/rpc/google.devtools.
cloudtrace.v2
"""
if self._trace_api is None:
self._trace_api = make_trace_api(self)
return self._trace_api |
Sends new spans to Stackdriver Trace or updates existing traces. If the name of a trace that you send matches that of an existing trace new spans are added to the existing trace. Attempt to update existing spans results undefined behavior. If the name does not match a new trace is created with given set of spans. | def batch_write_spans(self, name, spans, retry=None, timeout=None):
"""
Sends new spans to Stackdriver Trace or updates existing traces. If the
name of a trace that you send matches that of an existing trace, new
spans are added to the existing trace. Attempt to update existing spans
... |
Creates a new Span. | def create_span(
self,
name,
span_id,
display_name,
start_time,
end_time,
parent_span_id=None,
attributes=None,
stack_trace=None,
time_events=None,
links=None,
status=None,
same_process_as_parent_span=None,
c... |
Report error payload. | def report_error_event(self, error_report):
"""Report error payload.
:type error_report: dict
:param: error_report:
dict payload of the error report formatted according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
This object sho... |
Returns a routing header string for the given request parameters. | def to_routing_header(params):
"""Returns a routing header string for the given request parameters.
Args:
params (Mapping[str, Any]): A dictionary containing the request
parameters used for routing.
Returns:
str: The routing header string.
"""
if sys.version_info[0] < 3... |
Construct a field description protobuf. | def StructField(name, field_type): # pylint: disable=invalid-name
"""Construct a field description protobuf.
:type name: str
:param name: the name of the field
:type field_type: :class:`type_pb2.Type`
:param field_type: the type of the field
:rtype: :class:`type_pb2.StructType.Field`
:re... |
Construct a struct parameter type description protobuf. | def Struct(fields): # pylint: disable=invalid-name
"""Construct a struct parameter type description protobuf.
:type fields: list of :class:`type_pb2.StructType.Field`
:param fields: the fields of the struct
:rtype: :class:`type_pb2.Type`
:returns: the appropriate struct-type protobuf
"""
... |
Perform bi - directional speech recognition. | def streaming_recognize(
self,
config,
requests,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
):
"""Perform bi-directional speech recognition.
This method allows you to receive results while sending audio;
... |
A generator that yields the config followed by the requests. | def _streaming_request_iterable(self, config, requests):
"""A generator that yields the config followed by the requests.
Args:
config (~.speech_v1.types.StreamingRecognitionConfig): The
configuration to use for the stream.
requests (Iterable[~.speech_v1.types.Str... |
Return a fully - qualified project_data_source string. | def project_data_source_path(cls, project, data_source):
"""Return a fully-qualified project_data_source string."""
return google.api_core.path_template.expand(
"projects/{project}/dataSources/{data_source}",
project=project,
data_source=data_source,
) |
Return a fully - qualified project_transfer_config string. | def project_transfer_config_path(cls, project, transfer_config):
"""Return a fully-qualified project_transfer_config string."""
return google.api_core.path_template.expand(
"projects/{project}/transferConfigs/{transfer_config}",
project=project,
transfer_config=transf... |
Return a fully - qualified project_run string. | def project_run_path(cls, project, transfer_config, run):
"""Return a fully-qualified project_run string."""
return google.api_core.path_template.expand(
"projects/{project}/transferConfigs/{transfer_config}/runs/{run}",
project=project,
transfer_config=transfer_confi... |
Creates a new data transfer configuration. | def create_transfer_config(
self,
parent,
transfer_config,
authorization_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a new data transfer configuration.... |
Updates a data transfer configuration. All fields must be set even if they are not updated. | def update_transfer_config(
self,
transfer_config,
update_mask,
authorization_code=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates a data transfer configuration... |
Creates transfer runs for a time range [ start \ _time end \ _time ]. For each date - or whatever granularity the data source supports - in the range one transfer run is created. Note that runs are created per UTC time in the time range. | def schedule_transfer_runs(
self,
parent,
start_time,
end_time,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates transfer runs for a time range [start\_time, end\_time... |
Gets the most recent threat list diffs. | def compute_threat_list_diff(
self,
threat_type,
constraints,
version_token=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the most recent threat list diffs.
... |
This method is used to check whether a URI is on a given threatList. | def search_uris(
self,
uri,
threat_types,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
This method is used to check whether a URI is on a given threatList.
Example:
... |
Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat. | def search_hashes(
self,
hash_prefix=None,
threat_types=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the full hashes that match the requested hash prefix.
This ... |
Return a fully - qualified asset string. | def asset_path(cls, organization, asset):
"""Return a fully-qualified asset string."""
return google.api_core.path_template.expand(
"organizations/{organization}/assets/{asset}",
organization=organization,
asset=asset,
) |
Return a fully - qualified asset_security_marks string. | def asset_security_marks_path(cls, organization, asset):
"""Return a fully-qualified asset_security_marks string."""
return google.api_core.path_template.expand(
"organizations/{organization}/assets/{asset}/securityMarks",
organization=organization,
asset=asset,
... |
Return a fully - qualified source string. | def source_path(cls, organization, source):
"""Return a fully-qualified source string."""
return google.api_core.path_template.expand(
"organizations/{organization}/sources/{source}",
organization=organization,
source=source,
) |
Return a fully - qualified finding string. | def finding_path(cls, organization, source, finding):
"""Return a fully-qualified finding string."""
return google.api_core.path_template.expand(
"organizations/{organization}/sources/{source}/findings/{finding}",
organization=organization,
source=source,
... |
Creates a source. | def create_source(
self,
parent,
source,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a source.
Example:
>>> from google.cloud import securitycenter_v... |
Creates a finding. The corresponding source must exist for finding creation to succeed. | def create_finding(
self,
parent,
finding_id,
finding,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates a finding. The corresponding source must exist for finding crea... |
Runs asset discovery. The discovery is tracked with a long - running operation. | def run_asset_discovery(
self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Runs asset discovery. The discovery is tracked with a long-running
operation.
This API... |
Updates security marks. | def update_security_marks(
self,
security_marks,
update_mask=None,
start_time=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates security marks.
Example:
... |
Return a page of log entry resources. | def list_entries(
self, projects, filter_=None, order_by=None, page_size=None, page_token=None
):
"""Return a page of log entry resources.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
:type projects: list of strings
:param projects: pr... |
API call: log an entry resource via a POST request | def write_entries(self, entries, logger_name=None, resource=None, labels=None):
"""API call: log an entry resource via a POST request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write
:type entries: sequence of mapping
:param entries: the log entry r... |
API call: delete all entries in a logger via a DELETE request | def logger_delete(self, project, logger_name):
"""API call: delete all entries in a logger via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete
:type project: str
:param project: ID of project containing the log entries to de... |
List sinks for the project associated with this client. | def list_sinks(self, project, page_size=None, page_token=None):
"""List sinks for the project associated with this client.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list
:type project: str
:param project: ID of the project whose sinks are to ... |
API call: retrieve a sink resource. | def sink_get(self, project, sink_name):
"""API call: retrieve a sink resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get
:type project: str
:param project: ID of the project containing the sink.
:type sink_name: str
:par... |
API call: update a sink resource. | def sink_update(
self, project, sink_name, filter_, destination, unique_writer_identity=False
):
"""API call: update a sink resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update
:type project: str
:param project: ID of the p... |
API call: delete a sink resource. | def sink_delete(self, project, sink_name):
"""API call: delete a sink resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete
:type project: str
:param project: ID of the project containing the sink.
:type sink_name: str
... |
List metrics for the project associated with this client. | def list_metrics(self, project, page_size=None, page_token=None):
"""List metrics for the project associated with this client.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/list
:type project: str
:param project: ID of the project whose metrics... |
API call: create a metric resource. | def metric_create(self, project, metric_name, filter_, description=None):
"""API call: create a metric resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create
:type project: str
:param project: ID of the project in which to create the m... |
API call: retrieve a metric resource. | def metric_get(self, project, metric_name):
"""API call: retrieve a metric resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get
:type project: str
:param project: ID of the project containing the metric.
:type metric_name: str
... |
API call: delete a metric resource. | def metric_delete(self, project, metric_name):
"""API call: delete a metric resource.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete
:type project: str
:param project: ID of the project containing the metric.
:type metric_name: ... |
Add row range to row_ranges list from the row keys | def add_row_range_from_keys(
self, start_key=None, end_key=None, start_inclusive=True, end_inclusive=False
):
"""Add row range to row_ranges list from the row keys
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_row_range_from_keys]
... |
Add row keys and row range to given request message | def _update_message_request(self, message):
"""Add row keys and row range to given request message
:type message: class:`data_messages_v2_pb2.ReadRowsRequest`
:param message: The ``ReadRowsRequest`` protobuf
"""
for each in self.row_keys:
message.rows.row_keys.append... |
A tuple key that uniquely describes this field. | def _key(self):
"""A tuple key that uniquely describes this field.
Used to compute this instance's hashcode and evaluate equality.
Returns:
Tuple[str]: The contents of this :class:`.RowRange`.
"""
return (self.start_key, self.start_inclusive, self.end_key, self.end_... |
Convert row range object to dict which can be passed to google. bigtable. v2. RowRange add method. | def get_range_kwargs(self):
""" Convert row range object to dict which can be passed to
google.bigtable.v2.RowRange add method.
"""
range_kwargs = {}
if self.start_key is not None:
start_key_key = "start_key_open"
if self.start_inclusive:
s... |
Helper for logging - related API calls. | def report_errors_api(self):
"""Helper for logging-related API calls.
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs
:rtype:
:class:`_gapic._ErrorReportingGapicApi`
... |
Builds the Error Reporting object to report. | def _build_error_report(
self, message, report_location=None, http_context=None, user=None
):
"""Builds the Error Reporting object to report.
This builds the object according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
:type message: str
... |
Makes the call to the Error Reporting API. | def _send_error_report(
self, message, report_location=None, http_context=None, user=None
):
"""Makes the call to the Error Reporting API.
This is the lower-level interface to build and send the payload,
generally users will use either report() or report_exception() to
autom... |
Reports a message to Stackdriver Error Reporting | def report(self, message, http_context=None, user=None):
""" Reports a message to Stackdriver Error Reporting
https://cloud.google.com/error-reporting/docs/formatting-error-messages
:type message: str
:param message: A user-supplied message to report
:type http_context: :class... |
Reports the details of the latest exceptions to Stackdriver Error Reporting. | def report_exception(self, http_context=None, user=None):
""" Reports the details of the latest exceptions to Stackdriver Error
Reporting.
:type http_context: :class`google.cloud.error_reporting.HTTPContext`
:param http_context: The HTTP request which was processed when the
... |
Return the topmost transaction. | def current(self):
"""Return the topmost transaction.
.. note::
If the topmost element on the stack is not a transaction,
returns None.
:rtype: :class:`google.cloud.datastore.transaction.Transaction` or None
:returns: The current transaction (if any are active)... |
Begins a transaction. | def begin(self):
"""Begins a transaction.
This method is called automatically when entering a with
statement, however it can be called explicitly if you don't want
to use a context manager.
:raises: :class:`~exceptions.ValueError` if the transaction has
already... |
Rolls back the current transaction. | def rollback(self):
"""Rolls back the current transaction.
This method has necessary side-effects:
- Sets the current transaction's ID to None.
"""
try:
# No need to use the response it contains nothing.
self._client._datastore_api.rollback(self.project,... |
Adds an entity to be committed. | def put(self, entity):
"""Adds an entity to be committed.
Ensures the transaction is not marked readonly.
Please see documentation at
:meth:`~google.cloud.datastore.batch.Batch.put`
:type entity: :class:`~google.cloud.datastore.entity.Entity`
:param entity: the entity t... |
Lists an organization or source s findings. | def list_findings(
self,
parent,
filter_=None,
order_by=None,
read_time=None,
field_mask=None,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""... |
Factory: construct a metric given its API representation | def from_api_repr(cls, resource, client):
"""Factory: construct a metric given its API representation
:type resource: dict
:param resource: metric resource representation returned from the API
:type client: :class:`google.cloud.logging.client.Client`
:param client: Client whic... |
API call: create the metric via a PUT request | def create(self, client=None):
"""API call: create the metric via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param client... |
API call: test for the existence of the metric via a GET request | def exists(self, client=None):
"""API call: test for the existence of the metric via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
... |
API call: sync local metric configuration via a GET request | def reload(self, client=None):
"""API call: sync local metric configuration via a GET request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:p... |
API call: update metric configuration via a PUT request | def update(self, client=None):
"""API call: update metric configuration via a PUT request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:pa... |
API call: delete a metric via a DELETE request | def delete(self, client=None):
"""API call: delete a metric via a DELETE request
See
https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete
:type client: :class:`~google.cloud.logging.client.Client` or
``NoneType``
:param clien... |
Convert a dict to protobuf. | def _dict_mapping_to_pb(mapping, proto_type):
"""
Convert a dict to protobuf.
Args:
mapping (dict): A dict that needs to be converted to protobuf.
proto_type (str): The type of the Protobuf.
Returns:
An instance of the specified protobuf.
"""
converted_pb = getattr(trac... |
Convert a span attribute dict to protobuf including Links Attributes TimeEvents. | def _span_attrs_to_pb(span_attr, proto_type):
"""
Convert a span attribute dict to protobuf, including Links, Attributes,
TimeEvents.
Args:
span_attr (dict): A dict that needs to be converted to protobuf.
proto_type (str): The type of the Protobuf.
Returns:
An instance of t... |
Convert a value to protobuf. e. g. BoolValue Int32Value. | def _value_to_pb(value, proto_type):
"""
Convert a value to protobuf. e.g. BoolValue, Int32Value.
Args:
value (dict): A dict that needs to be converted to protobuf.
proto_type (str): The type of the Protobuf.
Returns:
An instance of the specified protobuf.
"""
data_type... |
Sends new spans to Stackdriver Trace or updates existing traces. If the name of a trace that you send matches that of an existing trace new spans are added to the existing trace. Attempt to update existing spans results undefined behavior. If the name does not match a new trace is created with given set of spans. | def batch_write_spans(
self, name, spans, retry=method.DEFAULT, timeout=method.DEFAULT
):
"""
Sends new spans to Stackdriver Trace or updates existing traces. If the
name of a trace that you send matches that of an existing trace, new
spans are added to the existing trace. At... |
Creates a new Span. | def create_span(
self,
name,
span_id,
display_name,
start_time,
end_time,
parent_span_id=None,
attributes=None,
stack_trace=None,
time_events=None,
links=None,
status=None,
same_process_as_parent_span=None,
c... |
Creates an cluster instance from a protobuf. | def from_pb(cls, cluster_pb, instance):
"""Creates an cluster instance from a protobuf.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_cluster_from_pb]
:end-before: [END bigtable_cluster_from_pb]
:type cluster_pb: :class:`instance_pb... |
Refresh self from the server - provided protobuf. Helper for: meth: from_pb and: meth: reload. | def _update_from_pb(self, cluster_pb):
"""Refresh self from the server-provided protobuf.
Helper for :meth:`from_pb` and :meth:`reload`.
"""
self.location_id = cluster_pb.location.split("/")[-1]
self.serve_nodes = cluster_pb.serve_nodes
self.default_storage_type = cluste... |
Cluster name used in requests. | def name(self):
"""Cluster name used in requests.
.. note::
This property will not change if ``_instance`` and ``cluster_id``
do not, but the return value is not cached.
For example:
.. literalinclude:: snippets.py
:start-after: [START bigtable_cluster_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.