Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def project_job_trigger_path(cls, project, job_trigger):
return google.api_core.path_template.expand(
"projects/{project}/jobTriggers/{job_trigger}",
project=project,
job_trigger=job_trigger,
) | [
"Return a fully-qualified project_job_trigger string."
] |
Please provide a description of the function:def dlp_job_path(cls, project, dlp_job):
return google.api_core.path_template.expand(
"projects/{project}/dlpJobs/{dlp_job}", project=project, dlp_job=dlp_job
) | [
"Return a fully-qualified dlp_job string."
] |
Please provide a description of the function:def organization_stored_info_type_path(cls, organization, stored_info_type):
return google.api_core.path_template.expand(
"organizations/{organization}/storedInfoTypes/{stored_info_type}",
organization=organization,
stored... | [
"Return a fully-qualified organization_stored_info_type string."
] |
Please provide a description of the function:def project_stored_info_type_path(cls, project, stored_info_type):
return google.api_core.path_template.expand(
"projects/{project}/storedInfoTypes/{stored_info_type}",
project=project,
stored_info_type=stored_info_type,
... | [
"Return a fully-qualified project_stored_info_type string."
] |
Please provide a description of the function: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.DE... | [
"\n Redacts potentially sensitive info from an image.\n This method has limits on input size, processing time, and output size.\n See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to\n learn more.\n\n When no InfoTypes or CustomInfoTypes are specified in this r... |
Please provide a description of the function: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,
tim... | [
"\n Re-identifies content that has been de-identified. See\n https://cloud.google.com/dlp/docs/pseudonymization#re-identification\\_in\\_free\\_text\\_code\\_example\n to learn more.\n\n Example:\n >>> from google.cloud import dlp_v2\n >>>\n >>> client = ... |
Please provide a description of the function: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,
):
# Wrap the transport method to ... | [
"\n Returns a list of the sensitive information types that the DLP API\n supports. See https://cloud.google.com/dlp/docs/infotypes-reference to\n learn more.\n\n Example:\n >>> from google.cloud import dlp_v2\n >>>\n >>> client = dlp_v2.DlpServiceClient()... |
Please provide a description of the function: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,
):
... | [
"\n Creates an InspectTemplate for re-using frequently used configuration\n for inspecting content, images, and storage.\n See https://cloud.google.com/dlp/docs/creating-templates to learn more.\n\n Example:\n >>> from google.cloud import dlp_v2\n >>>\n >... |
Please provide a description of the function: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,
):
... | [
"\n Creates a new job to inspect storage or calculate risk metrics.\n See https://cloud.google.com/dlp/docs/inspecting-storage and\n https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.\n\n When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the\n ... |
Please provide a description of the function: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,
):
# Wrap the ... | [
"\n Creates a job trigger to run DLP actions such as scanning storage for\n sensitive information on a set schedule.\n See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.\n\n Example:\n >>> from google.cloud import dlp_v2\n >>>\n >>... |
Please provide a description of the function: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,
):
# ... | [
"\n Creates a pre-built stored infoType to be used for inspection.\n See https://cloud.google.com/dlp/docs/creating-stored-infotypes to\n learn more.\n\n Example:\n >>> from google.cloud import dlp_v2\n >>>\n >>> client = dlp_v2.DlpServiceClient()\n ... |
Please provide a description of the function:def trace_api(self):
if self._trace_api is None:
self._trace_api = make_trace_api(self)
return self._trace_api | [
"\n Helper for trace-related API calls.\n\n See\n https://cloud.google.com/trace/docs/reference/v2/rpc/google.devtools.\n cloudtrace.v2\n "
] |
Please provide a description of the function:def batch_write_spans(self, name, spans, retry=None, timeout=None):
self.trace_api.batch_write_spans(
name=name, spans=spans, retry=retry, timeout=timeout
) | [
"\n Sends new spans to Stackdriver Trace or updates existing traces. If the\n name of a trace that you send matches that of an existing trace, new\n spans are added to the existing trace. Attempt to update existing spans\n results undefined behavior. If the name does not match, a new tra... |
Please provide a description of the function: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,
... | [
"\n Creates a new Span.\n\n Example:\n >>> from google.cloud import trace_v2\n >>>\n >>> client = trace_v2.Client()\n >>>\n >>> name = 'projects/{project}/traces/{trace_id}/spans/{span_id}'.\n format('[PROJECT]', '[TRACE_ID]'... |
Please provide a description of the function:def report_error_event(self, error_report):
logger = self.logging_client.logger("errors")
logger.log_struct(error_report) | [
"Report error payload.\n\n :type error_report: dict\n :param: error_report:\n dict payload of the error report formatted according to\n https://cloud.google.com/error-reporting/docs/formatting-error-messages\n This object should be built using\n :meth:~`goog... |
Please provide a description of the function:def to_routing_header(params):
if sys.version_info[0] < 3:
# Python 2 does not have the "safe" parameter for urlencode.
return urlencode(params).replace("%2F", "/")
return urlencode(
params,
# Per Google API policy (go/api-url-enc... | [
"Returns a routing header string for the given request parameters.\n\n Args:\n params (Mapping[str, Any]): A dictionary containing the request\n parameters used for routing.\n\n Returns:\n str: The routing header string.\n "
] |
Please provide a description of the function:def StructField(name, field_type): # pylint: disable=invalid-name
return type_pb2.StructType.Field(name=name, type=field_type) | [
"Construct a field description protobuf.\n\n :type name: str\n :param name: the name of the field\n\n :type field_type: :class:`type_pb2.Type`\n :param field_type: the type of the field\n\n :rtype: :class:`type_pb2.StructType.Field`\n :returns: the appropriate struct-field-type protobuf\n "
] |
Please provide a description of the function:def Struct(fields): # pylint: disable=invalid-name
return type_pb2.Type(
code=type_pb2.STRUCT, struct_type=type_pb2.StructType(fields=fields)
) | [
"Construct a struct parameter type description protobuf.\n\n :type fields: list of :class:`type_pb2.StructType.Field`\n :param fields: the fields of the struct\n\n :rtype: :class:`type_pb2.Type`\n :returns: the appropriate struct-type protobuf\n "
] |
Please provide a description of the function:def streaming_recognize(
self,
config,
requests,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
):
return super(SpeechHelpers, self).streaming_recognize(
... | [
"Perform bi-directional speech recognition.\n\n This method allows you to receive results while sending audio;\n it is only available via. gRPC (not REST).\n\n .. warning::\n\n This method is EXPERIMENTAL. Its interface might change in the\n future.\n\n Example:\n ... |
Please provide a description of the function:def _streaming_request_iterable(self, config, requests):
yield self.types.StreamingRecognizeRequest(streaming_config=config)
for request in requests:
yield request | [
"A generator that yields the config followed by the requests.\n\n Args:\n config (~.speech_v1.types.StreamingRecognitionConfig): The\n configuration to use for the stream.\n requests (Iterable[~.speech_v1.types.StreamingRecognizeRequest]):\n The input objec... |
Please provide a description of the function:def project_data_source_path(cls, project, data_source):
return google.api_core.path_template.expand(
"projects/{project}/dataSources/{data_source}",
project=project,
data_source=data_source,
) | [
"Return a fully-qualified project_data_source string."
] |
Please provide a description of the function:def project_transfer_config_path(cls, project, transfer_config):
return google.api_core.path_template.expand(
"projects/{project}/transferConfigs/{transfer_config}",
project=project,
transfer_config=transfer_config,
... | [
"Return a fully-qualified project_transfer_config string."
] |
Please provide a description of the function:def project_run_path(cls, project, transfer_config, run):
return google.api_core.path_template.expand(
"projects/{project}/transferConfigs/{transfer_config}/runs/{run}",
project=project,
transfer_config=transfer_config,
... | [
"Return a fully-qualified project_run string."
] |
Please provide a description of the function: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,
):
... | [
"\n Creates a new data transfer configuration.\n\n Example:\n >>> from google.cloud import bigquery_datatransfer_v1\n >>>\n >>> client = bigquery_datatransfer_v1.DataTransferServiceClient()\n >>>\n >>> parent = client.project_path('[PROJECT]')\n ... |
Please provide a description of the function: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,
):
... | [
"\n Updates a data transfer configuration.\n All fields must be set, even if they are not updated.\n\n Example:\n >>> from google.cloud import bigquery_datatransfer_v1\n >>>\n >>> client = bigquery_datatransfer_v1.DataTransferServiceClient()\n >>>\n ... |
Please provide a description of the function: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,
):
# Wrap the transport... | [
"\n Creates transfer runs for a time range [start\\_time, end\\_time]. For\n each date - or whatever granularity the data source supports - in the\n range, one transfer run is created. Note that runs are created per UTC\n time in the time range.\n\n Example:\n >>> from ... |
Please provide a description of the function: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,
):
# ... | [
"\n Gets the most recent threat list diffs.\n\n Example:\n >>> from google.cloud import webrisk_v1beta1\n >>> from google.cloud.webrisk_v1beta1 import enums\n >>>\n >>> client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()\n >>>\n >>> ... |
Please provide a description of the function: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,
):
# Wrap the transport method to add retry and timeo... | [
"\n This method is used to check whether a URI is on a given threatList.\n\n Example:\n >>> from google.cloud import webrisk_v1beta1\n >>> from google.cloud.webrisk_v1beta1 import enums\n >>>\n >>> client = webrisk_v1beta1.WebRiskServiceV1Beta1Client()\n ... |
Please provide a description of the function: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,
):
# Wrap the transport method to... | [
"\n Gets the full hashes that match the requested hash prefix.\n This is used after a hash prefix is looked up in a threatList\n and there is a match. The client side threatList only holds partial hashes\n so the client must query this method to determine if there is a full\n hash... |
Please provide a description of the function:def asset_path(cls, organization, asset):
return google.api_core.path_template.expand(
"organizations/{organization}/assets/{asset}",
organization=organization,
asset=asset,
) | [
"Return a fully-qualified asset string."
] |
Please provide a description of the function:def asset_security_marks_path(cls, organization, asset):
return google.api_core.path_template.expand(
"organizations/{organization}/assets/{asset}/securityMarks",
organization=organization,
asset=asset,
) | [
"Return a fully-qualified asset_security_marks string."
] |
Please provide a description of the function:def source_path(cls, organization, source):
return google.api_core.path_template.expand(
"organizations/{organization}/sources/{source}",
organization=organization,
source=source,
) | [
"Return a fully-qualified source string."
] |
Please provide a description of the function:def finding_path(cls, organization, source, finding):
return google.api_core.path_template.expand(
"organizations/{organization}/sources/{source}/findings/{finding}",
organization=organization,
source=source,
f... | [
"Return a fully-qualified finding string."
] |
Please provide a description of the function:def create_source(
self,
parent,
source,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry and timeou... | [
"\n Creates a source.\n\n Example:\n >>> from google.cloud import securitycenter_v1\n >>>\n >>> client = securitycenter_v1.SecurityCenterClient()\n >>>\n >>> parent = client.organization_path('[ORGANIZATION]')\n >>>\n >>> # T... |
Please provide a description of the function: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,
):
# Wrap the transport method t... | [
"\n Creates a finding. The corresponding source must exist for finding creation\n to succeed.\n\n Example:\n >>> from google.cloud import securitycenter_v1\n >>>\n >>> client = securitycenter_v1.SecurityCenterClient()\n >>>\n >>> parent = c... |
Please provide a description of the function:def run_asset_discovery(
self,
parent,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry and timeout logic.
... | [
"\n Runs asset discovery. The discovery is tracked with a long-running\n operation.\n\n This API can only be called with limited frequency for an organization.\n If it is called too frequently the caller will receive a\n TOO\\_MANY\\_REQUESTS error.\n\n Example:\n ... |
Please provide a description of the function: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,
):
... | [
"\n Updates security marks.\n\n Example:\n >>> from google.cloud import securitycenter_v1\n >>>\n >>> client = securitycenter_v1.SecurityCenterClient()\n >>>\n >>> # TODO: Initialize `security_marks`:\n >>> security_marks = {}\n ... |
Please provide a description of the function:def list_entries(
self, projects, filter_=None, order_by=None, page_size=None, page_token=None
):
extra_params = {"projectIds": projects}
if filter_ is not None:
extra_params["filter"] = filter_
if order_by is not No... | [
"Return a page of log entry resources.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list\n\n :type projects: list of strings\n :param projects: project IDs to include. If not passed,\n defaults to the project bound to the client.... |
Please provide a description of the function:def write_entries(self, entries, logger_name=None, resource=None, labels=None):
data = {"entries": list(entries)}
if logger_name is not None:
data["logName"] = logger_name
if resource is not None:
data["resource"] = ... | [
"API call: log an entry resource via a POST request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write\n\n :type entries: sequence of mapping\n :param entries: the log entry resources to log.\n\n :type logger_name: str\n :param logger_name: ... |
Please provide a description of the function:def logger_delete(self, project, logger_name):
path = "/projects/%s/logs/%s" % (project, logger_name)
self.api_request(method="DELETE", path=path) | [
"API call: delete all entries in a logger via a DELETE request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete\n\n :type project: str\n :param project: ID of project containing the log entries to delete\n\n :type logger_name: str\n ... |
Please provide a description of the function:def list_sinks(self, project, page_size=None, page_token=None):
extra_params = {}
if page_size is not None:
extra_params["pageSize"] = page_size
path = "/projects/%s/sinks" % (project,)
return page_iterator.HTTPIterator(... | [
"List sinks for the project associated with this client.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list\n\n :type project: str\n :param project: ID of the project whose sinks are to be listed.\n\n :type page_size: int\n :param page_... |
Please provide a description of the function:def sink_get(self, project, sink_name):
target = "/projects/%s/sinks/%s" % (project, sink_name)
return self.api_request(method="GET", path=target) | [
"API call: retrieve a sink resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get\n\n :type project: str\n :param project: ID of the project containing the sink.\n\n :type sink_name: str\n :param sink_name: the name of the sink\n\... |
Please provide a description of the function:def sink_update(
self, project, sink_name, filter_, destination, unique_writer_identity=False
):
target = "/projects/%s/sinks/%s" % (project, sink_name)
data = {"name": sink_name, "filter": filter_, "destination": destination}
que... | [
"API call: update a sink resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update\n\n :type project: str\n :param project: ID of the project containing the sink.\n\n :type sink_name: str\n :param sink_name: the name of the sink\n... |
Please provide a description of the function:def sink_delete(self, project, sink_name):
target = "/projects/%s/sinks/%s" % (project, sink_name)
self.api_request(method="DELETE", path=target) | [
"API call: delete a sink resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete\n\n :type project: str\n :param project: ID of the project containing the sink.\n\n :type sink_name: str\n :param sink_name: the name of the sink\n... |
Please provide a description of the function:def list_metrics(self, project, page_size=None, page_token=None):
extra_params = {}
if page_size is not None:
extra_params["pageSize"] = page_size
path = "/projects/%s/metrics" % (project,)
return page_iterator.HTTPItera... | [
"List metrics for the project associated with this client.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/list\n\n :type project: str\n :param project: ID of the project whose metrics are to be listed.\n\n :type page_size: int\n :param... |
Please provide a description of the function:def metric_create(self, project, metric_name, filter_, description=None):
target = "/projects/%s/metrics" % (project,)
data = {"name": metric_name, "filter": filter_, "description": description}
self.api_request(method="POST", path=target, da... | [
"API call: create a metric resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create\n\n :type project: str\n :param project: ID of the project in which to create the metric.\n\n :type metric_name: str\n :param metric_name: the ... |
Please provide a description of the function:def metric_get(self, project, metric_name):
target = "/projects/%s/metrics/%s" % (project, metric_name)
return self.api_request(method="GET", path=target) | [
"API call: retrieve a metric resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get\n\n :type project: str\n :param project: ID of the project containing the metric.\n\n :type metric_name: str\n :param metric_name: the name of t... |
Please provide a description of the function:def metric_delete(self, project, metric_name):
target = "/projects/%s/metrics/%s" % (project, metric_name)
self.api_request(method="DELETE", path=target) | [
"API call: delete a metric resource.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete\n\n :type project: str\n :param project: ID of the project containing the metric.\n\n :type metric_name: str\n :param metric_name: the name of ... |
Please provide a description of the function:def add_row_range_from_keys(
self, start_key=None, end_key=None, start_inclusive=True, end_inclusive=False
):
row_range = RowRange(start_key, end_key, start_inclusive, end_inclusive)
self.row_ranges.append(row_range) | [
"Add row range to row_ranges list from the row keys\n\n For example:\n\n .. literalinclude:: snippets_table.py\n :start-after: [START bigtable_row_range_from_keys]\n :end-before: [END bigtable_row_range_from_keys]\n\n :type start_key: bytes\n :param start_key: (Opti... |
Please provide a description of the function:def _update_message_request(self, message):
for each in self.row_keys:
message.rows.row_keys.append(_to_bytes(each))
for each in self.row_ranges:
r_kwrags = each.get_range_kwargs()
message.rows.row_ranges.add(**r_... | [
"Add row keys and row range to given request message\n\n :type message: class:`data_messages_v2_pb2.ReadRowsRequest`\n :param message: The ``ReadRowsRequest`` protobuf\n "
] |
Please provide a description of the function:def _key(self):
return (self.start_key, self.start_inclusive, self.end_key, self.end_inclusive) | [
"A tuple key that uniquely describes this field.\n\n Used to compute this instance's hashcode and evaluate equality.\n\n Returns:\n Tuple[str]: The contents of this :class:`.RowRange`.\n "
] |
Please provide a description of the function:def get_range_kwargs(self):
range_kwargs = {}
if self.start_key is not None:
start_key_key = "start_key_open"
if self.start_inclusive:
start_key_key = "start_key_closed"
range_kwargs[start_key_key] ... | [
" Convert row range object to dict which can be passed to\n google.bigtable.v2.RowRange add method.\n "
] |
Please provide a description of the function:def report_errors_api(self):
if self._report_errors_api is None:
if self._use_grpc:
self._report_errors_api = make_report_error_api(self)
else:
self._report_errors_api = _ErrorReportingLoggingAPI(
... | [
"Helper for logging-related API calls.\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs\n\n :rtype:\n :class:`_gapic._ErrorReportingGapicApi`\n or\n :cl... |
Please provide a description of the function:def _build_error_report(
self, message, report_location=None, http_context=None, user=None
):
payload = {
"serviceContext": {"service": self.service},
"message": "{0}".format(message),
}
if self.version:
... | [
"Builds the Error Reporting object to report.\n\n This builds the object according to\n\n https://cloud.google.com/error-reporting/docs/formatting-error-messages\n\n :type message: str\n :param message: The stack trace that was reported or logged by the\n service.\n\n ... |
Please provide a description of the function:def _send_error_report(
self, message, report_location=None, http_context=None, user=None
):
error_report = self._build_error_report(
message, report_location, http_context, user
)
self.report_errors_api.report_error_e... | [
"Makes the call to the Error Reporting API.\n\n This is the lower-level interface to build and send the payload,\n generally users will use either report() or report_exception() to\n automatically gather the parameters for this method.\n\n :type message: str\n :param message: The ... |
Please provide a description of the function:def report(self, message, http_context=None, user=None):
stack = traceback.extract_stack()
last_call = stack[-2]
file_path = last_call[0]
line_number = last_call[1]
function_name = last_call[2]
report_location = {
... | [
" Reports a message to Stackdriver Error Reporting\n\n https://cloud.google.com/error-reporting/docs/formatting-error-messages\n\n :type message: str\n :param message: A user-supplied message to report\n\n :type http_context: :class`google.cloud.error_reporting.HTTPContext`\n :par... |
Please provide a description of the function:def report_exception(self, http_context=None, user=None):
self._send_error_report(
traceback.format_exc(), http_context=http_context, user=user
) | [
" Reports the details of the latest exceptions to Stackdriver Error\n Reporting.\n\n :type http_context: :class`google.cloud.error_reporting.HTTPContext`\n :param http_context: The HTTP request which was processed when the\n error was triggered.\n\n ... |
Please provide a description of the function:def current(self):
top = super(Transaction, self).current()
if isinstance(top, Transaction):
return top | [
"Return the topmost transaction.\n\n .. note::\n\n If the topmost element on the stack is not a transaction,\n returns None.\n\n :rtype: :class:`google.cloud.datastore.transaction.Transaction` or None\n :returns: The current transaction (if any are active).\n "
] |
Please provide a description of the function:def begin(self):
super(Transaction, self).begin()
try:
response_pb = self._client._datastore_api.begin_transaction(self.project)
self._id = response_pb.transaction
except: # noqa: E722 do not use bare except, specify ... | [
"Begins a transaction.\n\n This method is called automatically when entering a with\n statement, however it can be called explicitly if you don't want\n to use a context manager.\n\n :raises: :class:`~exceptions.ValueError` if the transaction has\n already begun.\n ... |
Please provide a description of the function:def rollback(self):
try:
# No need to use the response it contains nothing.
self._client._datastore_api.rollback(self.project, self._id)
finally:
super(Transaction, self).rollback()
# Clear our own ID i... | [
"Rolls back the current transaction.\n\n This method has necessary side-effects:\n\n - Sets the current transaction's ID to None.\n "
] |
Please provide a description of the function:def put(self, entity):
if self._options.HasField("read_only"):
raise RuntimeError("Transaction is read only")
else:
super(Transaction, self).put(entity) | [
"Adds an entity to be committed.\n\n Ensures the transaction is not marked readonly.\n Please see documentation at\n :meth:`~google.cloud.datastore.batch.Batch.put`\n\n :type entity: :class:`~google.cloud.datastore.entity.Entity`\n :param entity: the entity to be saved.\n\n ... |
Please provide a description of the function: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.DEFAU... | [
"\n Lists an organization or source's findings.\n\n To list across all sources provide a ``-`` as the source id. Example:\n /v1beta1/organizations/123/sources/-/findings\n\n Example:\n >>> from google.cloud import securitycenter_v1beta1\n >>>\n >>> client... |
Please provide a description of the function:def from_api_repr(cls, resource, client):
metric_name = resource["name"]
filter_ = resource["filter"]
description = resource.get("description", "")
return cls(metric_name, filter_, client=client, description=description) | [
"Factory: construct a metric given its API representation\n\n :type resource: dict\n :param resource: metric resource representation returned from the API\n\n :type client: :class:`google.cloud.logging.client.Client`\n :param client: Client which holds credentials and project\n ... |
Please provide a description of the function:def create(self, client=None):
client = self._require_client(client)
client.metrics_api.metric_create(
self.project, self.name, self.filter_, self.description
) | [
"API call: create the metric via a PUT request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/create\n\n :type client: :class:`~google.cloud.logging.client.Client` or\n ``NoneType``\n :param client: the client to use. If not p... |
Please provide a description of the function:def exists(self, client=None):
client = self._require_client(client)
try:
client.metrics_api.metric_get(self.project, self.name)
except NotFound:
return False
else:
return True | [
"API call: test for the existence of the metric via a GET request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get\n\n :type client: :class:`~google.cloud.logging.client.Client` or\n ``NoneType``\n :param client: the client t... |
Please provide a description of the function:def reload(self, client=None):
client = self._require_client(client)
data = client.metrics_api.metric_get(self.project, self.name)
self.description = data.get("description", "")
self.filter_ = data["filter"] | [
"API call: sync local metric configuration via a GET request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/get\n\n :type client: :class:`~google.cloud.logging.client.Client` or\n ``NoneType``\n :param client: the client to use... |
Please provide a description of the function:def update(self, client=None):
client = self._require_client(client)
client.metrics_api.metric_update(
self.project, self.name, self.filter_, self.description
) | [
"API call: update metric configuration via a PUT request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update\n\n :type client: :class:`~google.cloud.logging.client.Client` or\n ``NoneType``\n :param client: the client to use.... |
Please provide a description of the function:def delete(self, client=None):
client = self._require_client(client)
client.metrics_api.metric_delete(self.project, self.name) | [
"API call: delete a metric via a DELETE request\n\n See\n https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/delete\n\n :type client: :class:`~google.cloud.logging.client.Client` or\n ``NoneType``\n :param client: the client to use. If not ... |
Please provide a description of the function:def _dict_mapping_to_pb(mapping, proto_type):
converted_pb = getattr(trace_pb2, proto_type)()
ParseDict(mapping, converted_pb)
return converted_pb | [
"\n Convert a dict to protobuf.\n\n Args:\n mapping (dict): A dict that needs to be converted to protobuf.\n proto_type (str): The type of the Protobuf.\n\n Returns:\n An instance of the specified protobuf.\n "
] |
Please provide a description of the function:def _span_attrs_to_pb(span_attr, proto_type):
attr_pb = getattr(trace_pb2.Span, proto_type)()
ParseDict(span_attr, attr_pb)
return attr_pb | [
"\n Convert a span attribute dict to protobuf, including Links, Attributes,\n TimeEvents.\n\n Args:\n span_attr (dict): A dict that needs to be converted to protobuf.\n proto_type (str): The type of the Protobuf.\n\n Returns:\n An instance of the specified protobuf.\n "
] |
Please provide a description of the function:def _value_to_pb(value, proto_type):
data_type_pb = getattr(google_dot_protobuf_dot_wrappers__pb2, proto_type)()
ParseDict(value, data_type_pb)
return data_type_pb | [
"\n Convert a value to protobuf. e.g. BoolValue, Int32Value.\n\n Args:\n value (dict): A dict that needs to be converted to protobuf.\n proto_type (str): The type of the Protobuf.\n\n Returns:\n An instance of the specified protobuf.\n "
] |
Please provide a description of the function:def batch_write_spans(
self, name, spans, retry=method.DEFAULT, timeout=method.DEFAULT
):
spans_pb_list = []
for span_mapping in spans["spans"]:
span_pb = _dict_mapping_to_pb(span_mapping, "Span")
spans_pb_list.ap... | [
"\n Sends new spans to Stackdriver Trace or updates existing traces. If the\n name of a trace that you send matches that of an existing trace, new\n spans are added to the existing trace. Attempt to update existing spans\n results undefined behavior. If the name does not match, a new tra... |
Please provide a description of the function: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,
... | [
"\n Creates a new Span.\n\n Example:\n >>> from google.cloud import trace_v2\n >>>\n >>> client = trace_v2.TraceServiceClient()\n >>>\n >>> name = client.span_path('[PROJECT]', '[TRACE]', '[SPAN]')\n >>> span_id = ''\n >>> di... |
Please provide a description of the function:def from_pb(cls, cluster_pb, instance):
match_cluster_name = _CLUSTER_NAME_RE.match(cluster_pb.name)
if match_cluster_name is None:
raise ValueError(
"Cluster protobuf name was not in the " "expected format.",
... | [
"Creates an cluster instance from a protobuf.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_cluster_from_pb]\n :end-before: [END bigtable_cluster_from_pb]\n\n :type cluster_pb: :class:`instance_pb2.Cluster`\n :param cluster_pb:... |
Please provide a description of the function:def _update_from_pb(self, cluster_pb):
self.location_id = cluster_pb.location.split("/")[-1]
self.serve_nodes = cluster_pb.serve_nodes
self.default_storage_type = cluster_pb.default_storage_type
self._state = cluster_pb.state | [
"Refresh self from the server-provided protobuf.\n Helper for :meth:`from_pb` and :meth:`reload`.\n "
] |
Please provide a description of the function:def name(self):
return self._instance._client.instance_admin_client.cluster_path(
self._instance._client.project, self._instance.instance_id, self.cluster_id
) | [
"Cluster name used in requests.\n\n .. note::\n This property will not change if ``_instance`` and ``cluster_id``\n do not, but the return value is not cached.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_cluster_name]\n ... |
Please provide a description of the function:def reload(self):
cluster_pb = self._instance._client.instance_admin_client.get_cluster(self.name)
# NOTE: _update_from_pb does not check that the project and
# cluster ID on the response match the request.
self._update_from_pb... | [
"Reload the metadata for this cluster.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_reload_cluster]\n :end-before: [END bigtable_reload_cluster]\n "
] |
Please provide a description of the function:def exists(self):
client = self._instance._client
try:
client.instance_admin_client.get_cluster(name=self.name)
return True
# NOTE: There could be other exceptions that are returned to the user.
except NotFound... | [
"Check whether the cluster already exists.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_check_cluster_exists]\n :end-before: [END bigtable_check_cluster_exists]\n\n :rtype: bool\n :returns: True if the table exists, else False... |
Please provide a description of the function:def create(self):
client = self._instance._client
cluster_pb = self._to_pb()
return client.instance_admin_client.create_cluster(
self._instance.name, self.cluster_id, cluster_pb
) | [
"Create this cluster.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_create_cluster]\n :end-before: [END bigtable_create_cluster]\n\n .. note::\n\n Uses the ``project``, ``instance`` and ``cluster_id`` on the\n cu... |
Please provide a description of the function:def update(self):
client = self._instance._client
# We are passing `None` for second argument location.
# Location is set only at the time of creation of a cluster
# and can not be changed after cluster has been created.
retur... | [
"Update this cluster.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_update_cluster]\n :end-before: [END bigtable_update_cluster]\n\n .. note::\n\n Updates the ``serve_nodes``. If you'd like to\n change them befor... |
Please provide a description of the function:def delete(self):
client = self._instance._client
client.instance_admin_client.delete_cluster(self.name) | [
"Delete this cluster.\n\n For example:\n\n .. literalinclude:: snippets.py\n :start-after: [START bigtable_delete_cluster]\n :end-before: [END bigtable_delete_cluster]\n\n Marks a cluster and all of its tables for permanent deletion in 7 days.\n\n Immediately upon c... |
Please provide a description of the function:def _to_pb(self):
client = self._instance._client
location = client.instance_admin_client.location_path(
client.project, self.location_id
)
cluster_pb = instance_pb2.Cluster(
location=location,
serv... | [
" Create cluster proto buff message for API calls "
] |
Please provide a description of the function:def from_pb(cls, cell_pb):
if cell_pb.labels:
return cls(cell_pb.value, cell_pb.timestamp_micros, labels=cell_pb.labels)
else:
return cls(cell_pb.value, cell_pb.timestamp_micros) | [
"Create a new cell from a Cell protobuf.\n\n :type cell_pb: :class:`._generated.data_pb2.Cell`\n :param cell_pb: The protobuf to convert.\n\n :rtype: :class:`Cell`\n :returns: The cell corresponding to the protobuf.\n "
] |
Please provide a description of the function:def to_dict(self):
result = {}
for column_family_id, columns in six.iteritems(self._cells):
for column_qual, cells in six.iteritems(columns):
key = _to_bytes(column_family_id) + b":" + _to_bytes(column_qual)
... | [
"Convert the cells to a dictionary.\n\n This is intended to be used with HappyBase, so the column family and\n column qualiers are combined (with ``:``).\n\n :rtype: dict\n :returns: Dictionary containing all the data in the cells of this row.\n "
] |
Please provide a description of the function:def find_cells(self, column_family_id, column):
try:
column_family = self._cells[column_family_id]
except KeyError:
raise KeyError(_MISSING_COLUMN_FAMILY.format(column_family_id))
try:
cells = column_famil... | [
"Get a time series of cells stored on this instance.\n\n For example:\n\n .. literalinclude:: snippets_table.py\n :start-after: [START bigtable_row_find_cells]\n :end-before: [END bigtable_row_find_cells]\n\n Args:\n column_family_id (str): The ID of the column ... |
Please provide a description of the function:def cell_value(self, column_family_id, column, index=0):
cells = self.find_cells(column_family_id, column)
try:
cell = cells[index]
except (TypeError, IndexError):
num_cells = len(cells)
msg = _MISSING_IND... | [
"Get a single cell value stored on this instance.\n\n For example:\n\n .. literalinclude:: snippets_table.py\n :start-after: [START bigtable_row_cell_value]\n :end-before: [END bigtable_row_cell_value]\n\n Args:\n column_family_id (str): The ID of the column fam... |
Please provide a description of the function:def cell_values(self, column_family_id, column, max_count=None):
cells = self.find_cells(column_family_id, column)
if max_count is None:
max_count = len(cells)
for index, cell in enumerate(cells):
if index == max_coun... | [
"Get a time series of cells stored on this instance.\n\n For example:\n\n .. literalinclude:: snippets_table.py\n :start-after: [START bigtable_row_cell_values]\n :end-before: [END bigtable_row_cell_values]\n\n Args:\n column_family_id (str): The ID of the colum... |
Please provide a description of the function:def consume_all(self, max_loops=None):
for row in self:
self.rows[row.row_key] = row | [
"Consume the streamed responses until there are no more.\n\n .. warning::\n This method will be removed in future releases. Please use this\n class as a generator instead.\n\n :type max_loops: int\n :param max_loops: (Optional) Maximum number of times to try to consume\n ... |
Please provide a description of the function:def _create_retry_request(self):
req_manager = _ReadRowsRequestManager(
self.request, self.last_scanned_row_key, self._counter
)
return req_manager.build_updated_request() | [
"Helper for :meth:`__iter__`."
] |
Please provide a description of the function:def _on_error(self, exc):
# restart the read scan from AFTER the last successfully read row
retry_request = self.request
if self.last_scanned_row_key:
retry_request = self._create_retry_request()
self.response_iterator = ... | [
"Helper for :meth:`__iter__`."
] |
Please provide a description of the function:def _save_current_cell(self):
row, cell = self._row, self._cell
family = row._cells.setdefault(cell.family_name, {})
qualified = family.setdefault(cell.qualifier, [])
complete = Cell.from_pb(cell)
qualified.append(complete)
... | [
"Helper for :meth:`consume_next`."
] |
Please provide a description of the function:def _copy_from_previous(self, cell):
previous = self._previous_cell
if previous is not None:
if not cell.row_key:
cell.row_key = previous.row_key
if not cell.family_name:
cell.family_nam... | [
"Helper for :meth:`consume_next`."
] |
Please provide a description of the function:def build_updated_request(self):
r_kwargs = {
"table_name": self.message.table_name,
"filter": self.message.filter,
}
if self.message.rows_limit != 0:
r_kwargs["rows_limit"] = max(
1, self.... | [
" Updates the given message request as per last scanned key\n "
] |
Please provide a description of the function:def _filter_rows_keys(self):
return [
row_key
for row_key in self.message.rows.row_keys
if row_key > self.last_scanned_key
] | [
" Helper for :meth:`build_updated_request`"
] |
Please provide a description of the function:def _filter_row_ranges(self):
new_row_ranges = []
for row_range in self.message.rows.row_ranges:
# if current end_key (open or closed) is set, return its value,
# if not, set to empty string ('').
# NOTE: Empty st... | [
" Helper for :meth:`build_updated_request`"
] |
Please provide a description of the function:def patch_traces(
self,
project_id,
traces,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry and tim... | [
"\n Sends new traces to Stackdriver Trace or updates existing traces. If the ID\n of a trace that you send matches that of an existing trace, any fields\n in the existing trace and its spans are overwritten by the provided values,\n and any new fields provided are merged with the existin... |
Please provide a description of the function:def get_trace(
self,
project_id,
trace_id,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry and time... | [
"\n Gets a single trace by its ID.\n\n Example:\n >>> from google.cloud import trace_v1\n >>>\n >>> client = trace_v1.TraceServiceClient()\n >>>\n >>> # TODO: Initialize `project_id`:\n >>> project_id = ''\n >>>\n ... |
Please provide a description of the function:def list_traces(
self,
project_id,
view=None,
page_size=None,
start_time=None,
end_time=None,
filter_=None,
order_by=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.g... | [
"\n Returns of a list of traces that match the specified filter conditions.\n\n Example:\n >>> from google.cloud import trace_v1\n >>>\n >>> client = trace_v1.TraceServiceClient()\n >>>\n >>> # TODO: Initialize `project_id`:\n >>> proje... |
Please provide a description of the function:def get_instance(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry and timeout logic.
if... | [
"\n Gets the details of a specific Redis instance.\n\n Example:\n >>> from google.cloud import redis_v1beta1\n >>>\n >>> client = redis_v1beta1.CloudRedisClient()\n >>>\n >>> name = client.instance_path('[PROJECT]', '[LOCATION]', '[INSTANCE]')\n ... |
Please provide a description of the function:def update_instance(
self,
update_mask,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
# Wrap the transport method to add retry a... | [
"\n Updates the metadata and configuration of a specific Redis instance.\n\n Completed longrunning.Operation will contain the new instance object\n in the response field. The returned operation is automatically deleted\n after a few hours, so there is no need to call DeleteOperation.\n\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.