[][src]Crate google_run1

This documentation was generated from Cloud Run crate version 1.0.14+20200622, where 20200622 is the exact revision of the run:v1 schema built by the mako code generator v1.0.14.

Everything else about the Cloud Run v1 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 ...

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 ...

This example is not tested
let r = hub.namespaces().services_delete(...).doit()
let r = hub.namespaces().services_create(...).doit()
let r = hub.namespaces().routes_get(...).doit()
let r = hub.namespaces().services_get(...).doit()
let r = hub.api().v1_namespaces_patch(...).doit()
let r = hub.namespaces().domainmappings_delete(...).doit()
let r = hub.projects().locations_namespaces_patch(...).doit()
let r = hub.api().v1_namespaces_get(...).doit()
let r = hub.namespaces().authorizeddomains_list(...).doit()
let r = hub.namespaces().configurations_get(...).doit()
let r = hub.namespaces().routes_list(...).doit()
let r = hub.namespaces().services_list(...).doit()
let r = hub.namespaces().revisions_get(...).doit()
let r = hub.namespaces().revisions_list(...).doit()
let r = hub.namespaces().services_replace_service(...).doit()
let r = hub.namespaces().configurations_list(...).doit()
let r = hub.namespaces().domainmappings_get(...).doit()
let r = hub.projects().locations_namespaces_get(...).doit()
let r = hub.namespaces().domainmappings_create(...).doit()
let r = hub.namespaces().revisions_delete(...).doit()
let r = hub.namespaces().domainmappings_list(...).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-run1 = "*"
# 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_run1 as run1;
use run1::{Result, Error};
use std::default::Default;
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
use run1::CloudRun;
 
// 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 = CloudRun::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);
// 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.namespaces().routes_list("parent")
             .watch(false)
             .resource_version("amet.")
             .limit(-81)
             .label_selector("labore")
             .include_uninitialized(true)
             .field_selector("nonumy")
             .continue_("dolores")
             .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 encodable 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.

Arguments will always be copied or cloned into the builder, to make them independent of their original life times.

Structs

Addressable

Information for connecting over HTTP(s).

ApiMethods

A builder providing access to all methods supported on api resources. It is not used directly, but through the CloudRun hub.

ApiV1NamespacePatchCall

Rpc to update a namespace.

ApiV1NamespaceGetCall

Rpc to get information about a namespace.

ApiV1NamespaceSecretCreateCall

Creates a new secret.

ApiV1NamespaceSecretGetCall

Rpc to get information about a secret.

ApiV1NamespaceSecretReplaceSecretCall

Rpc to replace a secret.

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:

AuthorizedDomain

A domain that a user has been authorized to administer. To authorize use of a domain, verify ownership via Webmaster Central.

Binding

Associates members with a role.

Chunk
CloudRun

Central instance to access all CloudRun related resource activities

ConfigMapEnvSource

Cloud Run fully managed: not supported

ConfigMapKeySelector

Cloud Run fully managed: not supported

ConfigMapVolumeSource

Cloud Run fully managed: not supported

Configuration

Configuration represents the "floating HEAD" of a linear history of Revisions, and optionally how the containers those revisions reference are built. Users create new Revisions by updating the Configuration's spec. The "latest created" revision's name is available under status, as is the "latest ready" revision's name. See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration

ConfigurationSpec

ConfigurationSpec holds the desired state of the Configuration (from the client).

ConfigurationStatus

ConfigurationStatus communicates the observed state of the Configuration (from the controller).

Container

A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments may be supplied by the system to the container at runtime.

ContainerPort

ContainerPort represents a network port in a single container.

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.

DomainMapping

Resource to hold the state and status of a user's domain mapping.

DomainMappingSpec

The desired state of the Domain Mapping.

DomainMappingStatus

The current state of the Domain Mapping.

DummyNetworkStream
EnvFromSource

Cloud Run fully managed: not supported

EnvVar

EnvVar represents an environment variable present in a Container.

EnvVarSource

Cloud Run fully managed: not supported

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

ExecAction

Cloud Run fully managed: not supported

Expr

Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec.

GoogleCloudRunV1Condition

Condition defines a generic condition for a Resource

HTTPGetAction

Cloud Run fully managed: not supported

HTTPHeader

Cloud Run fully managed: not supported

JsonServerError

A utility type which can decode a server response that indicates error

KeyToPath

Cloud Run fully managed: not supported

ListAuthorizedDomainsResponse

A list of Authorized Domains.

ListConfigurationsResponse

ListConfigurationsResponse is a list of Configuration resources.

ListDomainMappingsResponse

ListDomainMappingsResponse is a list of DomainMapping resources.

ListLocationsResponse

The response message for Locations.ListLocations.

ListMeta

ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.

ListRevisionsResponse

ListRevisionsResponse is a list of Revision resources.

ListRoutesResponse

ListRoutesResponse is a list of Route resources.

ListServicesResponse

A list of Service resources.

LocalObjectReference

Cloud Run fully managed: not supported

Location

A resource that represents Google Cloud Platform location.

MethodInfo

Contains information about an API request.

MultiPartReader

Provides a Read interface that converts multiple parts into the protocol identified by RFC2387. Note: This implementation is just as rich as it needs to be to perform uploads to google APIs, and might not be a fully-featured implementation.

Namespace

Cloud Run fully managed: not supported

NamespaceAuthorizeddomainListCall

List authorized domains.

NamespaceConfigurationGetCall

Get information about a configuration.

NamespaceConfigurationListCall

List configurations.

NamespaceDomainmappingCreateCall

Create a new domain mapping.

NamespaceDomainmappingDeleteCall

