[−][src]Crate google_dlp2_beta1
This documentation was generated from DLP crate version 1.0.12+20171205, where 20171205 is the exact revision of the dlp:v2beta1 schema built by the mako code generator v1.0.12.
Everything else about the DLP v2_beta1 API can be found at the official documentation site. The original source code is on github.
Features
Handle the following Resources with ease from the central hub ...
- content
- deidentify, inspect and redact
- data source
- analyze
- inspect
- operations cancel, operations create, operations delete, operations get, operations list and results findings list
- risk analysis
- operations cancel, operations delete, operations get and operations list
- root categories
- info types list and list
Not what you are looking for ? Find all other Google APIs in their Rust documentation index.
Structure of this Library
The API is structured into the following primary items:
- Hub
- a central object to maintain state and allow accessing all Activities
- creates Method Builders which in turn allow access to individual Call Builders
- Resources
- primary types that you can apply Activities to
- a collection of properties and Parts
- Parts
- a collection of properties
- never directly used in Activities
- Activities
- operations to apply to Resources
All structures are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke Activities like this:
let r = hub.resource().activity(...).doit()
Or specifically ...
let r = hub.data_source().analyze(...).doit() let r = hub.risk_analysis().operations_get(...).doit() let r = hub.inspect().operations_get(...).doit() let r = hub.inspect().operations_create(...).doit()
The resource()
and activity(...)
calls create builders. The second one dealing with Activities
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
specified right away (i.e. (...)
), whereas all optional ones can be build up as desired.
The doit()
method performs the actual communication with the server and returns the respective result.
Usage
Setting up your Project
To use this library, you would put the following lines into your Cargo.toml
file:
[dependencies]
google-dlp2_beta1 = "*"
# This project intentionally uses an old version of Hyper. See
# https://github.com/Byron/google-apis-rs/issues/173 for more
# information.
hyper = "^0.10"
hyper-rustls = "^0.6"
serde = "^1.0"
serde_json = "^1.0"
yup-oauth2 = "^1.0"
A complete example
extern crate hyper; extern crate hyper_rustls; extern crate yup_oauth2 as oauth2; extern crate google_dlp2_beta1 as dlp2_beta1; use dlp2_beta1::GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest; use dlp2_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; use dlp2_beta1::DLP; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. let secret: ApplicationSecret = Default::default(); // Instantiate the authenticator. It will choose a suitable authentication flow for you, // unless you replace `None` with the desired Flow. // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and // retrieve them from storage. let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), <MemoryStorage as Default>::default(), None); let mut hub = DLP::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.data_source().analyze(req) .doit(); match result { Err(e) => match e { // The Error enum provides details about what exactly happened. // You can also just use its `Debug`, `Display` or `Error` traits Error::HttpError(_) |Error::MissingAPIKey |Error::MissingToken(_) |Error::Cancelled |Error::UploadSizeLimitExceeded(_, _) |Error::Failure(_) |Error::BadRequest(_) |Error::FieldClash(_) |Error::JsonDecodeError(_, _) => println!("{}", e), }, Ok(res) => println!("Success: {:?}", res), }
Handling Errors
All errors produced by the system are provided either as Result enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the Hub Delegate, or the Authenticator Delegate.
When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors.
Uploads and Downloads
If a method supports downloads, the response body, which is part of the Result, should be
read by you to obtain the media.
If such a method also supports a Response Result, it will return that by default.
You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
this call: .param("alt", "media")
.
Methods supporting uploads can do so using up to 2 different protocols:
simple and resumable. The distinctiveness of each is represented by customized
doit(...)
methods, which are then named upload(...)
and upload_resumable(...)
respectively.
Customization and Callbacks
You may alter the way an doit()
method is called by providing a delegate to the
Method Builder before making the final doit()
call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The delegate trait is default-implemented, allowing you to customize it with minimal effort.
Optional Parts in Server-Requests
All structures provided by this library are made to be enocodable and decodable via json. Optionals are used to indicate that partial requests are responses are valid. Most optionals are are considered Parts which are identifiable by name, which will be sent to the server to indicate either the set parts of the request or the desired parts in the response.
Builder Arguments
Using method builders, you are able to prepare an action call by repeatedly calling it's methods. These will always take a single argument, for which the following statements are true.
- PODs are handed by copy
- strings are passed as
&str
- request values are moved
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
Structs
Chunk | |
ContentDeidentifyCall | De-identifies potentially sensitive info from a list of strings. This method has limits on input size and output size. |
ContentInspectCall | Finds potentially sensitive info in a list of strings. This method has limits on input size, processing time, and output size. |
ContentMethods | A builder providing access to all methods supported on content resources.
It is not used directly, but through the |
ContentRange | Implements the Content-Range header, for serialization only |
ContentRedactCall | Redacts potentially sensitive info from a list of strings. This method has limits on input size, processing time, and output size. |
DLP | Central instance to access all DLP related resource activities |
DataSourceAnalyzeCall | Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform repository. |
DataSourceMethods | A builder providing access to all methods supported on dataSource resources.
It is not used directly, but through the |
DefaultDelegate | A delegate with a conservative default implementation, which is used if no other delegate is set. |
DummyNetworkStream | |
ErrorResponse | A utility to represent detailed errors we might see in case there are BadRequests. The latter happen if the sent parameters or request structures are unsound |
GoogleLongrunningCancelOperationRequest | The request message for Operations.CancelOperation. |
GoogleLongrunningListOperationsResponse | The response message for Operations.ListOperations. |
GoogleLongrunningOperation | This resource represents a long-running operation that is the result of a network API call. |
GooglePrivacyDlpV2beta1TableLocation | Location of a finding within a |
GooglePrivacyDlpV2beta1CategoryDescription | Info Type Category description. |
GooglePrivacyDlpV2beta1SummaryResult | A collection that informs the user the number of times a particular
|
GooglePrivacyDlpV2beta1CryptoKey | This is a data encryption key (DEK) (as opposed to a key encryption key (KEK) stored by KMS). When using KMS to wrap/unwrap DEKs, be sure to set an appropriate IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot unwrap the data crypto key. |
GooglePrivacyDlpV2beta1TaggedField | A column with a semantic tag attached. |
GooglePrivacyDlpV2beta1FileSet | Set of files to scan. |
GooglePrivacyDlpV2beta1FixedSizeBucketingConfig | Buckets values based on fixed size ranges. The Bucketing transformation can provide all of this functionality, but requires more configuration. This message is provided as a convenience to the user for simple bucketing strategies. The resulting value will be a hyphenated string of lower_bound-upper_bound. This can be used on data of type: double, long. If the bound Value type differs from the type of data being transformed, we will first attempt converting the type of the data to be transformed to match the type of the bound before comparing. |
GooglePrivacyDlpV2beta1DeidentifyContentRequest | Request to de-identify a list of items. |
GooglePrivacyDlpV2beta1RedactContentResponse | Results of redacting a list of items. |
GooglePrivacyDlpV2beta1KMapEstimationConfig | Reidentifiability metric. This corresponds to a risk model similar to what is called "journalist risk" in the literature, except the attack dataset is statistically modeled instead of being perfectly known. This can be done using publicly available data (like the US Census), or using a custom statistical model (indicated as one or several BigQuery tables), or by extrapolating from the distribution of values in the input dataset. |
GooglePrivacyDlpV2beta1FieldTransformation | The transformation to apply to the field. |
GooglePrivacyDlpV2beta1TransformationSummary | Summary of a single tranformation. |
GooglePrivacyDlpV2beta1Expressions | A collection of expressions |
GooglePrivacyDlpV2beta1ReplaceConfig | There is no detailed description. |
GooglePrivacyDlpV2beta1ImageRedactionConfig | Configuration for determining how redaction of images should occur. |
GooglePrivacyDlpV2beta1BigQueryTable | Message defining the location of a BigQuery table. A table is uniquely
identified by its project_id, dataset_id, and table_name. Within a query
a table is often referenced with a string in the format of:
|
GooglePrivacyDlpV2beta1Bucket | Buckets represented as ranges, along with replacement values. Ranges must be non-overlapping. |
GooglePrivacyDlpV2beta1KAnonymityConfig | k-anonymity metric, used for analysis of reidentification risk. |
GooglePrivacyDlpV2beta1InspectConfig | Configuration description of the scanning process. When used with redactContent only info_types and min_likelihood are currently used. |
GooglePrivacyDlpV2beta1PartitionId | Datastore partition ID. A partition ID identifies a grouping of entities. The grouping is always by project and namespace, however the namespace ID may be empty. |
GooglePrivacyDlpV2beta1RedactContentRequest | Request to search for potentially sensitive info in a list of items and replace it with a default or provided content. |
GooglePrivacyDlpV2beta1ImageLocation | Bounding box encompassing detected text within an image. |
GooglePrivacyDlpV2beta1CustomInfoType | Custom information type provided by the user. Used to find domain-specific sensitive information configurable to the data in question. |
GooglePrivacyDlpV2beta1NumericalStatsConfig | Compute numerical stats over an individual column, including min, max, and quantiles. |
GooglePrivacyDlpV2beta1UnwrappedCryptoKey | Using raw keys is prone to security risks due to accidentally leaking the key. Choose another type of key if possible. |
GooglePrivacyDlpV2beta1OperationConfig | Additional configuration for inspect long running operations. |
GooglePrivacyDlpV2beta1PrimitiveTransformation | A rule for transforming a value. |
GooglePrivacyDlpV2beta1Dictionary | Custom information type based on a dictionary of words or phrases. This can be used to match sensitive information specific to the data, such as a list of employee IDs or job titles. |
GooglePrivacyDlpV2beta1DeidentifyContentResponse | Results of de-identifying a list of items. |
GooglePrivacyDlpV2beta1InfoType | Type of information detected by the API. |
GooglePrivacyDlpV2beta1StorageConfig | Shared message indicating Cloud storage type. |
GooglePrivacyDlpV2beta1Projection | A representation of a Datastore property in a projection. |
GooglePrivacyDlpV2beta1Key | A unique identifier for a Datastore entity. If a key's partition ID or any of its path kinds or names are reserved/read-only, the key is reserved/read-only. A reserved/read-only key is forbidden in certain documented contexts. |
GooglePrivacyDlpV2beta1InfoTypeTransformations | A type of transformation that will scan unstructured text and
apply various |
GooglePrivacyDlpV2beta1Row | There is no detailed description. |
GooglePrivacyDlpV2beta1DeidentificationSummary | High level summary of deidentification. |
GooglePrivacyDlpV2beta1SurrogateType | Message for detecting output from deidentification transformations
such as
|
GooglePrivacyDlpV2beta1CloudStoragePath | A location in Cloud Storage. |
GooglePrivacyDlpV2beta1TimePartConfig | For use with |
GooglePrivacyDlpV2beta1ListRootCategoriesResponse | Response for ListRootCategories request. |
GooglePrivacyDlpV2beta1Finding | Container structure describing a single finding within a string or image. |
GooglePrivacyDlpV2beta1PropertyReference | A reference to a property relative to the Datastore kind expressions. |
GooglePrivacyDlpV2beta1RecordKey | Message for a unique key indicating a record that contains a finding. |
GooglePrivacyDlpV2beta1FieldId | General identifier of a data field in a storage service. |
GooglePrivacyDlpV2beta1CharacterMaskConfig | Partially mask a string by replacing a given number of characters with a fixed character. Masking can start from the beginning or end of the string. This can be used on data of any type (numbers, longs, and so on) and when de-identifying structured data we'll attempt to preserve the original data's type. (This allows you to take a long like 123 and modify it to a string like **3. |
GooglePrivacyDlpV2beta1RedactConfig | Redact a given value. For example, if used with an |
GooglePrivacyDlpV2beta1WordList | Message defining a list of words or phrases to search for in the data. |
GooglePrivacyDlpV2beta1ReplaceValueConfig | Replace each input value with a given |
GooglePrivacyDlpV2beta1PathElement | A (kind, ID/name) pair used to construct a key path. |
GooglePrivacyDlpV2beta1CloudStorageOptions | Options defining a file or a set of files (path ending with *) within a Google Cloud Storage bucket. |
GooglePrivacyDlpV2beta1InspectResult | All the findings for a single scanned item. |
GooglePrivacyDlpV2beta1CryptoReplaceFfxFpeConfig | Replaces an identifier with a surrogate using FPE with the FFX mode of operation. The identifier must be representable by the US-ASCII character set. For a given crypto key and context, the same identifier will be replaced with the same surrogate. Identifiers must be at least two characters long. In the case that the identifier is the empty string, it will be skipped. |
GooglePrivacyDlpV2beta1CloudStorageKey | Record key for a finding in a Cloud Storage file. |
GooglePrivacyDlpV2beta1InspectContentResponse | Results of inspecting a list of items. |
GooglePrivacyDlpV2beta1Conditions | There is no detailed description. |
GooglePrivacyDlpV2beta1Color | Represents a color in the RGB color space. |
GooglePrivacyDlpV2beta1BucketingConfig | Generalization function that buckets values based on ranges. The ranges and
replacement values are dynamically provided by the user for custom behavior,
such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH
This can be used on
data of type: number, long, string, timestamp.
If the bound |
GooglePrivacyDlpV2beta1DeidentifyConfig | The configuration that controls how the data will change. |
GooglePrivacyDlpV2beta1TransientCryptoKey | Use this to have a random data crypto key generated. It will be discarded after the operation/request finishes. |
GooglePrivacyDlpV2beta1OutputStorageConfig | Cloud repository for storing output. |
GooglePrivacyDlpV2beta1QuasiIdField | A quasi-identifier column has a custom_tag, used to know which column in the data corresponds to which column in the statistical model. |
GooglePrivacyDlpV2beta1CryptoHashConfig | Pseudonymization method that generates surrogates via cryptographic hashing. Uses SHA-256. Outputs a 32 byte digest as an uppercase hex string (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE). Currently, only string and integer values can be hashed. |
GooglePrivacyDlpV2beta1LDiversityConfig | l-diversity metric, used for analysis of reidentification risk. |
GooglePrivacyDlpV2beta1CreateInspectOperationRequest | Request for scheduling a scan of a data subset from a Google Platform data repository. |
GooglePrivacyDlpV2beta1InfoTypeLimit | Max findings configuration per info type, per content item or long running operation. |
GooglePrivacyDlpV2beta1AuxiliaryTable | An auxiliary table contains statistical information on the relative frequency of different quasi-identifiers values. It has one or several quasi-identifiers columns, and one column that indicates the relative frequency of each quasi-identifier tuple. If a tuple is present in the data but not in the auxiliary table, the corresponding relative frequency is assumed to be zero (and thus, the tuple is highly reidentifiable). |
GooglePrivacyDlpV2beta1Condition | The field type of |
GooglePrivacyDlpV2beta1InfoTypeDescription | Description of the information type (infoType). |
GooglePrivacyDlpV2beta1KindExpression | A representation of a Datastore kind. |
GooglePrivacyDlpV2beta1ReplaceWithInfoTypeConfig | Replace each matching finding with the name of the info_type. |
GooglePrivacyDlpV2beta1InspectContentRequest | Request to search for potentially sensitive info in a list of items. |
GooglePrivacyDlpV2beta1ListInspectFindingsResponse | Response to the ListInspectFindings request. |
GooglePrivacyDlpV2beta1RecordCondition | A condition for determining whether a transformation should be applied to a field. |
GooglePrivacyDlpV2beta1Value | Set of primitive values supported by the system. |
GooglePrivacyDlpV2beta1PrivacyMetric | Privacy metric to compute for reidentification risk analysis. |
GooglePrivacyDlpV2beta1AnalyzeDataSourceRiskRequest | Request for creating a risk analysis operation. |
GooglePrivacyDlpV2beta1DatastoreOptions | Options defining a data set within Google Cloud Datastore. |
GooglePrivacyDlpV2beta1EntityId | An entity in a dataset is a field or set of fields that correspond to a
single person. For example, in medical records the |
GooglePrivacyDlpV2beta1CharsToIgnore | Characters to skip when doing deidentification of a value. These will be left alone and skipped. |
GooglePrivacyDlpV2beta1ContentItem | Container structure for the content to inspect. |
GooglePrivacyDlpV2beta1Location | Specifies the location of a finding within its source item. |
GooglePrivacyDlpV2beta1DatastoreKey | Record key for a finding in Cloud Datastore. |
GooglePrivacyDlpV2beta1ListInfoTypesResponse | Response to the ListInfoTypes request. |
GooglePrivacyDlpV2beta1RecordTransformations | A type of transformation that is applied over structured data such as a table. |
GooglePrivacyDlpV2beta1Table | Structured content to inspect. Up to 50,000 |
GooglePrivacyDlpV2beta1BigQueryOptions | Options defining BigQuery table and row identifiers. |
GooglePrivacyDlpV2beta1KmsWrappedCryptoKey | Include to use an existing data crypto key wrapped by KMS. Authorization requires the following IAM permissions when sending a request to perform a crypto transformation using a kms-wrapped crypto key: dlp.kms.encrypt |
GooglePrivacyDlpV2beta1Range | Generic half-open interval [start, end) |
GooglePrivacyDlpV2beta1InfoTypeTransformation | A transformation to apply to text that is identified as a specific info_type. |
GooglePrivacyDlpV2beta1RecordSuppression | Configuration to suppress records whose suppression conditions evaluate to true. |
GooglePrivacyDlpV2beta1CategoricalStatsConfig | Compute numerical stats over an individual column, including number of distinct values and value count distribution. |
GoogleProtobufEmpty | A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: |
GoogleRpcStatus | The |
GoogleTypeDate | Represents a whole calendar date, e.g. date of birth. The time of day and
time zone are either specified elsewhere or are not significant. The date
is relative to the Proleptic Gregorian Calendar. The day may be 0 to
represent a year and month where the day is not significant, e.g. credit card
expiration date. The year may be 0 to represent a month and day independent
of year, e.g. anniversary date. Related types are google.type.TimeOfDay
and |
GoogleTypeTimeOfDay | Represents a time of day. The date and time zone are either not significant
or are specified elsewhere. An API may choose to allow leap seconds. Related
types are google.type.Date and |
InspectMethods | A builder providing access to all methods supported on inspect resources.
It is not used directly, but through the |
InspectOperationCancelCall | Cancels an operation. Use the |
InspectOperationCreateCall | Schedules a job scanning content in a Google Cloud Platform data repository. |
InspectOperationDeleteCall | This method is not supported and the server returns |
InspectOperationGetCall | Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. |
InspectOperationListCall | Fetches the list of long running operations. |
InspectResultFindingListCall | Returns list of results for given inspect operation result set id. |
JsonServerError | A utility type which can decode a server response that indicates error |
MethodInfo | Contains information about an API request. |
MultiPartReader | Provides a |
RangeResponseHeader | |
ResumableUploadHelper | A utility type to perform a resumable upload from start to end. |
RiskAnalysiMethods | A builder providing access to all methods supported on riskAnalysi resources.
It is not used directly, but through the |
RiskAnalysiOperationCancelCall | Cancels an operation. Use the |
RiskAnalysiOperationDeleteCall | This method is not supported and the server returns |
RiskAnalysiOperationGetCall | Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. |
RiskAnalysiOperationListCall | Fetches the list of long running operations. |
RootCategoryInfoTypeListCall | Returns sensitive information types for given category. |
RootCategoryListCall | Returns the list of root categories of sensitive information. |
RootCategoryMethods | A builder providing access to all methods supported on rootCategory resources.
It is not used directly, but through the |
ServerError | |
ServerMessage | |
XUploadContentType | The |
Enums
Error | |
Scope | Identifies the an OAuth2 authorization scope. A scope is needed when requesting an authorization token. |
Traits
CallBuilder | Identifies types which represent builders for a particular resource method |
Delegate | A trait specifying functionality to help controlling any request performed by the API. The trait has a conservative default implementation. |
Hub | Identifies the Hub. There is only one per library, this trait is supposed to make intended use more explicit. The hub allows to access all resource methods more easily. |
MethodsBuilder | Identifies types for building methods of a particular resource type |
NestedType | Identifies types which are only used by other types internally. They have no special meaning, this trait just marks them for completeness. |
Part | Identifies types which are only used as part of other types, which
usually are carrying the |
ReadSeek | A utility to specify reader types which provide seeking capabilities too |
RequestValue | Identifies types which are used in API requests. |
Resource | Identifies types which can be inserted and deleted. Types with this trait are most commonly used by clients of this API. |
ResponseResult | Identifies types which are used in API responses. |
ToParts | A trait for all types that can convert themselves into a parts string |
UnusedType | Identifies types which are not actually used by the API This might be a bug within the google API schema. |
Functions
remove_json_null_values |
Type Definitions
Result | A universal result type used as return for all calls. |