Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f9ccbcd
add azure_mgmt_storage_v2019_06_01
ctaggart Oct 8, 2020
c2650b4
headers now generated
ctaggart Oct 8, 2020
5dd6a63
all local types in same mod
ctaggart Oct 9, 2020
98c20dc
include referenced types
ctaggart Oct 10, 2020
7f112b4
CamelCase for vec types
ctaggart Oct 10, 2020
85cefc9
fix referenced schemas
ctaggart Oct 10, 2020
c87dec1
add referenced schemas recursively
ctaggart Oct 10, 2020
6949562
multiple input files
ctaggart Oct 10, 2020
cf6deb6
create local structs
ctaggart Oct 10, 2020
0c11f82
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 10, 2020
8430921
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 10, 2020
9797149
move to rest/mgmt_storage/2019-06-01
ctaggart Oct 10, 2020
4c847d2
unlock build on other branches
ctaggart Oct 10, 2020
4a27b71
add rest/rustfmt.toml
ctaggart Oct 10, 2020
c6d291f
allOf & pub
ctaggart Oct 10, 2020
07126a3
optional params
ctaggart Oct 11, 2020
73bd8c4
default Configuration
ctaggart Oct 11, 2020
46a850f
added mgmt_storage 2020-08-01-preview
ctaggart Oct 11, 2020
e0c613c
API_VERSION const
ctaggart Oct 11, 2020
c736f0e
api-version from config
ctaggart Oct 11, 2020
6ebc62b
query params
ctaggart Oct 11, 2020
c367f52
map with Vec::is_empty
ctaggart Oct 11, 2020
1d22c03
skip_serializing if readOnly
ctaggart Oct 12, 2020
0ed1c5b
remove anyhow dependency
ctaggart Oct 12, 2020
7ba33e2
remove if statement around api-version param
ctaggart Oct 12, 2020
fb6c0c9
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 12, 2020
f1a5365
switch services layout to be like go sdk
ctaggart Oct 12, 2020
955a852
add compute_mgmt example
ctaggart Oct 12, 2020
bb263d1
add body and header params
ctaggart Oct 12, 2020
d3bebaa
add avs_mgmt
ctaggart Oct 12, 2020
24212ab
group operations into modules
ctaggart Oct 13, 2020
6b92bd4
add resources mgmt
ctaggart Oct 13, 2020
4c3dbb0
service api versions as features
ctaggart Oct 13, 2020
b6b75c8
add two examples
ctaggart Oct 14, 2020
55fa8f9
version modules
ctaggart Oct 14, 2020
77a7901
add avs_private_cloud_list example
ctaggart Oct 14, 2020
7fe6ad9
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 14, 2020
563b786
vm_list example
ctaggart Oct 15, 2020
0dbe768
switch name back to azure_mgmt_${service} #42
ctaggart Oct 15, 2020
0e10667
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 15, 2020
a873e82
many compute API versions
ctaggart Oct 16, 2020
079dde9
add 70 mgmt services
ctaggart Oct 17, 2020
8840aea
map all respones with error handling
ctaggart Oct 19, 2020
5260faa
+30 mgmt services, 100 total
ctaggart Oct 20, 2020
2d7a751
Merge remote-tracking branch 'origin/master' into rest
ctaggart Oct 20, 2020
1bc80fa
use spec folder names
ctaggart Oct 20, 2020
64f6f89
add readme for Azure Service Crates
ctaggart Oct 20, 2020
835e61f
fix vmware example & add examples to readme
ctaggart Oct 20, 2020
8dd5ff1
add storage account list to readme
ctaggart Oct 20, 2020
6e81ec9
docs are hard
ctaggart Oct 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
members = [
"sdk/*",
"services/mgmt/*",
]
57 changes: 57 additions & 0 deletions services/README.md
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)
20 changes: 20 additions & 0 deletions services/mgmt/addons/Cargo.toml
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" = []
33 changes: 33 additions & 0 deletions services/mgmt/addons/src/lib.rs
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,
}
}
}
3 changes: 3 additions & 0 deletions services/mgmt/addons/src/package_2017_05/mod.rs
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";
58 changes: 58 additions & 0 deletions services/mgmt/addons/src/package_2017_05/models.rs
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,
}
Loading