Delete a domain mapping.

NamespaceDomainmappingGetCall

Get information about a domain mapping.

NamespaceDomainmappingListCall

List domain mappings.

NamespaceMethods

A builder providing access to all methods supported on namespace resources. It is not used directly, but through the CloudRun hub.

NamespaceRevisionDeleteCall

Delete a revision.

NamespaceRevisionGetCall

Get information about a revision.

NamespaceRevisionListCall

List revisions.

NamespaceRouteGetCall

Get information about a route.

NamespaceRouteListCall

List routes.

NamespaceServiceCreateCall

Create a service.

NamespaceServiceDeleteCall

Delete a service. This will cause the Service to stop serving traffic and will delete the child entities like Routes, Configurations and Revisions.

NamespaceServiceGetCall

Get information about a service.

NamespaceServiceListCall

List services.

NamespaceServiceReplaceServiceCall

Replace a service.

NamespaceSpec

Cloud Run fully managed: not supported

NamespaceStatus

Cloud Run fully managed: not supported

ObjectMeta

k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.

OwnerReference

OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.

Policy

An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources.

Probe

Cloud Run fully managed: not supported

ProjectLocationAuthorizeddomainListCall

List authorized domains.

ProjectLocationConfigurationGetCall

Get information about a configuration.

ProjectLocationConfigurationListCall

List configurations.

ProjectLocationDomainmappingCreateCall

Create a new domain mapping.

ProjectLocationDomainmappingDeleteCall

Delete a domain mapping.

ProjectLocationDomainmappingGetCall

Get information about a domain mapping.

ProjectLocationDomainmappingListCall

List domain mappings.

ProjectLocationListCall

Lists information about the supported locations for this service.

ProjectLocationNamespaceGetCall

Rpc to get information about a namespace.

ProjectLocationNamespacePatchCall

Rpc to update a namespace.

ProjectLocationRevisionDeleteCall

Delete a revision.

ProjectLocationRevisionGetCall

Get information about a revision.

ProjectLocationRevisionListCall

List revisions.

ProjectLocationRouteGetCall

Get information about a route.

ProjectLocationRouteListCall

List routes.

ProjectLocationSecretCreateCall

Creates a new secret.

ProjectLocationSecretGetCall

Rpc to get information about a secret.

ProjectLocationSecretReplaceSecretCall

Rpc to replace a secret.

ProjectLocationServiceCreateCall

Create a service.

ProjectLocationServiceDeleteCall

Delete a service. This will cause the Service to stop serving traffic and will delete the child entities like Routes, Configurations and Revisions.

ProjectLocationServiceGetCall

Get information about a service.

ProjectLocationServiceGetIamPolicyCall

Get the IAM Access Control policy currently in effect for the given Cloud Run service. This result does not include any inherited policies.

ProjectLocationServiceListCall

List services.

ProjectLocationServiceReplaceServiceCall

Replace a service.

ProjectLocationServiceSetIamPolicyCall

Sets the IAM Access control policy for the specified Service. Overwrites any existing policy.

ProjectLocationServiceTestIamPermissionCall

Returns permissions that a caller has on the specified Project.

ProjectMethods

A builder providing access to all methods supported on project resources. It is not used directly, but through the CloudRun hub.

RangeResponseHeader
ResourceRecord

A DNS resource record.

ResourceRequirements

ResourceRequirements describes the compute resource requirements.

ResumableUploadHelper

A utility type to perform a resumable upload from start to end.

Revision

Revision is an immutable snapshot of code and configuration. A revision references a container image. Revisions are created by updates to a Configuration.

RevisionSpec

RevisionSpec holds the desired state of the Revision (from the client).

RevisionStatus

RevisionStatus communicates the observed state of the Revision (from the controller).

RevisionTemplate

RevisionTemplateSpec describes the data a revision should have when created from a template. Based on: https://github.com/kubernetes/api/blob/e771f807/core/v1/types.go#L3179-L3190

Route

Route is responsible for configuring ingress over a collection of Revisions. Some of the Revisions a Route distributes traffic over may be specified by referencing the Configuration responsible for creating them; in these cases the Route is additionally responsible for monitoring the Configuration for "latest ready" revision changes, and smoothly rolling out latest revisions. See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route

RouteSpec

RouteSpec holds the desired state of the Route (from the client).

RouteStatus

RouteStatus communicates the observed state of the Route (from the controller).

Secret

Cloud Run fully managed: not supported

SecretEnvSource

Cloud Run fully managed: not supported

SecretKeySelector

Cloud Run fully managed: not supported

SecretVolumeSource

Cloud Run fully managed: not supported

SecurityContext

Cloud Run fully managed: not supported

ServerError
ServerMessage
Service

Service acts as a top-level container that manages a set of Routes and Configurations which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets).

ServiceSpec

ServiceSpec holds the desired state of the Route (from the client), which is used to manipulate the underlying Route and Configuration(s).

ServiceStatus

The current state of the Service. Output only.

SetIamPolicyRequest

Request message for SetIamPolicy method.

Status

Status is a return value for calls that don't return other objects

StatusCause

StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.

StatusDetails

StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.

TCPSocketAction

Cloud Run fully managed: not supported

TestIamPermissionsRequest

Request message for TestIamPermissions method.

TestIamPermissionsResponse

Response message for TestIamPermissions method.

TrafficTarget

TrafficTarget holds a single entry of the routing table for a Route.

Volume

Cloud Run fully managed: not supported

VolumeMount

Cloud Run fully managed: not supported

XUploadContentType

The X-Upload-Content-Type header.

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 Resource trait.

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.