-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial 100 service mgmt APIs generated by AutoRust (#31)
* add azure_mgmt_storage_v2019_06_01 * headers now generated * all local types in same mod * include referenced types * CamelCase for vec types * fix referenced schemas * add referenced schemas recursively * multiple input files ctaggart/autorust#38 * create local structs * move to rest/mgmt_storage/2019-06-01 * unlock build on other branches * add rest/rustfmt.toml * allOf & pub * optional params * default Configuration * added mgmt_storage 2020-08-01-preview * API_VERSION const * api-version from config * query params * map with Vec::is_empty * skip_serializing if readOnly * remove anyhow dependency ctaggart/autorust#26 * remove if statement around api-version param * switch services layout to be like go sdk * add compute_mgmt example * add body and header params * add avs_mgmt * group operations into modules * add resources mgmt * service api versions as features * add two examples * version modules * add avs_private_cloud_list example * vm_list example * switch name back to azure_mgmt_${service} #42 * many compute API versions * add 70 mgmt services * map all respones with error handling * +30 mgmt services, 100 total * use spec folder names * add readme for Azure Service Crates * fix vmware example & add examples to readme * add storage account list to readme * docs are hard
- Loading branch information
Showing
1,425 changed files
with
1,122,023 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[workspace] | ||
members = [ | ||
"sdk/*", | ||
"services/mgmt/*", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Azure Service Crates | ||
|
||
Rust crates for accessing [Azure services](https://azure.microsoft.com/services/). These crates are client libraries generated by [AutoRust](https://github.com/ctaggart/autorust) using the web service [specifications](https://github.com/Azure/azure-rest-api-specs/tree/master/specification) found in Azure/azure-rest-api-specs. The specifications are divided into two categories - [control plane and data plane](https://docs.microsoft.com/azure/azure-resource-manager/management/control-plane-and-data-plane). "You use the control plane to manage resources in your subscription. You use the data plane to use capabilities exposed by your instance of a resource type." | ||
|
||
There are 168 specifications. So far, we have generated 100 control plane crates. We expect that number to go up as AutoRust matures and bugs are fixed. | ||
|
||
## Control Plane Crates | ||
The control plane crates are named `azure_mgmt_${specification_directory}`, such as `azure_mgmt_storage`. Each service may have multiple API versions. Each API version has a set of OpenAPI 2.0 documents, listed under a `Tag` in a [readme.md](https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md) file in a `Conifguration` section. Sometimes there are multiple `Tag`s for the same API version. For example, [Tag: package-2018-07](https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md#tag-package-2018-07) and [Tag: package-2018-07-only](https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md#tag-package-2018-07-only). Rust code is generated for each tag and organized as a crate feature. The first tag without `-preview` is selected as the default feature: | ||
|
||
``` toml | ||
[features] | ||
default = ["package-2019-06"] | ||
"package-2020-08-preview" = [] | ||
"package-2019-06" = [] | ||
"package-2019-04" = [] | ||
"package-2018-11" = [] | ||
"package-2018-07" = [] | ||
"package-2018-07-only" = [] | ||
"package-2018-03" = [] | ||
"package-2018-02" = [] | ||
"package-2017-10" = [] | ||
"package-2017-06" = [] | ||
"package-2016-12" = [] | ||
"package-2016-05" = [] | ||
"package-2016-01" = [] | ||
"package-2015-06" = [] | ||
"package-2015-05-preview" = [] | ||
``` | ||
|
||
The default feature will be used when this dependency is specified: | ||
``` toml | ||
[dependencies] | ||
azure_mgmt_storage = { git = "https://github.com/Azure/azure-sdk-for-rust" } | ||
``` | ||
|
||
To use another tag, for example to try out the newer preview API, you must disable the default: | ||
``` toml | ||
[dependencies] | ||
azure_mgmt_storage = { git = "https://github.com/Azure/azure-sdk-for-rust", default-features = false, features = ["package-2020-08-preview"] } | ||
``` | ||
|
||
A few use cases require using more than tag. This can be done by [renaming the dependencies](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml): | ||
``` toml | ||
[dependencies] | ||
azure_mgmt_storage_2019_06 = { package = "azure_mgmt_storage", git = "https://github.com/Azure/azure-sdk-for-rust", default-features = false, features = ["package-2019-06"] } | ||
azure_mgmt_storage_2018_02 = { package = "azure_mgmt_storage", git = "https://github.com/Azure/azure-sdk-for-rust", default-features = false, features = ["package-2018-02"] } | ||
``` | ||
|
||
## Data Plane Crates | ||
The control plane crates will be named `azure_svc_${specification_directory}`, such as `azure_svc_storage`. | ||
|
||
## Examples | ||
There are a few examples: | ||
- [mgmt/storage/examples/storage_account_list.rs](mgmt/storage/examples/storage_account_list.rs) | ||
- [mgmt/resources/examples/group_create.rs](mgmt/resources/examples/group_create.rs) | ||
- [mgmt/compute/examples/vm_list.rs](mgmt/compute/examples/vm_list.rs) | ||
- [mgmt/vmware/examples/vmware_private_cloud_list.rs](mgmt/vmware/examples/vmware_private_cloud_list.rs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# generated by AutoRust 0.1.0 | ||
[package] | ||
name = "azure_mgmt_addons" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
reqwest = { version = "0.10", features = ["json"] } | ||
bytes = "0.5" | ||
snafu = "0.6" | ||
|
||
[dev-dependencies] | ||
tokio = { version = "0.2", features = ["macros"] } | ||
|
||
[features] | ||
default = ["package-2018-03"] | ||
"package-2018-03" = [] | ||
"package-2017-05" = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#![doc = "generated by AutoRust 0.1.0"] | ||
#[cfg(feature = "package-2018-03")] | ||
mod package_2018_03; | ||
#[cfg(feature = "package-2018-03")] | ||
pub use package_2018_03::{models, operations, API_VERSION}; | ||
#[cfg(feature = "package-2017-05")] | ||
mod package_2017_05; | ||
#[cfg(feature = "package-2017-05")] | ||
pub use package_2017_05::{models, operations, API_VERSION}; | ||
pub struct Configuration { | ||
pub api_version: String, | ||
pub client: reqwest::Client, | ||
pub base_path: String, | ||
pub bearer_access_token: Option<String>, | ||
} | ||
impl Configuration { | ||
pub fn new(bearer_access_token: &str) -> Self { | ||
Self { | ||
bearer_access_token: Some(bearer_access_token.to_owned()), | ||
..Default::default() | ||
} | ||
} | ||
} | ||
impl Default for Configuration { | ||
fn default() -> Self { | ||
Self { | ||
api_version: API_VERSION.to_owned(), | ||
client: reqwest::Client::new(), | ||
base_path: "https://management.azure.com".to_owned(), | ||
bearer_access_token: None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod models; | ||
pub mod operations; | ||
pub const API_VERSION: &str = "2017-05-15"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#![doc = "generated by AutoRust 0.1.0"] | ||
#![allow(non_camel_case_types)] | ||
#![allow(unused_imports)] | ||
use crate::*; | ||
use serde::{Deserialize, Serialize}; | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct CanonicalSupportPlanProperties { | ||
#[serde(rename = "provisioningState", skip_serializing_if = "Option::is_none")] | ||
pub provisioning_state: Option<canonical_support_plan_properties::ProvisioningState>, | ||
} | ||
mod canonical_support_plan_properties { | ||
use super::*; | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub enum ProvisioningState { | ||
Succeeded, | ||
Failed, | ||
Cancelled, | ||
Purchasing, | ||
Downgrading, | ||
Cancelling, | ||
Upgrading, | ||
} | ||
} | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct CanonicalSupportPlanResponseEnvelope { | ||
#[serde(skip_serializing)] | ||
pub id: Option<String>, | ||
#[serde(skip_serializing)] | ||
pub name: Option<String>, | ||
#[serde(rename = "type", skip_serializing)] | ||
pub type_: Option<String>, | ||
pub properties: CanonicalSupportPlanProperties, | ||
} | ||
pub type CanonicalSupportPlanStatus = Vec<serde_json::Value>; | ||
pub type OperationList = Vec<OperationsDefinition>; | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct OperationsDefinition { | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub name: Option<String>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub display: Option<OperationsDisplayDefinition>, | ||
} | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct OperationsDisplayDefinition { | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub provider: Option<String>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub resource: Option<String>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub operation: Option<String>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub description: Option<String>, | ||
} | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct ErrorDefinition { | ||
pub message: String, | ||
pub code: i64, | ||
} |
Oops, something went wrong.