[−][src]Crate google_containeranalysis1_beta1
This documentation was generated from Container Analysis crate version 1.0.10+20190625, where 20190625 is the exact revision of the containeranalysis:v1beta1 schema built by the mako code generator v1.0.10.
Everything else about the Container Analysis v1_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 ...
- projects
- notes batch create, notes create, notes delete, notes get, notes get iam policy, notes list, notes occurrences list, notes patch, notes set iam policy, notes test iam permissions, occurrences batch create, occurrences create, occurrences delete, occurrences get, occurrences get iam policy, occurrences get notes, occurrences get vulnerability summary, occurrences list, occurrences patch, occurrences set iam policy, occurrences test iam permissions, scan configs get, scan configs list and scan configs update
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.projects().notes_patch(...).doit() let r = hub.projects().notes_create(...).doit() let r = hub.projects().notes_get(...).doit() let r = hub.projects().occurrences_get_notes(...).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-containeranalysis1_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_containeranalysis1_beta1 as containeranalysis1_beta1; use containeranalysis1_beta1::Note; use containeranalysis1_beta1::{Result, Error}; use std::default::Default; use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; use containeranalysis1_beta1::ContainerAnalysis; // 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 = ContainerAnalysis::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 = Note::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.projects().notes_patch(req, "name") .update_mask("sed") .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
AliasContext | An alias to a repo revision. |
Artifact | Artifact describes a build product. |
Attestation | Occurrence that represents a single "attestation". The authenticity of an attestation can be verified using the attached signature. If the verifier trusts the public key of the signer, then verifying the signature is sufficient to establish trust. In this circumstance, the authority to which this attestation is attached is primarily useful for look-up (how to find this attestation if you already know the authority and artifact to be verified) and intent (which authority was this attestation intended to sign for). |
AuditConfig | Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. |
AuditLogConfig | Provides the configuration for logging a type of permissions. Example: |
Authority | Note kind that represents a logical attestation "role" or "authority". For
example, an organization might have one |
Basis | Basis describes the base image portion (Note) of the DockerImage relationship. Linked occurrences are derived from this or an equivalent image via: FROM <Basis.resource_url> Or an equivalent reference, e.g. a tag of the resource_url. |
BatchCreateNotesRequest | Request to create notes in batch. |
BatchCreateNotesResponse | Response for creating notes in batch. |
BatchCreateOccurrencesRequest | Request to create occurrences in batch. |
BatchCreateOccurrencesResponse | Response for creating occurrences in batch. |
Binding | Associates |
Build | Note holding the version of the provider's builder and the signature of the provenance message in the build details occurrence. |
BuildProvenance | Provenance of a build. Contains all information needed to verify the full details about the build from source to completion. |
BuildSignature | Message encapsulating the signature of the verified build. |
CVSSv3 | Common Vulnerability Scoring System version 3. For details, see https://www.first.org/cvss/specification-document |
Chunk | |
CloudRepoSourceContext | A CloudRepoSourceContext denotes a particular revision in a Google Cloud Source Repo. |
Command | Command describes a step performed as part of the build pipeline. |
ContainerAnalysis | Central instance to access all ContainerAnalysis related resource activities |
ContentRange | Implements the Content-Range header, for serialization only |
DefaultDelegate | A delegate with a conservative default implementation, which is used if no other delegate is set. |
Deployable | An artifact that can be deployed in some runtime. |
Deployment | The period during which some deployable was active in a runtime. |
Derived | Derived describes the derived image portion (Occurrence) of the DockerImage relationship. This image would be produced from a Dockerfile with FROM <DockerImage.Basis in attached Note>. |
Detail | Identifies all appearances of this vulnerability in the package for a specific distro/location. For example: glibc in cpe:/o:debian:debian_linux:8 for versions 2.1 - 2.2 |
Details | Details of an attestation occurrence. |
Discovered | Provides information about the analysis status of a discovered resource. |
Discovery | A note that indicates a type of analysis a provider would perform. This note
exists in a provider's project. A |
Distribution | This represents a particular channel of distribution for a given package. E.g., Debian's jessie-backports dpkg mirror. |
DummyNetworkStream | |
Empty | 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: |
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 |
Expr | Represents an expression text. Example: |
FileHashes | Container message for hashes of byte content of files, used in source messages to verify integrity of source input to the build. |
Fingerprint | A set of properties that uniquely identify a given Docker image. |
FixableTotalByDigest | Per resource and severity counts of fixable and total vulnerabilities. |
GenericSignedAttestation | An attestation wrapper that uses the Grafeas |
GerritSourceContext | A SourceContext referring to a Gerrit project. |
GetIamPolicyRequest | Request message for |
GitSourceContext | A GitSourceContext denotes a particular revision in a third party Git repository (e.g., GitHub). |
GrafeasV1beta1VulnerabilityDetails | Details of a vulnerability Occurrence. |
GrafeasV1beta1DiscoveryDetails | Details of a discovery occurrence. |
GrafeasV1beta1BuildDetails | Details of a build occurrence. |
GrafeasV1beta1DeploymentDetails | Details of a deployment occurrence. |
GrafeasV1beta1ImageDetails | Details of an image occurrence. |
GrafeasV1beta1PackageDetails | Details of a package occurrence. |
Hash | Container message for hash values. |
Hint | This submessage provides human-readable hints about the purpose of the authority. Because the name of a note acts as its resource reference, it is important to disambiguate the canonical name of the Note (which might be a UUID for security purposes) from "readable" names more suitable for debug output. Note that these hints should not be used to look up authorities in security sensitive contexts, such as when looking up attestations to verify. |
Installation | This represents how a particular software package may be installed on a system. |
JsonServerError | A utility type which can decode a server response that indicates error |
KnowledgeBase | There is no detailed description. |
Layer | Layer holds metadata specific to a layer of a Docker image. |
ListNoteOccurrencesResponse | Response for listing occurrences for a note. |
ListNotesResponse | Response for listing notes. |
ListOccurrencesResponse | Response for listing occurrences. |
ListScanConfigsResponse | Response for listing scan configurations. |
Location | An occurrence of a particular package installation found within a system's
filesystem. E.g., glibc was found in |
MethodInfo | Contains information about an API request. |
MultiPartReader | Provides a |
Note | A type of analysis that can be done for a resource. |
Occurrence | An instance of an analysis type that has been found on a resource. |
Package | This represents a particular package that is distributed over various channels. E.g., glibc (aka libc6) is distributed by many, at various versions. |
PackageIssue | This message wraps a location affected by a vulnerability and its associated fix (if one is available). |
PgpSignedAttestation | An attestation wrapper with a PGP-compatible signature. This message only
supports |
Policy | Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. |
ProjectMethods | A builder providing access to all methods supported on project resources.
It is not used directly, but through the |
ProjectNoteBatchCreateCall | Creates new notes in batch. |
ProjectNoteCreateCall | Creates a new note. |
ProjectNoteDeleteCall | Deletes the specified note. |
ProjectNoteGetCall | Gets the specified note. |
ProjectNoteGetIamPolicyCall | Gets the access control policy for a note or an occurrence resource.
Requires |
ProjectNoteListCall | Lists notes for the specified project. |
ProjectNoteOccurrenceListCall | Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note. |
ProjectNotePatchCall | Updates the specified note. |
ProjectNoteSetIamPolicyCall | Sets the access control policy on the specified note or occurrence.
Requires |
ProjectNoteTestIamPermissionCall | Returns the permissions that a caller has on the specified note or
occurrence. Requires list permission on the project (for example,
|
ProjectOccurrenceBatchCreateCall | Creates new occurrences in batch. |
ProjectOccurrenceCreateCall | Creates a new occurrence. |
ProjectOccurrenceDeleteCall | Deletes the specified occurrence. For example, use this method to delete an occurrence when the occurrence is no longer applicable for the given resource. |
ProjectOccurrenceGetCall | Gets the specified occurrence. |
ProjectOccurrenceGetIamPolicyCall | Gets the access control policy for a note or an occurrence resource.
Requires |
ProjectOccurrenceGetNoteCall | Gets the note attached to the specified occurrence. Consumer projects can use this method to get a note that belongs to a provider project. |
ProjectOccurrenceGetVulnerabilitySummaryCall | Gets a summary of the number and severity of occurrences. |
ProjectOccurrenceListCall | Lists occurrences for the specified project. |
ProjectOccurrencePatchCall | Updates the specified occurrence. |
ProjectOccurrenceSetIamPolicyCall | Sets the access control policy on the specified note or occurrence.
Requires |
ProjectOccurrenceTestIamPermissionCall | Returns the permissions that a caller has on the specified note or
occurrence. Requires list permission on the project (for example,
|
ProjectRepoId | Selects a repo using a Google Cloud Platform project ID (e.g., winged-cargo-31) and a repo name within that project. |
ProjectScanConfigGetCall | Gets the specified scan configuration. |
ProjectScanConfigListCall | Lists scan configurations for the specified project. |
ProjectScanConfigUpdateCall | Updates the specified scan configuration. |
RangeResponseHeader | |
RelatedUrl | Metadata for any related URL information. |
RepoId | A unique identifier for a Cloud Repo. |
ResourceType | An entity that can have metadata. For example, a Docker image. |
ResumableUploadHelper | A utility type to perform a resumable upload from start to end. |
ScanConfig | A scan configuration specifies whether Cloud components in a project have a particular type of analysis being run. For example, it can configure whether vulnerability scanning is being done on Docker images or not. |
ServerError | |
ServerMessage | |
SetIamPolicyRequest | Request message for |
Signature | Verifiers (e.g. Kritis implementations) MUST verify signatures
with respect to the trust anchors defined in policy (e.g. a Kritis policy).
Typically this means that the verifier has been configured with a map from
|
Source | Source describes the location of the source used for the build. |
SourceContext | A SourceContext is a reference to a tree of files. A SourceContext together with a path point to a unique revision of a single file or directory. |
Status | The |
TestIamPermissionsRequest | Request message for |
TestIamPermissionsResponse | Response message for |
Version | Version contains structured information about the version of a package. |
Vulnerability | Vulnerability provides metadata about a security vulnerability in a Note. |
VulnerabilityLocation | The location of the vulnerability. |
VulnerabilityOccurrencesSummary | A summary of how many vulnerability occurrences there are per resource and severity type. |
WindowsDetail | There is no detailed description. |
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. |