From b02898aad27b85284117c53deddb43d1a7b1c4a6 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Tue, 29 May 2018 17:22:07 -0700 Subject: [PATCH 1/2] Python Authorization to multi api --- .../authorization/resource-manager/readme.md | 30 +----------- .../resource-manager/readme.python.md | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 specification/authorization/resource-manager/readme.python.md diff --git a/specification/authorization/resource-manager/readme.md b/specification/authorization/resource-manager/readme.md index ea8e08b5a315..117e106c467e 100644 --- a/specification/authorization/resource-manager/readme.md +++ b/specification/authorization/resource-manager/readme.md @@ -117,6 +117,8 @@ This is not used by Autorest itself. ``` yaml $(swagger-to-sdk) swagger-to-sdk: - repo: azure-sdk-for-python + after_scripts: + - python ./scripts/multiapi_init_gen.py azure-mgmt-authorization - repo: azure-libraries-for-java - repo: azure-sdk-for-go - repo: azure-sdk-for-node @@ -140,34 +142,6 @@ csharp: clear-output-folder: true ``` -## Python - -These settings apply only when `--python` is specified on the command line. -Please also specify `--python-sdks-folder=`. -Use `--python-mode=update` if you already have a setup.py and just want to update the code itself. - -``` yaml $(python) -python-mode: create -python: - azure-arm: true - license-header: MICROSOFT_MIT_NO_VERSION - payload-flattening-threshold: 2 - namespace: azure.mgmt.authorization - package-name: azure-mgmt-authorization - package-version: 0.40.0 - clear-output-folder: true -``` -``` yaml $(python) && $(python-mode) == 'update' -python: - no-namespace-folders: true - output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization -``` -``` yaml $(python) && $(python-mode) == 'create' -python: - basic-setup-py: true - output-folder: $(python-sdks-folder)/azure-mgmt-authorization -``` - ## Go These settings apply only when `--go` is specified on the command line. diff --git a/specification/authorization/resource-manager/readme.python.md b/specification/authorization/resource-manager/readme.python.md new file mode 100644 index 000000000000..7cf050ce5a57 --- /dev/null +++ b/specification/authorization/resource-manager/readme.python.md @@ -0,0 +1,46 @@ +## Python + +These settings apply only when `--python` is specified on the command line. +Please also specify `--python-sdks-folder=`. +Use `--python-mode=update` if you already have a setup.py and just want to update the code itself. + +``` yaml $(python) +python-mode: create +python: + azure-arm: true + license-header: MICROSOFT_MIT_NO_VERSION + payload-flattening-threshold: 2 + package-name: azure-mgmt-authorization + clear-output-folder: true + no-namespace-folders: true +``` + +### Python multi-api + +Generate all API versions currently shipped for this package + +```yaml $(python) && $(multiapi) +batch: + - tag: package-2018-01-01-preview-only + - tag: package-2015-07 +``` + +### Tag: package-2018-01-01-preview-only and python + +These settings apply only when `--tag=package-2018-01-01-preview-only --python` is specified on the command line. + +``` yaml $(tag) == 'package-2018-01-01-preview-only' && $(python) +python: + namespace: azure.mgmt.authorization.v2018_01_01_preview + output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview +``` + +### Tag: package-2015-07 and python + +These settings apply only when `--tag=package-2015-07 --python` is specified on the command line. + +``` yaml $(tag) == 'package-2015-07' && $(python) +python: + namespace: azure.mgmt.authorization.v2015_07_01 + output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01 +``` From 701941bedc7e0c8c96724e2c185fb6ad74e23d42 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Wed, 6 Jun 2018 17:23:26 -0700 Subject: [PATCH 2/2] Split Authorization Swagger --- .../authorization-ClassicAdminCalls.json | 145 ++++++++++++++++++ .../stable/2015-07-01/authorization.json | 87 ----------- .../authorization/resource-manager/readme.md | 10 ++ .../resource-manager/readme.python.md | 19 ++- 4 files changed, 170 insertions(+), 91 deletions(-) create mode 100644 specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json diff --git a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json b/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json new file mode 100644 index 000000000000..cae32139704f --- /dev/null +++ b/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json @@ -0,0 +1,145 @@ +{ + "swagger": "2.0", + "info": { + "title": "AuthorizationManagementClient", + "version": "2015-07-01", + "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." + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json", + "text/json" + ], + "produces": [ + "application/json", + "text/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators": { + "get": { + "tags": [ + "ClassicAdministrators" + ], + "operationId": "ClassicAdministrators_List", + "description": "Gets service administrator, account administrator, and co-administrators for the subscription.", + "parameters": [ + { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The API version to use for this operation." + }, + { + "$ref": "#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Returns an array of administrators.", + "schema": { + "$ref": "#/definitions/ClassicAdministratorListResult" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + }, + "x-ms-examples": { + "GetConfigurations": { + "$ref": "./examples/GetClassicAdministrators.json" + } + } + } + } + }, + "definitions": { + "ClassicAdministratorProperties": { + "properties": { + "emailAddress": { + "type": "string", + "description": "The email address of the administrator." + }, + "role": { + "type": "string", + "description": "The role of the administrator." + } + }, + "description": "Classic Administrator properties." + }, + "ClassicAdministrator": { + "properties": { + "id": { + "type": "string", + "description": "The ID of the administrator." + }, + "name": { + "type": "string", + "description": "The name of the administrator." + }, + "type": { + "type": "string", + "description": "The type of the administrator." + }, + "properties": { + "$ref": "#/definitions/ClassicAdministratorProperties", + "description": "Properties for the classic administrator." + } + }, + "description": "Classic Administrators" + }, + "ClassicAdministratorListResult": { + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/ClassicAdministrator" + }, + "description": "An array of administrators." + }, + "nextLink": { + "type": "string", + "description": "The URL to use for getting the next set of results." + } + }, + "description": "ClassicAdministrator list result information." + } + }, + "parameters": { + "SubscriptionIdParameter": { + "name": "subscriptionId", + "in": "path", + "required": true, + "type": "string", + "description": "The ID of the target subscription." + }, + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "required": true, + "type": "string", + "description": "The API version to use for this operation." + } + } +} \ No newline at end of file diff --git a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization.json b/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization.json index f6381d8809fa..6db03a407311 100644 --- a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization.json +++ b/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/authorization.json @@ -36,43 +36,6 @@ } }, "paths": { - "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators": { - "get": { - "tags": [ - "ClassicAdministrators" - ], - "operationId": "ClassicAdministrators_List", - "description": "Gets service administrator, account administrator, and co-administrators for the subscription.", - "parameters": [ - { - "name": "api-version", - "in": "query", - "required": true, - "type": "string", - "description": "The API version to use for this operation." - }, - { - "$ref": "#/parameters/SubscriptionIdParameter" - } - ], - "responses": { - "200": { - "description": "Returns an array of administrators.", - "schema": { - "$ref": "#/definitions/ClassicAdministratorListResult" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - }, - "x-ms-examples": { - "GetConfigurations": { - "$ref": "./examples/GetClassicAdministrators.json" - } - } - } - }, "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions": { "get": { "tags": [ @@ -959,56 +922,6 @@ }, "description": "Role Definitions filter" }, - "ClassicAdministratorProperties": { - "properties": { - "emailAddress": { - "type": "string", - "description": "The email address of the administrator." - }, - "role": { - "type": "string", - "description": "The role of the administrator." - } - }, - "description": "Classic Administrator properties." - }, - "ClassicAdministrator": { - "properties": { - "id": { - "type": "string", - "description": "The ID of the administrator." - }, - "name": { - "type": "string", - "description": "The name of the administrator." - }, - "type": { - "type": "string", - "description": "The type of the administrator." - }, - "properties": { - "$ref": "#/definitions/ClassicAdministratorProperties", - "description": "Properties for the classic administrator." - } - }, - "description": "Classic Administrators" - }, - "ClassicAdministratorListResult": { - "properties": { - "value": { - "type": "array", - "items": { - "$ref": "#/definitions/ClassicAdministrator" - }, - "description": "An array of administrators." - }, - "nextLink": { - "type": "string", - "description": "The URL to use for getting the next set of results." - } - }, - "description": "ClassicAdministrator list result information." - }, "Permission": { "properties": { "actions": { diff --git a/specification/authorization/resource-manager/readme.md b/specification/authorization/resource-manager/readme.md index 117e106c467e..fa1c1bca40bb 100644 --- a/specification/authorization/resource-manager/readme.md +++ b/specification/authorization/resource-manager/readme.md @@ -46,6 +46,16 @@ These settings apply only when `--tag=package-2015-07` is specified on the comma ``` yaml $(tag) == 'package-2015-07' input-file: - Microsoft.Authorization/stable/2015-07-01/authorization.json +- Microsoft.Authorization/stable/2015-07-01/authorization-ClassicAdminCalls.json +``` + +### Tag: package-2015-07-authorization-only + +These settings apply only when `--tag=package-2015-07-authorization-only` is specified on the command line. + +``` yaml $(tag) == 'package-2015-07-authorization-only' +input-file: +- Microsoft.Authorization/stable/2015-07-01/authorization.json ``` ### Tag: package-2015-06-01-preview diff --git a/specification/authorization/resource-manager/readme.python.md b/specification/authorization/resource-manager/readme.python.md index 7cf050ce5a57..58dbdb31c6ff 100644 --- a/specification/authorization/resource-manager/readme.python.md +++ b/specification/authorization/resource-manager/readme.python.md @@ -22,7 +22,8 @@ Generate all API versions currently shipped for this package ```yaml $(python) && $(multiapi) batch: - tag: package-2018-01-01-preview-only - - tag: package-2015-07 + - tag: package-2015-07-authorization-only + - tag: package-2015-06-01-preview ``` ### Tag: package-2018-01-01-preview-only and python @@ -35,12 +36,22 @@ python: output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview ``` -### Tag: package-2015-07 and python +### Tag: package-2015-07-authorization-only and python -These settings apply only when `--tag=package-2015-07 --python` is specified on the command line. +These settings apply only when `--tag=package-2015-07-authorization-only --python` is specified on the command line. -``` yaml $(tag) == 'package-2015-07' && $(python) +``` yaml $(tag) == 'package-2015-07-authorization-only' && $(python) python: namespace: azure.mgmt.authorization.v2015_07_01 output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2015_07_01 ``` + +### Tag: 2015-06-01-preview and python + +These settings apply only when `--tag=2015-06-01-preview --python` is specified on the command line. + +``` yaml $(tag) == 'package-2015-06-01-preview' && $(python) +python: + namespace: azure.mgmt.authorization.v2015_06_01 + output-folder: $(python-sdks-folder)/azure-mgmt-authorization/azure/mgmt/authorization/v2015_06_01 +```