Skip to content

Commit 240cce3

Browse files
authored
Python Authorization to multi api (#3151)
* Python Authorization to multi api * Split Authorization Swagger
1 parent b793671 commit 240cce3

File tree

4 files changed

+214
-115
lines changed

4 files changed

+214
-115
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "AuthorizationManagementClient",
5+
"version": "2015-07-01",
6+
"description": "Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users."
7+
},
8+
"host": "management.azure.com",
9+
"schemes": [
10+
"https"
11+
],
12+
"consumes": [
13+
"application/json",
14+
"text/json"
15+
],
16+
"produces": [
17+
"application/json",
18+
"text/json"
19+
],
20+
"security": [
21+
{
22+
"azure_auth": [
23+
"user_impersonation"
24+
]
25+
}
26+
],
27+
"securityDefinitions": {
28+
"azure_auth": {
29+
"type": "oauth2",
30+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
31+
"flow": "implicit",
32+
"description": "Azure Active Directory OAuth2 Flow",
33+
"scopes": {
34+
"user_impersonation": "impersonate your user account"
35+
}
36+
}
37+
},
38+
"paths": {
39+
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators": {
40+
"get": {
41+
"tags": [
42+
"ClassicAdministrators"
43+
],
44+
"operationId": "ClassicAdministrators_List",
45+
"description": "Gets service administrator, account administrator, and co-administrators for the subscription.",
46+
"parameters": [
47+
{
48+
"name": "api-version",
49+
"in": "query",
50+
"required": true,
51+
"type": "string",
52+
"description": "The API version to use for this operation."
53+
},
54+
{
55+
"$ref": "#/parameters/SubscriptionIdParameter"
56+
}
57+
],
58+
"responses": {
59+
"200": {
60+
"description": "Returns an array of administrators.",
61+
"schema": {
62+
"$ref": "#/definitions/ClassicAdministratorListResult"
63+
}
64+
}
65+
},
66+
"x-ms-pageable": {
67+
"nextLinkName": "nextLink"
68+
},
69+
"x-ms-examples": {
70+
"GetConfigurations": {
71+
"$ref": "./examples/GetClassicAdministrators.json"
72+
}
73+
}
74+
}
75+
}
76+
},
77+
"definitions": {
78+
"ClassicAdministratorProperties": {
79+
"properties": {
80+
"emailAddress": {
81+
"type": "string",
82+
"description": "The email address of the administrator."
83+
},
84+
"role": {
85+
"type": "string",
86+
"description": "The role of the administrator."
87+
}
88+
},
89+
"description": "Classic Administrator properties."
90+
},
91+
"ClassicAdministrator": {
92+
"properties": {
93+
"id": {
94+
"type": "string",
95+
"description": "The ID of the administrator."
96+
},
97+
"name": {
98+
"type": "string",
99+
"description": "The name of the administrator."
100+
},
101+
"type": {
102+
"type": "string",
103+
"description": "The type of the administrator."
104+
},
105+
"properties": {
106+
"$ref": "#/definitions/ClassicAdministratorProperties",
107+
"description": "Properties for the classic administrator."
108+
}
109+
},
110+
"description": "Classic Administrators"
111+
},
112+
"ClassicAdministratorListResult": {
113+
"properties": {
114+
"value": {
115+
"type": "array",
116+
"items": {
117+
"$ref": "#/definitions/ClassicAdministrator"
118+
},
119+
"description": "An array of administrators."
120+
},
121+
"nextLink": {
122+
"type": "string",
123+
"description": "The URL to use for getting the next set of results."
124+
}
125+
},
126+
"description": "ClassicAdministrator list result information."
127+
}
128+
},
129+
"parameters": {
130+
"SubscriptionIdParameter": {
131+
"name": "subscriptionId",
132+
"in": "path",
133+
"required": true,
134+
"type": "string",
135+
"description": "The ID of the target subscription."
136+
},
137+
"ApiVersionParameter": {
138+
"name": "api-version",
139+
"in": "query",
140+
"required": true,
141+
"type": "string",
142+
"description": "The API version to use for this operation."
143+
}
144+
}
145+
}

specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization.json

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -36,43 +36,6 @@
3636
}
3737
},
3838
"paths": {
39-
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators": {
40-
"get": {
41-
"tags": [
42-
"ClassicAdministrators"
43-
],
44-
"operationId": "ClassicAdministrators_List",
45-
"description": "Gets service administrator, account administrator, and co-administrators for the subscription.",
46-
"parameters": [
47-
{
48-
"name": "api-version",
49-
"in": "query",
50-
"required": true,
51-
"type": "string",
52-
"description": "The API version to use for this operation."
53-
},
54-
{
55-
"$ref": "#/parameters/SubscriptionIdParameter"
56-
}
57-
],
58-
"responses": {
59-
"200": {
60-
"description": "Returns an array of administrators.",
61-
"schema": {
62-
"$ref": "#/definitions/ClassicAdministratorListResult"
63-
}
64-
}
65-
},
66-
"x-ms-pageable": {
67-
"nextLinkName": "nextLink"
68-
},
69-
"x-ms-examples": {
70-
"GetConfigurations": {
71-
"$ref": "./examples/GetClassicAdministrators.json"
72-
}
73-
}
74-
}
75-
},
7639
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions": {
7740
"get": {
7841
"tags": [
@@ -959,56 +922,6 @@
959922
},
960923
"description": "Role Definitions filter"
961924
},
962-
"ClassicAdministratorProperties": {
963-
"properties": {
964-
"emailAddress": {
965-
"type": "string",
966-
"description": "The email address of the administrator."
967-
},
968-
"role": {
969-
"type": "string",
970-
"description": "The role of the administrator."
971-
}
972-
},
973-
"description": "Classic Administrator properties."
974-
},
975-
"ClassicAdministrator": {
976-
"properties": {
977-
"id": {
978-
"type": "string",
979-
"description": "The ID of the administrator."
980-
},
981-
"name": {
982-
"type": "string",
983-
"description": "The name of the administrator."
984-
},
985-
"type": {
986-
"type": "string",
987-
"description": "The type of the administrator."
988-
},
989-
"properties": {
990-
"$ref": "#/definitions/ClassicAdministratorProperties",
991-
"description": "Properties for the classic administrator."
992-
}
993-
},
994-
"description": "Classic Administrators"
995-
},
996-
"ClassicAdministratorListResult": {
997-
"properties": {
998-
"value": {
999-
"type": "array",
1000-
"items": {
1001-
"$ref": "#/definitions/ClassicAdministrator"
1002-
},
1003-
"description": "An array of administrators."
1004-
},
1005-
"nextLink": {
1006-
"type": "string",
1007-
"description": "The URL to use for getting the next set of results."
1008-
}
1009-
},
1010-
"description": "ClassicAdministrator list result information."
1011-
},
1012925
"Permission": {
1013926
"properties": {
1014927
"actions": {

specification/authorization/resource-manager/readme.md

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ These settings apply only when `--tag=package-2015-07` is specified on the comma
4646
``` yaml $(tag) == 'package-2015-07'
4747
input-file:
4848
- Microsoft.Authorization/stable/2015-07-01/authorization.json
49+
- Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json
50+
```
51+
52+
### Tag: package-2015-07-authorization-only
53+
54+
These settings apply only when `--tag=package-2015-07-authorization-only` is specified on the command line.
55+
56+
``` yaml $(tag) == 'package-2015-07-authorization-only'
57+
input-file:
58+
- Microsoft.Authorization/stable/2015-07-01/authorization.json
4959
```
5060

5161
### Tag: package-2015-06-01-preview
@@ -117,6 +127,8 @@ This is not used by Autorest itself.
117127
``` yaml $(swagger-to-sdk)
118128
swagger-to-sdk:
119129
- repo: azure-sdk-for-python
130+
after_scripts:
131+
- python ./scripts/multiapi_init_gen.py azure-mgmt-authorization
120132
- repo: azure-sdk-for-java
121133
- repo: azure-sdk-for-go
122134
- repo: azure-sdk-for-node
@@ -125,34 +137,6 @@ swagger-to-sdk:
125137
- bundle install && rake arm:regen_all_profiles['azure_mgmt_authorization']
126138
```
127139

128-
## Python
129-
130-
These settings apply only when `--python` is specified on the command line.
131-
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
132-
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.
133-
134-
``` yaml $(python)
135-
python-mode: create
136-
python:
137-
azure-arm: true
138-
license-header: MICROSOFT_MIT_NO_VERSION
139-
payload-flattening-threshold: 2
140-
namespace: azure.mgmt.authorization
141-
package-name: azure-mgmt-authorization
142-
package-version: 0.40.0
143-
clear-output-folder: true
144-
```
145-
``` yaml $(python) && $(python-mode) == 'update'
146-
python:
147-
no-namespace-folders: true
148-
output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization
149-
```
150-
``` yaml $(python) && $(python-mode) == 'create'
151-
python:
152-
basic-setup-py: true
153-
output-folder: $(python-sdks-folder)/azure-mgmt-authorization
154-
```
155-
156140
## Go
157141

158142
These settings apply only when `--go` is specified on the command line.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Python
2+
3+
These settings apply only when `--python` is specified on the command line.
4+
Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`.
5+
Use `--python-mode=update` if you already have a setup.py and just want to update the code itself.
6+
7+
``` yaml $(python)
8+
python-mode: create
9+
python:
10+
azure-arm: true
11+
license-header: MICROSOFT_MIT_NO_VERSION
12+
payload-flattening-threshold: 2
13+
package-name: azure-mgmt-authorization
14+
clear-output-folder: true
15+
no-namespace-folders: true
16+
```
17+
18+
### Python multi-api
19+
20+
Generate all API versions currently shipped for this package
21+
22+
```yaml $(python) && $(multiapi)
23+
batch:
24+
- tag: package-2018-01-01-preview-only
25+
- tag: package-2015-07-authorization-only
26+
- tag: package-2015-06-01-preview
27+
```
28+
29+
### Tag: package-2018-01-01-preview-only and python
30+
31+
These settings apply only when `--tag=package-2018-01-01-preview-only --python` is specified on the command line.
32+
33+
``` yaml $(tag) == 'package-2018-01-01-preview-only' && $(python)
34+
python:
35+
namespace: azure.mgmt.authorization.v2018_01_01_preview
36+
output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview
37+
```
38+
39+
### Tag: package-2015-07-authorization-only and python
40+
41+
These settings apply only when `--tag=package-2015-07-authorization-only --python` is specified on the command line.
42+
43+
``` yaml $(tag) == 'package-2015-07-authorization-only' && $(python)
44+
python:
45+
namespace: azure.mgmt.authorization.v2015_07_01
46+
output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01
47+
```
48+
49+
### Tag: 2015-06-01-preview and python
50+
51+
These settings apply only when `--tag=2015-06-01-preview --python` is specified on the command line.
52+
53+
``` yaml $(tag) == 'package-2015-06-01-preview' && $(python)
54+
python:
55+
namespace: azure.mgmt.authorization.v2015_06_01
56+
output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01
57+
```

0 commit comments

Comments
 (0)