Search is not available for this dataset
text
stringlengths
75
104k
def set_field_value(document_data, field_path, value): """Set a value into a document for a field_path""" current = document_data for element in field_path.parts[:-1]: current = current.setdefault(element, {}) if value is _EmptyDict: value = {} current[field_path.parts[-1]] = value
def pbs_for_create(document_path, document_data): """Make ``Write`` protobufs for ``create()`` methods. Args: document_path (str): A fully-qualified document path. document_data (dict): Property names and values to use for creating a document. Returns: List[google.cloud...
def pbs_for_set_no_merge(document_path, document_data): """Make ``Write`` protobufs for ``set()`` methods. Args: document_path (str): A fully-qualified document path. document_data (dict): Property names and values to use for replacing a document. Returns: List[google.c...
def pbs_for_set_with_merge(document_path, document_data, merge): """Make ``Write`` protobufs for ``set()`` methods. Args: document_path (str): A fully-qualified document path. document_data (dict): Property names and values to use for replacing a document. merge (Optional[bo...
def pbs_for_update(document_path, field_updates, option): """Make ``Write`` protobufs for ``update()`` methods. Args: document_path (str): A fully-qualified document path. field_updates (dict): Field names or paths to update and values to update with. option (optional[~.fire...
def pb_for_delete(document_path, option): """Make a ``Write`` protobuf for ``delete()`` methods. Args: document_path (str): A fully-qualified document path. option (optional[~.firestore_v1beta1.client.WriteOption]): A write option to make assertions / preconditions on the server ...
def get_transaction_id(transaction, read_operation=True): """Get the transaction ID from a ``Transaction`` object. Args: transaction (Optional[~.firestore_v1beta1.transaction.\ Transaction]): An existing transaction that this query will run in. read_operation (Optional[b...
def modify_write(self, write_pb, **unused_kwargs): """Modify a ``Write`` protobuf based on the state of this write option. The ``last_update_time`` is added to ``write_pb`` as an "update time" precondition. When set, the target document must exist and have been last updated at that time...
def modify_write(self, write_pb, **unused_kwargs): """Modify a ``Write`` protobuf based on the state of this write option. If: * ``exists=True``, adds a precondition that requires existence * ``exists=False``, adds a precondition that requires non-existence Args: w...
def uptime_check_config_path(cls, project, uptime_check_config): """Return a fully-qualified uptime_check_config string.""" return google.api_core.path_template.expand( "projects/{project}/uptimeCheckConfigs/{uptime_check_config}", project=project, uptime_check_config...
def create_uptime_check_config( self, parent, uptime_check_config, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Creates a new uptime check configuration. Example: ...
def annotate_video( self, input_uri=None, input_content=None, features=None, video_context=None, output_uri=None, location_id=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=Non...
def owners(self): """Legacy access to owner role. DEPRECATED: use ``policy["roles/owners"]`` instead.""" result = set() for role in self._OWNER_ROLES: for member in self._bindings.get(role, ()): result.add(member) return frozenset(result)
def owners(self, value): """Update owners. DEPRECATED: use ``policy["roles/owners"] = value`` instead.""" warnings.warn( _ASSIGNMENT_DEPRECATED_MSG.format("owners", OWNER_ROLE), DeprecationWarning ) self[OWNER_ROLE] = value
def editors(self): """Legacy access to editor role. DEPRECATED: use ``policy["roles/editors"]`` instead.""" result = set() for role in self._EDITOR_ROLES: for member in self._bindings.get(role, ()): result.add(member) return frozenset(result)
def editors(self, value): """Update editors. DEPRECATED: use ``policy["roles/editors"] = value`` instead.""" warnings.warn( _ASSIGNMENT_DEPRECATED_MSG.format("editors", EDITOR_ROLE), DeprecationWarning, ) self[EDITOR_ROLE] = value
def viewers(self): """Legacy access to viewer role. DEPRECATED: use ``policy["roles/viewers"]`` instead """ result = set() for role in self._VIEWER_ROLES: for member in self._bindings.get(role, ()): result.add(member) return frozenset(result)
def viewers(self, value): """Update viewers. DEPRECATED: use ``policy["roles/viewers"] = value`` instead. """ warnings.warn( _ASSIGNMENT_DEPRECATED_MSG.format("viewers", VIEWER_ROLE), DeprecationWarning, ) self[VIEWER_ROLE] = value
def from_api_repr(cls, resource): """Factory: create a policy from a JSON resource. Args: resource (dict): policy resource returned by ``getIamPolicy`` API. Returns: :class:`Policy`: the parsed policy """ version = resource.get("version") etag = ...
def to_api_repr(self): """Render a JSON policy resource. Returns: dict: a resource to be passed to the ``setIamPolicy`` API. """ resource = {} if self.etag is not None: resource["etag"] = self.etag if self.version is not None: resour...
def _reference_info(references): """Get information about document references. Helper for :meth:`~.firestore_v1beta1.client.Client.get_all`. Args: references (List[.DocumentReference, ...]): Iterable of document references. Returns: Tuple[List[str, ...], Dict[str, .Documen...
def _get_reference(document_path, reference_map): """Get a document reference from a dictionary. This just wraps a simple dictionary look-up with a helpful error that is specific to :meth:`~.firestore.client.Client.get_all`, the **public** caller of this function. Args: document_path (str)...
def _parse_batch_get(get_doc_response, reference_map, client): """Parse a `BatchGetDocumentsResponse` protobuf. Args: get_doc_response (~google.cloud.proto.firestore.v1beta1.\ firestore_pb2.BatchGetDocumentsResponse): A single response (from a stream) containing the "get" respon...
def _firestore_api(self): """Lazy-loading getter GAPIC Firestore API. Returns: ~.gapic.firestore.v1beta1.firestore_client.FirestoreClient: The GAPIC client with the credentials of the current client. """ if self._firestore_api_internal is None: self._...
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: ...
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...
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') ...
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...
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: * ``...
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 `...
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( ...
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...
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...
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) ...
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...
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...
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...
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...
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...
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...
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...
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...
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] ) ...
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[...
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...
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...
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...
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=...
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, )
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 )
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...
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...
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, ): ...
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,...
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 ...
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...
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...
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...
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...
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
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 ...
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...
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...
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...
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...
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 """ ...
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; ...
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...
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, )
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...
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...
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....
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...
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...
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. ...
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: ...
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 ...
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, )
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, ...
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, )
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, ...
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...
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...
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...
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: ...
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...
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...
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...
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 ...
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...
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...
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 ...
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...
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...
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 ...
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: ...
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] ...
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...
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_...
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...