13 stable releases (5 major)
new 6.0.0+20240620 | Oct 15, 2024 |
---|---|
5.0.5+20240620 | Jun 27, 2024 |
5.0.4+20240222 | Mar 5, 2024 |
5.0.3+20230104 | Aug 23, 2023 |
1.0.14+20200625 | Jul 10, 2020 |
#278 in Network programming
94 downloads per month
Used in google-apigee1-cli
5MB
70K
SLoC
The google-apigee1
library allows access to all features of the Google Apigee service.
This documentation was generated from Apigee crate version 6.0.0+20240620, where 20240620 is the exact revision of the apigee:v1 schema built by the mako code generator v6.0.0.
Everything else about the Apigee v1 API can be found at the official documentation site.
Features
Handle the following Resources with ease from the central hub ...
- hybrid
- issuers list
- organizations
- analytics datastores create, analytics datastores delete, analytics datastores get, analytics datastores list, analytics datastores test, analytics datastores update, apiproducts attributes, apiproducts attributes delete, apiproducts attributes get, apiproducts attributes list, apiproducts attributes update api product attribute, apiproducts create, apiproducts delete, apiproducts get, apiproducts list, apiproducts rateplans create, apiproducts rateplans delete, apiproducts rateplans get, apiproducts rateplans list, apiproducts rateplans update, apiproducts update, apis create, apis delete, apis deployments list, apis get, apis keyvaluemaps create, apis keyvaluemaps delete, apis keyvaluemaps entries create, apis keyvaluemaps entries delete, apis keyvaluemaps entries get, apis keyvaluemaps entries list, apis keyvaluemaps entries update, apis list, apis patch, apis revisions delete, apis revisions deployments list, apis revisions get, apis revisions update api proxy revision, appgroups apps create, appgroups apps delete, appgroups apps get, appgroups apps keys apiproducts delete, appgroups apps keys apiproducts update app group app key api product, appgroups apps keys create, appgroups apps keys delete, appgroups apps keys get, appgroups apps keys update app group app key, appgroups apps list, appgroups apps update, appgroups create, appgroups delete, appgroups get, appgroups list, appgroups update, apps get, apps list, create, datacollectors create, datacollectors delete, datacollectors get, datacollectors list, datacollectors patch, delete, deployments list, developers apps attributes, developers apps attributes delete, developers apps attributes get, developers apps attributes list, developers apps attributes update developer app attribute, developers apps create, developers apps delete, developers apps generate key pair or update developer app status, developers apps get, developers apps keys apiproducts delete, developers apps keys apiproducts update developer app key api product, developers apps keys create, developers apps keys create create, developers apps keys delete, developers apps keys get, developers apps keys replace developer app key, developers apps keys update developer app key, developers apps list, developers apps update, developers attributes, developers attributes delete, developers attributes get, developers attributes list, developers attributes update developer attribute, developers balance adjust, developers balance credit, developers create, developers delete, developers get, developers get balance, developers get monetization config, developers list, developers set developer status, developers subscriptions create, developers subscriptions expire, developers subscriptions get, developers subscriptions list, developers update, developers update monetization config, endpoint attachments create, endpoint attachments delete, endpoint attachments get, endpoint attachments list, envgroups attachments create, envgroups attachments delete, envgroups attachments get, envgroups attachments list, envgroups create, envgroups delete, envgroups get, envgroups get deployed ingress config, envgroups list, envgroups patch, environments addons config set addon enablement, environments analytics admin get schemav2, environments analytics exports create, environments analytics exports get, environments analytics exports list, environments apis deployments list, environments apis revisions debugsessions create, environments apis revisions debugsessions data get, environments apis revisions debugsessions delete data, environments apis revisions debugsessions get, environments apis revisions debugsessions list, environments apis revisions deploy, environments apis revisions deployments generate deploy change report, environments apis revisions deployments generate undeploy change report, environments apis revisions get deployments, environments apis revisions undeploy, environments archive deployments create, environments archive deployments delete, environments archive deployments generate download url, environments archive deployments generate upload url, environments archive deployments get, environments archive deployments list, environments archive deployments patch, environments caches delete, environments create, environments delete, environments deployments list, environments flowhooks attach shared flow to flow hook, environments flowhooks detach shared flow from flow hook, environments flowhooks get, environments get, environments get addons config, environments get api security runtime config, environments get debugmask, environments get deployed config, environments get iam policy, environments get security actions config, environments get trace config, environments keystores aliases create, environments keystores aliases csr, environments keystores aliases delete, environments keystores aliases get, environments keystores aliases get certificate, environments keystores aliases update, environments keystores create, environments keystores delete, environments keystores get, environments keyvaluemaps create, environments keyvaluemaps delete, environments keyvaluemaps entries create, environments keyvaluemaps entries delete, environments keyvaluemaps entries get, environments keyvaluemaps entries list, environments keyvaluemaps entries update, environments modify environment, environments optimized stats get, environments queries create, environments queries get, environments queries get result, environments queries get resulturl, environments queries list, environments references create, environments references delete, environments references get, environments references update, environments resourcefiles create, environments resourcefiles delete, environments resourcefiles get, environments resourcefiles list, environments resourcefiles list environment resources, environments resourcefiles update, environments security actions create, environments security actions disable, environments security actions enable, environments security actions get, environments security actions list, environments security incidents batch update, environments security incidents get, environments security incidents list, environments security incidents patch, environments security reports create, environments security reports get, environments security reports get result, environments security reports get result view, environments security reports list, environments security stats query tabular stats, environments security stats query time series stats, environments set iam policy, environments sharedflows deployments list, environments sharedflows revisions deploy, environments sharedflows revisions get deployments, environments sharedflows revisions undeploy, environments stats get, environments subscribe, environments targetservers create, environments targetservers delete, environments targetservers get, environments targetservers update, environments test iam permissions, environments trace config overrides create, environments trace config overrides delete, environments trace config overrides get, environments trace config overrides list, environments trace config overrides patch, environments unsubscribe, environments update, environments update debugmask, environments update environment, environments update security actions config, environments update trace config, get, get deployed ingress config, get project mapping, get runtime config, get security settings, get sync authorization, host queries create, host queries get, host queries get result, host queries get result view, host queries list, host security reports create, host security reports get, host security reports get result, host security reports get result view, host security reports list, host stats get, instances attachments create, instances attachments delete, instances attachments get, instances attachments list, instances canaryevaluations create, instances canaryevaluations get, instances create, instances delete, instances get, instances list, instances nat addresses activate, instances nat addresses create, instances nat addresses delete, instances nat addresses get, instances nat addresses list, instances patch, instances report status, keyvaluemaps create, keyvaluemaps delete, keyvaluemaps entries create, keyvaluemaps entries delete, keyvaluemaps entries get, keyvaluemaps entries list, keyvaluemaps entries update, list, operations get, operations list, optimized host stats get, reports create, reports delete, reports get, reports list, reports update, security assessment results batch compute, security profiles create, security profiles delete, security profiles environments compute environment scores, security profiles environments create, security profiles environments delete, security profiles get, security profiles list, security profiles list revisions, security profiles patch, set addons, set sync authorization, sharedflows create, sharedflows delete, sharedflows deployments list, sharedflows get, sharedflows list, sharedflows revisions delete, sharedflows revisions deployments list, sharedflows revisions get, sharedflows revisions update shared flow revision, sites apicategories create, sites apicategories delete, sites apicategories get, sites apicategories list, sites apicategories patch, sites apidocs create, sites apidocs delete, sites apidocs get, sites apidocs get documentation, sites apidocs list, sites apidocs update, sites apidocs update documentation, update and update security settings
- projects
- provision organization
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().await
Or specifically ...
let r = hub.organizations().endpoint_attachments_create(...).doit().await
let r = hub.organizations().endpoint_attachments_delete(...).doit().await
let r = hub.organizations().envgroups_attachments_create(...).doit().await
let r = hub.organizations().envgroups_attachments_delete(...).doit().await
let r = hub.organizations().envgroups_create(...).doit().await
let r = hub.organizations().envgroups_delete(...).doit().await
let r = hub.organizations().envgroups_patch(...).doit().await
let r = hub.organizations().environments_addons_config_set_addon_enablement(...).doit().await
let r = hub.organizations().environments_archive_deployments_create(...).doit().await
let r = hub.organizations().environments_create(...).doit().await
let r = hub.organizations().environments_delete(...).doit().await
let r = hub.organizations().environments_modify_environment(...).doit().await
let r = hub.organizations().instances_attachments_create(...).doit().await
let r = hub.organizations().instances_attachments_delete(...).doit().await
let r = hub.organizations().instances_canaryevaluations_create(...).doit().await
let r = hub.organizations().instances_nat_addresses_activate(...).doit().await
let r = hub.organizations().instances_nat_addresses_create(...).doit().await
let r = hub.organizations().instances_nat_addresses_delete(...).doit().await
let r = hub.organizations().instances_create(...).doit().await
let r = hub.organizations().instances_delete(...).doit().await
let r = hub.organizations().instances_patch(...).doit().await
let r = hub.organizations().operations_get(...).doit().await
let r = hub.organizations().create(...).doit().await
let r = hub.organizations().delete(...).doit().await
let r = hub.organizations().set_addons(...).doit().await
let r = hub.projects().provision_organization(...).doit().await
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-apigee1 = "*"
serde = "1"
serde_json = "1"
A complete example
extern crate hyper;
extern crate hyper_rustls;
extern crate google_apigee1 as apigee1;
use apigee1::api::GoogleCloudApigeeV1EndpointAttachment;
use apigee1::{Result, Error};
use apigee1::{Apigee, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: yup_oauth2::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 = yup_oauth2::InstalledFlowAuthenticator::builder(
secret,
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let client = hyper_util::client::legacy::Client::builder(
hyper_util::rt::TokioExecutor::new()
)
.build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.unwrap()
.https_or_http()
.enable_http1()
.build()
);
let mut hub = Apigee::new(client, 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 = GoogleCloudApigeeV1EndpointAttachment::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.organizations().endpoint_attachments_create(req, "parent")
.endpoint_attachment_id("magna")
.doit().await;
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::Io(_)
|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.
- 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.
Cargo Features
utoipa
- Add support for utoipa and deriveutoipa::ToSchema
on all the types. You'll have to import and register the required types in#[openapi(schemas(...))]
, otherwise the generatedopenapi
spec would be invalid.
License
The apigee1 library was generated by Sebastian Thiel, and is placed under the MIT license. You can read the full text at the repository's license file.
Dependencies
~19–30MB
~565K SLoC