|
1 | 1 | # Azure Service Crates
|
2 | 2 |
|
3 |
| -Rust crates for accessing [Azure services](https://azure.microsoft.com/services/). These crates are client libraries generated by [AutoRust](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." |
| 3 | +Rust crates for accessing [Azure services](https://azure.microsoft.com/services/). These crates are client libraries generated by [AutoRust](autorust) using the web service [specifications](https://github.com/Azure/azure-rest-api-specs/tree/master/specification). 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." |
4 | 4 |
|
5 |
| -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. |
| 5 | +When this document was last updated, there were 185 [control plane crates](mgmt) and 29 [data plane crates](svc). |
6 | 6 |
|
7 | 7 | ## Control Plane Crates
|
8 |
| -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 `Configuration` 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: |
| 8 | +The control plane crates are named `azure_mgmt_${servicename}`, such as `azure_mgmt_storage`. |
9 | 9 |
|
10 |
| -``` toml |
11 |
| -[features] |
12 |
| -default = ["package-2019-06"] |
13 |
| -"package-2020-08-preview" = [] |
14 |
| -"package-2019-06" = [] |
15 |
| -"package-2019-04" = [] |
16 |
| -"package-2018-11" = [] |
17 |
| -"package-2018-07" = [] |
18 |
| -"package-2018-07-only" = [] |
19 |
| -"package-2018-03" = [] |
20 |
| -"package-2018-02" = [] |
21 |
| -"package-2017-10" = [] |
22 |
| -"package-2017-06" = [] |
23 |
| -"package-2016-12" = [] |
24 |
| -"package-2016-05" = [] |
25 |
| -"package-2016-01" = [] |
26 |
| -"package-2015-06" = [] |
27 |
| -"package-2015-05-preview" = [] |
28 |
| -``` |
| 10 | +## Data Plane Crates |
| 11 | +The data plane crates will be named `azure_svc_${servicename}`, such as `azure_svc_storage`. |
29 | 12 |
|
30 |
| -The default feature will be used when this dependency is specified: |
31 |
| -``` toml |
32 |
| -[dependencies] |
33 |
| -azure_mgmt_storage = { git = "https://github.com/Azure/azure-sdk-for-rust" } |
| 13 | +## Examples |
| 14 | +There are a few examples: |
| 15 | +- azure_mgmt_storage |
| 16 | + - [storage_account_list](mgmt/storage/examples/storage_account_list.rs) |
| 17 | +- azure_mgmt_resources |
| 18 | + - [group_create](mgmt/resources/examples/group_create.rs) |
| 19 | +- azure_mgmt_compute |
| 20 | + - [vm_list](mgmt/compute/examples/vm_list.rs) |
| 21 | +- azure_mgmt_vmware |
| 22 | + - [private_cloud_list](mgmt/vmware/examples/private_cloud_list.rs) |
| 23 | +- azure_svc_batch |
| 24 | + - [list_pools](svc/batch/examples/list_pools.rs) |
| 25 | + |
| 26 | +These services are in their own [Rust workspace](Cargo.toml), so you need to change to the `services` directory to run these examples. |
| 27 | +``` sh |
| 28 | +cd azure-sdk-for-rust/services |
| 29 | +cargo run --package azure_mgmt_storage --example storage_account_list |
34 | 30 | ```
|
35 | 31 |
|
36 |
| -To use another tag, for example to try out the newer preview API, you must disable the default: |
37 |
| -``` toml |
38 |
| -[dependencies] |
39 |
| -azure_mgmt_storage = { git = "https://github.com/Azure/azure-sdk-for-rust", default-features = false, features = ["package-2020-08-preview"] } |
40 |
| -``` |
| 32 | +## Dependencies |
| 33 | +These creates depend on `azure_core` and `azure_identity`. They are not yet published to [crates.io](https://crates.io/). See the [milestones](https://github.com/Azure/azure-sdk-for-rust/milestones) to see what is left before that happens. Here is an example of adding `azure_svc_batch` as a dependency. |
41 | 34 |
|
42 |
| -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): |
43 | 35 | ``` toml
|
44 | 36 | [dependencies]
|
45 |
| -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"] } |
46 |
| -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"] } |
| 37 | +tokio = { version = "1.0", features = ["macros"] } |
| 38 | +azure_core = { git = "https://github.com/Azure/azure-sdk-for-rust" } |
| 39 | +azure_identity = { git = "https://github.com/Azure/azure-sdk-for-rust" } |
| 40 | +azure_svc_batch = { git = "https://github.com/Azure/azure-sdk-for-rust" } |
47 | 41 | ```
|
48 | 42 |
|
49 |
| -## Data Plane Crates |
50 |
| -The data plane crates will be named `azure_svc_${specification_directory}`, such as `azure_svc_storage`. |
51 |
| - |
52 |
| -## Examples |
53 |
| -There are a few examples: |
54 |
| -- [mgmt/storage/examples/storage_account_list.rs](mgmt/storage/examples/storage_account_list.rs) |
55 |
| -- [mgmt/resources/examples/group_create.rs](mgmt/resources/examples/group_create.rs) |
56 |
| -- [mgmt/compute/examples/vm_list.rs](mgmt/compute/examples/vm_list.rs) |
57 |
| -- [mgmt/vmware/examples/vmware_private_cloud_list.rs](mgmt/vmware/examples/vmware_private_cloud_list.rs) |
| 43 | +Each crate may support several [API versions](api-versions.md). |
0 commit comments