From 5f5dcd1e876516649af9dca025c63b98f3d9cf02 Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Sun, 8 Dec 2019 18:54:07 -0800 Subject: [PATCH] databricks: switching `parameters` to be a proper struct (#7872) * databricks: switching `parameters` to be a proper struct * removing the unused required field * linting * DataBricks: matching the Swagger to the API request/response * Refactor nexamples/WorkspaceCreateParameters.json - > examples/WorkspaceCreateWithParameters.json * prettier * Update 201 body * Update resourceTags * DataBricks: fixing the parameter types --- .../stable/2018-04-01/databricks.json | 125 +++++++++++++- .../2018-04-01/examples/WorkspaceCreate.json | 2 - .../WorkspaceCreateWithParameters.json | 155 ++++++++++++++++++ .../examples/WorkspaceGetParameters.json | 79 +++++++++ .../2018-04-01/examples/WorkspaceUpdate.json | 1 - 5 files changed, 357 insertions(+), 5 deletions(-) create mode 100644 specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreateWithParameters.json create mode 100644 specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceGetParameters.json diff --git a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/databricks.json b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/databricks.json index e8de8a8beaef..abc6368cb41c 100644 --- a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/databricks.json +++ b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/databricks.json @@ -44,6 +44,9 @@ "x-ms-examples": { "Get a workspace": { "$ref": "./examples/WorkspaceGet.json" + }, + "Get a workspace with custom parameters": { + "$ref": "./examples/WorkspaceGetParameters.json" } }, "parameters": [ @@ -128,6 +131,9 @@ "x-ms-examples": { "Create or update workspace": { "$ref": "./examples/WorkspaceCreate.json" + }, + "Create or update workspace with custom parameters": { + "$ref": "./examples/WorkspaceCreateWithParameters.json" } }, "parameters": [ @@ -377,8 +383,8 @@ "description": "The managed resource group Id." }, "parameters": { - "type": "object", - "description": "Name and value pairs that define the workspace parameters." + "$ref": "#/definitions/WorkspaceCustomParameters", + "description": "The workspace's custom parameters." }, "provisioningState": { "readOnly": true, @@ -494,6 +500,121 @@ "modelAsString": true } }, + "WorkspaceCustomParameterType": { + "description": "Provisioning status of the workspace.", + "readOnly": true, + "enum": [ + "Bool", + "Object", + "String" + ], + "type": "string", + "x-ms-enum": { + "name": "CustomParameterType", + "modelAsString": true + } + }, + "WorkspaceCustomBooleanParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "boolean", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The value which should be used for this field." + }, + "WorkspaceCustomObjectParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "object", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The value which should be used for this field." + }, + "WorkspaceCustomStringParameter": { + "properties": { + "type": { + "$ref": "#/definitions/WorkspaceCustomParameterType", + "description": "The type of variable that this is" + }, + "value": { + "type": "string", + "description": "The value which should be used for this field." + } + }, + "required": [ + "value" + ], + "description": "The Value." + }, + "WorkspaceCustomParameters": { + "properties": { + "amlWorkspaceId": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The Workspace ID of an Azure Machine Learning Workspace" + }, + "customVirtualNetworkId": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The ID of a Virtual Network where this Databricks Cluster should be created" + }, + "customPublicSubnetName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of a Public Subnet within the Virtual Network" + }, + "customPrivateSubnetName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of the Private Subnet within the Virtual Network" + }, + "enableNoPublicIp": { + "$ref": "#/definitions/WorkspaceCustomBooleanParameter", + "description": "Should the Public IP be Disabled?" + }, + "loadBalancerBackendPoolName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of a Backend Address Pool within an Azure Load Balancer" + }, + "loadBalancerId": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The Resource ID of an Azure Load Balancer" + }, + "relayNamespaceName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name of an Azure Relay Namespace" + }, + "storageAccountName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The name which should be used for the Storage Account" + }, + "storageAccountSkuName": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The SKU which should be used for this Storage Account" + }, + "resourceTags": { + "$ref": "#/definitions/WorkspaceCustomObjectParameter", + "description": "A map of Tags which should be applied to the resources used by this Databricks Cluster." + }, + "vnetAddressPrefix": { + "$ref": "#/definitions/WorkspaceCustomStringParameter", + "description": "The first 2 octets of the virtual network /16 address range (e.g., '10.139' for the address range 10.139.0.0/16)." + } + }, + "description": "Custom Parameters used for Cluster Creation." + }, "WorkspaceProviderAuthorization": { "properties": { "principalId": { diff --git a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreate.json b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreate.json index 012fdf9674c1..977b42112e3b 100644 --- a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreate.json +++ b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreate.json @@ -8,14 +8,12 @@ "properties": { "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG" }, - "name": "myWorkspace", "location": "westus" } }, "responses": { "200": { "body": { - "name": "myWorkspace", "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", "type": "Microsoft.Databricks/workspaces", "location": "East US 2", diff --git a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreateWithParameters.json b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreateWithParameters.json new file mode 100644 index 000000000000..4e9773afc9be --- /dev/null +++ b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceCreateWithParameters.json @@ -0,0 +1,155 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01", + "parameters": { + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG" + }, + "location": "westus" + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "skuName" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "amlWorkspaceId": { + "type": "String", + "value": "11112222-3333-4444-5555-666677778888" + }, + "customPrivateSubnetName": { + "type": "String", + "value": "PrivateBob" + }, + "customPublicSubnetName": { + "type": "String", + "value": "PublicSarah" + }, + "customVirtualNetworkId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + }, + "enableNoPublicIp": { + "type": "Bool", + "value": true + }, + "loadBalancerBackendPoolName": { + "type": "String", + "value": "CustomBackendAddressPool" + }, + "loadBalancerId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1" + }, + "relayNamespaceName": { + "type": "String", + "value": "test" + }, + "resourceTags": { + "type": "Object", + "value": { + "hello": "world" + } + }, + "storageAccountName": { + "type": "String", + "value": "mysa999" + }, + "storageAccountSkuName": { + "type": "String", + "value": "Standard_GRS" + }, + "vnetAddressPrefix": { + "type": "String", + "value": "10.139" + } + }, + "provisioningState": "Created", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json" + } + } + }, + "201": { + "headers": {}, + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "tags": null, + "sku": { + "name": "skuName" + }, + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "amlWorkspaceId": { + "type": "String", + "value": "11112222-3333-4444-5555-666677778888" + }, + "customPrivateSubnetName": { + "type": "String", + "value": "PrivateBob" + }, + "customPublicSubnetName": { + "type": "String", + "value": "PublicSarah" + }, + "customVirtualNetworkId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + }, + "enableNoPublicIp": { + "type": "Bool", + "value": true + }, + "loadBalancerBackendPoolName": { + "type": "String", + "value": "CustomBackendAddressPool" + }, + "loadBalancerId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1" + }, + "relayNamespaceName": { + "type": "String", + "value": "test" + }, + "resourceTags": { + "type": "Object", + "value": { + "hello": "world" + } + }, + "storageAccountName": { + "type": "String", + "value": "mysa999" + }, + "storageAccountSkuName": { + "type": "String", + "value": "Standard_GRS" + }, + "vnetAddressPrefix": { + "type": "String", + "value": "10.139" + } + }, + "provisioningState": "Created", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json" + } + } + } + } +} diff --git a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceGetParameters.json b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceGetParameters.json new file mode 100644 index 000000000000..d2afb9f36a5f --- /dev/null +++ b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceGetParameters.json @@ -0,0 +1,79 @@ +{ + "parameters": { + "subscriptionId": "subid", + "resourceGroupName": "rg", + "workspaceName": "myWorkspace", + "api-version": "2018-04-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "name": "myWorkspace", + "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", + "type": "Microsoft.Databricks/workspaces", + "location": "East US 2", + "properties": { + "managedResourceGroupId": "/subscriptions/subid/resourceGroups/myManagedRG", + "parameters": { + "customPrivateSubnetName": { + "type": "String", + "value": "PrivateBob" + }, + "customPublicSubnetName": { + "type": "String", + "value": "PublicSarah" + }, + "customVirtualNetworkId": { + "type": "String", + "value": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/myNetwork" + }, + "enableNoPublicIp": { + "type": "Bool", + "value": true + }, + "loadBalancerBackendPoolName": { + "type": "String", + "value": "" + }, + "loadBalancerId": { + "type": "String", + "value": "" + }, + "relayNamespaceName": { + "type": "String", + "value": "test" + }, + "storageAccountName": { + "type": "String", + "value": "examplesa99" + }, + "storageAccountSkuName": { + "type": "String", + "value": "Standard_GRS" + }, + "vnetAddressPrefix": { + "type": "String", + "value": "10.139" + }, + "resourceTags": { + "type": "Object", + "value": { + "application": "databricks", + "databricks-environment": "true", + "Environment": "Production" + } + }, + "amlWorkspaceId": { + "type": "String", + "value": "" + } + }, + "provisioningState": "Created", + "uiDefinitionUri": "https://path/to/workspaceCreateUiDefinition.json" + } + } + }, + "404": {} + } +} diff --git a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceUpdate.json b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceUpdate.json index 6151245f9690..e386347fa0a2 100644 --- a/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceUpdate.json +++ b/specification/databricks/resource-manager/Microsoft.Databricks/stable/2018-04-01/examples/WorkspaceUpdate.json @@ -14,7 +14,6 @@ "200": { "headers": {}, "body": { - "name": "myWorkspace", "id": "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Databricks/workspaces/myWorkspace", "type": "Microsoft.Databricks/workspaces", "location": "East US 2",