diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/Microsoft.Batch.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/Microsoft.Batch.json index e35a69c99b..0353b66107 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/Microsoft.Batch.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Batch/Microsoft.Batch.json @@ -4,7 +4,7 @@ "title": "Microsoft.Batch", "description": "Microsoft Batch Resource Types", "resourceDefinitions": { - "Microsoft.Batch_batchAccounts": { + "batchAccounts": { "type": "object", "properties": { "type": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/CDN/Microsoft.Cdn.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/CDN/Microsoft.Cdn.json index bf7c8c6821..9f56f516c8 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/CDN/Microsoft.Cdn.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/CDN/Microsoft.Cdn.json @@ -4,7 +4,7 @@ "title": "Microsoft.Cdn", "description": "Microsoft Cdn Resource Types", "resourceDefinitions": { - "Microsoft.Cdn_profiles": { + "profiles": { "type": "object", "properties": { "type": { @@ -54,7 +54,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Cdn_profiles_endpoints_childResource" + "$ref": "#/definitions/profiles_endpoints_childResource" } ] } @@ -67,7 +67,7 @@ ], "description": "Microsoft.Cdn/profiles" }, - "Microsoft.Cdn_profiles_endpoints": { + "profiles_endpoints": { "type": "object", "properties": { "type": { @@ -116,10 +116,10 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Cdn_profiles_endpoints_customDomains_childResource" + "$ref": "#/definitions/profiles_endpoints_customDomains_childResource" }, { - "$ref": "#/definitions/Microsoft.Cdn_profiles_endpoints_origins_childResource" + "$ref": "#/definitions/profiles_endpoints_origins_childResource" } ] } @@ -132,7 +132,7 @@ ], "description": "Microsoft.Cdn/profiles/endpoints" }, - "Microsoft.Cdn_profiles_endpoints_customDomains": { + "profiles_endpoints_customDomains": { "type": "object", "properties": { "type": { @@ -165,7 +165,7 @@ ], "description": "Microsoft.Cdn/profiles/endpoints/customDomains" }, - "Microsoft.Cdn_profiles_endpoints_origins": { + "profiles_endpoints_origins": { "type": "object", "properties": { "type": { @@ -364,7 +364,41 @@ "origins" ] }, - "Microsoft.Cdn_profiles_endpoints_childResource": { + "OriginPropertiesParameters": { + "type": "object", + "properties": { + "hostName": { + "type": "string", + "description": "The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported." + }, + "httpPort": { + "oneOf": [ + { + "type": "integer" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ], + "description": "The value of the HTTP port. Must be between 1 and 65535." + }, + "httpsPort": { + "oneOf": [ + { + "type": "integer" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ], + "description": "The value of the HTTPS port. Must be between 1 and 65535." + } + }, + "required": [ + "hostName" + ] + }, + "profiles_endpoints_childResource": { "type": "object", "properties": { "type": { @@ -413,10 +447,10 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Cdn_profiles_endpoints_customDomains_childResource" + "$ref": "#/definitions/profiles_endpoints_customDomains_childResource" }, { - "$ref": "#/definitions/Microsoft.Cdn_profiles_endpoints_origins_childResource" + "$ref": "#/definitions/profiles_endpoints_origins_childResource" } ] } @@ -429,7 +463,7 @@ ], "description": "Microsoft.Cdn/profiles/endpoints" }, - "Microsoft.Cdn_profiles_endpoints_customDomains_childResource": { + "profiles_endpoints_customDomains_childResource": { "type": "object", "properties": { "type": { @@ -462,7 +496,7 @@ ], "description": "Microsoft.Cdn/profiles/endpoints/customDomains" }, - "Microsoft.Cdn_profiles_endpoints_origins_childResource": { + "profiles_endpoints_origins_childResource": { "type": "object", "properties": { "type": { @@ -495,40 +529,6 @@ ], "description": "Microsoft.Cdn/profiles/endpoints/origins" }, - "OriginPropertiesParameters": { - "type": "object", - "properties": { - "hostName": { - "type": "string", - "description": "The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported." - }, - "httpPort": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "The value of the HTTP port. Must be between 1 and 65535." - }, - "httpsPort": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "The value of the HTTPS port. Must be between 1 and 65535." - } - }, - "required": [ - "hostName" - ] - }, "Sku": { "type": "object", "properties": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Compute/Microsoft.Compute.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Compute/Microsoft.Compute.json index d6cf3e6455..30685340f6 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Compute/Microsoft.Compute.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Compute/Microsoft.Compute.json @@ -4,7 +4,7 @@ "title": "Microsoft.Compute", "description": "Microsoft Compute Resource Types", "resourceDefinitions": { - "Microsoft.Compute_availabilitySets": { + "availabilitySets": { "type": "object", "properties": { "type": { @@ -37,7 +37,7 @@ ], "description": "Microsoft.Compute/availabilitySets" }, - "Microsoft.Compute_virtualMachines": { + "virtualMachines": { "type": "object", "properties": { "type": { @@ -79,7 +79,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Compute_virtualMachines_extensions_childResource" + "$ref": "#/definitions/virtualMachines_extensions_childResource" } ] } @@ -91,7 +91,7 @@ ], "description": "Microsoft.Compute/virtualMachines" }, - "Microsoft.Compute_virtualMachines_extensions": { + "virtualMachines_extensions": { "type": "object", "properties": { "type": { @@ -124,7 +124,7 @@ ], "description": "Microsoft.Compute/virtualMachines/extensions" }, - "Microsoft.Compute_virtualMachineScaleSets": { + "virtualMachineScaleSets": { "type": "object", "properties": { "type": { @@ -678,39 +678,6 @@ }, "description": "Describes Windows Configuration of the OS Profile." }, - "Microsoft.Compute_virtualMachines_extensions_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "extensions" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/VirtualMachineExtensionProperties" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Compute/virtualMachines/extensions" - }, "NetworkInterfaceReference": { "type": "object", "properties": { @@ -1340,6 +1307,39 @@ }, "description": "Describes the properties of a Virtual Machine." }, + "virtualMachines_extensions_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "extensions" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/VirtualMachineExtensionProperties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Compute/virtualMachines/extensions" + }, "VirtualMachineScaleSetExtension": { "type": "object", "properties": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Network/Microsoft.Network.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Network/Microsoft.Network.json index 6c740b079a..0641162efb 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Network/Microsoft.Network.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Network/Microsoft.Network.json @@ -4,7 +4,7 @@ "title": "Microsoft.Network", "description": "Microsoft Network Resource Types", "resourceDefinitions": { - "Microsoft.Network_applicationGateways": { + "applicationGateways": { "type": "object", "properties": { "type": { @@ -41,7 +41,7 @@ ], "description": "Microsoft.Network/applicationGateways" }, - "Microsoft.Network_connections": { + "connections": { "type": "object", "properties": { "type": { @@ -78,7 +78,7 @@ ], "description": "Microsoft.Network/connections" }, - "Microsoft.Network_expressRouteCircuits": { + "expressRouteCircuits": { "type": "object", "properties": { "type": { @@ -124,10 +124,10 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Network_expressRouteCircuits_peerings_childResource" + "$ref": "#/definitions/expressRouteCircuits_peerings_childResource" }, { - "$ref": "#/definitions/Microsoft.Network_expressRouteCircuits_authorizations_childResource" + "$ref": "#/definitions/expressRouteCircuits_authorizations_childResource" } ] } @@ -139,7 +139,7 @@ ], "description": "Microsoft.Network/expressRouteCircuits" }, - "Microsoft.Network_expressRouteCircuits_authorizations": { + "expressRouteCircuits_authorizations": { "type": "object", "properties": { "type": { @@ -180,7 +180,7 @@ ], "description": "Microsoft.Network/expressRouteCircuits/authorizations" }, - "Microsoft.Network_expressRouteCircuits_peerings": { + "expressRouteCircuits_peerings": { "type": "object", "properties": { "type": { @@ -221,7 +221,7 @@ ], "description": "Microsoft.Network/expressRouteCircuits/peerings" }, - "Microsoft.Network_loadBalancers": { + "loadBalancers": { "type": "object", "properties": { "type": { @@ -258,7 +258,7 @@ ], "description": "Microsoft.Network/loadBalancers" }, - "Microsoft.Network_localNetworkGateways": { + "localNetworkGateways": { "type": "object", "properties": { "type": { @@ -295,7 +295,7 @@ ], "description": "Microsoft.Network/localNetworkGateways" }, - "Microsoft.Network_networkInterfaces": { + "networkInterfaces": { "type": "object", "properties": { "type": { @@ -332,7 +332,7 @@ ], "description": "Microsoft.Network/networkInterfaces" }, - "Microsoft.Network_networkSecurityGroups": { + "networkSecurityGroups": { "type": "object", "properties": { "type": { @@ -367,7 +367,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Network_networkSecurityGroups_securityRules_childResource" + "$ref": "#/definitions/networkSecurityGroups_securityRules_childResource" } ] } @@ -379,7 +379,7 @@ ], "description": "Microsoft.Network/networkSecurityGroups" }, - "Microsoft.Network_networkSecurityGroups_securityRules": { + "networkSecurityGroups_securityRules": { "type": "object", "properties": { "type": { @@ -420,7 +420,7 @@ ], "description": "Microsoft.Network/networkSecurityGroups/securityRules" }, - "Microsoft.Network_publicIPAddresses": { + "publicIPAddresses": { "type": "object", "properties": { "type": { @@ -457,7 +457,7 @@ ], "description": "Microsoft.Network/publicIPAddresses" }, - "Microsoft.Network_routeTables": { + "routeTables": { "type": "object", "properties": { "type": { @@ -492,7 +492,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Network_routeTables_routes_childResource" + "$ref": "#/definitions/routeTables_routes_childResource" } ] } @@ -504,7 +504,7 @@ ], "description": "Microsoft.Network/routeTables" }, - "Microsoft.Network_routeTables_routes": { + "routeTables_routes": { "type": "object", "properties": { "type": { @@ -545,7 +545,7 @@ ], "description": "Microsoft.Network/routeTables/routes" }, - "Microsoft.Network_virtualnetworkgateways": { + "virtualnetworkgateways": { "type": "object", "properties": { "type": { @@ -582,7 +582,7 @@ ], "description": "Microsoft.Network/virtualnetworkgateways" }, - "Microsoft.Network_virtualnetworks": { + "virtualnetworks": { "type": "object", "properties": { "type": { @@ -617,7 +617,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Network_virtualnetworks_subnets_childResource" + "$ref": "#/definitions/virtualnetworks_subnets_childResource" } ] } @@ -629,7 +629,7 @@ ], "description": "Microsoft.Network/virtualnetworks" }, - "Microsoft.Network_virtualnetworks_subnets": { + "virtualnetworks_subnets": { "type": "object", "properties": { "type": { @@ -2220,6 +2220,88 @@ }, "description": "Properties of ExpressRouteCircuit" }, + "expressRouteCircuits_authorizations_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "authorizations" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/AuthorizationPropertiesFormat" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "name": { + "type": "string", + "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" + }, + "etag": { + "type": "string", + "description": "A unique read-only string that changes whenever the resource is updated" + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Network/expressRouteCircuits/authorizations" + }, + "expressRouteCircuits_peerings_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "peerings" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/ExpressRouteCircuitPeeringPropertiesFormat" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "name": { + "type": "string", + "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" + }, + "etag": { + "type": "string", + "description": "A unique read-only string that changes whenever the resource is updated" + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Network/expressRouteCircuits/peerings" + }, "ExpressRouteCircuitServiceProviderProperties": { "type": "object", "properties": { @@ -3115,211 +3197,6 @@ }, "description": "LocalNetworkGateway properties" }, - "Microsoft.Network_expressRouteCircuits_authorizations_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "authorizations" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/AuthorizationPropertiesFormat" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "name": { - "type": "string", - "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" - }, - "etag": { - "type": "string", - "description": "A unique read-only string that changes whenever the resource is updated" - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Network/expressRouteCircuits/authorizations" - }, - "Microsoft.Network_expressRouteCircuits_peerings_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "peerings" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/ExpressRouteCircuitPeeringPropertiesFormat" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "name": { - "type": "string", - "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" - }, - "etag": { - "type": "string", - "description": "A unique read-only string that changes whenever the resource is updated" - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Network/expressRouteCircuits/peerings" - }, - "Microsoft.Network_networkSecurityGroups_securityRules_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "securityRules" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/SecurityRulePropertiesFormat" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "name": { - "type": "string", - "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" - }, - "etag": { - "type": "string", - "description": "A unique read-only string that changes whenever the resource is updated" - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Network/networkSecurityGroups/securityRules" - }, - "Microsoft.Network_routeTables_routes_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "routes" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/RoutePropertiesFormat" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "name": { - "type": "string", - "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" - }, - "etag": { - "type": "string", - "description": "A unique read-only string that changes whenever the resource is updated" - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Network/routeTables/routes" - }, - "Microsoft.Network_virtualnetworks_subnets_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "subnets" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2016-03-30" - ] - }, - "properties": { - "oneOf": [ - { - "$ref": "#/definitions/SubnetPropertiesFormat" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "name": { - "type": "string", - "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" - }, - "etag": { - "type": "string", - "description": "A unique read-only string that changes whenever the resource is updated" - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Network/virtualnetworks/subnets" - }, "NetworkInterface": { "type": "object", "properties": { @@ -3739,6 +3616,47 @@ }, "description": "Network Security Group resource" }, + "networkSecurityGroups_securityRules_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "securityRules" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/SecurityRulePropertiesFormat" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "name": { + "type": "string", + "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" + }, + "etag": { + "type": "string", + "description": "A unique read-only string that changes whenever the resource is updated" + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Network/networkSecurityGroups/securityRules" + }, "OutboundNatRule": { "type": "object", "properties": { @@ -4209,6 +4127,47 @@ }, "description": "Route Table resource" }, + "routeTables_routes_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "routes" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/RoutePropertiesFormat" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "name": { + "type": "string", + "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" + }, + "etag": { + "type": "string", + "description": "A unique read-only string that changes whenever the resource is updated" + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Network/routeTables/routes" + }, "SecurityRule": { "type": "object", "properties": { @@ -4889,6 +4848,47 @@ } } }, + "virtualnetworks_subnets_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "subnets" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2016-03-30" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/SubnetPropertiesFormat" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "name": { + "type": "string", + "description": "Gets name of the resource that is unique within a resource group. This name can be used to access the resource" + }, + "etag": { + "type": "string", + "description": "A unique read-only string that changes whenever the resource is updated" + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Network/virtualnetworks/subnets" + }, "VpnClientConfiguration": { "type": "object", "properties": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Storage/Microsoft.Storage.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Storage/Microsoft.Storage.json index a98dba664b..79847f9feb 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Storage/Microsoft.Storage.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Storage/Microsoft.Storage.json @@ -4,7 +4,7 @@ "title": "Microsoft.Storage", "description": "Microsoft Storage Resource Types", "resourceDefinitions": { - "Microsoft.Storage_storageAccounts": { + "storageAccounts": { "type": "object", "properties": { "type": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.CertificateRegistration.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.CertificateRegistration.json index 384d6bcb85..df0baf3343 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.CertificateRegistration.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.CertificateRegistration.json @@ -4,7 +4,7 @@ "title": "Microsoft.CertificateRegistration", "description": "Microsoft CertificateRegistration Resource Types", "resourceDefinitions": { - "Microsoft.CertificateRegistration_certificateOrders": { + "certificateOrders": { "type": "object", "properties": { "type": { @@ -35,7 +35,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.CertificateRegistration_certificateOrders_certificates_childResource" + "$ref": "#/definitions/certificateOrders_certificates_childResource" } ] } @@ -47,7 +47,7 @@ ], "description": "Microsoft.CertificateRegistration/certificateOrders" }, - "Microsoft.CertificateRegistration_certificateOrders_certificates": { + "certificateOrders_certificates": { "type": "object", "properties": { "type": { @@ -437,7 +437,7 @@ } } }, - "Microsoft.CertificateRegistration_certificateOrders_certificates_childResource": { + "certificateOrders_certificates_childResource": { "type": "object", "properties": { "type": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.DomainRegistration.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.DomainRegistration.json index afbd6b95f9..12caa3e346 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.DomainRegistration.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.DomainRegistration.json @@ -4,7 +4,7 @@ "title": "Microsoft.DomainRegistration", "description": "Microsoft DomainRegistration Resource Types", "resourceDefinitions": { - "Microsoft.DomainRegistration_domains": { + "domains": { "type": "object", "properties": { "type": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.Web.json b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.Web.json index 9ba73d1303..aca0f93c96 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.Web.json +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/Expected/Web/Microsoft.Web.json @@ -4,7 +4,7 @@ "title": "Microsoft.Web", "description": "Microsoft Web Resource Types", "resourceDefinitions": { - "Microsoft.Web_certificates": { + "certificates": { "type": "object", "properties": { "type": { @@ -37,7 +37,7 @@ ], "description": "Microsoft.Web/certificates" }, - "Microsoft.Web_csrs": { + "csrs": { "type": "object", "properties": { "type": { @@ -70,7 +70,7 @@ ], "description": "Microsoft.Web/csrs" }, - "Microsoft.Web_hostingEnvironments": { + "hostingEnvironments": { "type": "object", "properties": { "type": { @@ -101,7 +101,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_hostingEnvironments_workerPools_childResource" + "$ref": "#/definitions/hostingEnvironments_workerPools_childResource" } ] } @@ -113,7 +113,7 @@ ], "description": "Microsoft.Web/hostingEnvironments" }, - "Microsoft.Web_hostingEnvironments_workerPools": { + "hostingEnvironments_workerPools": { "type": "object", "properties": { "type": { @@ -156,7 +156,7 @@ ], "description": "Microsoft.Web/hostingEnvironments/workerPools" }, - "Microsoft.Web_managedHostingEnvironments": { + "managedHostingEnvironments": { "type": "object", "properties": { "type": { @@ -189,7 +189,7 @@ ], "description": "Microsoft.Web/managedHostingEnvironments" }, - "Microsoft.Web_serverfarms": { + "serverfarms": { "type": "object", "properties": { "type": { @@ -232,7 +232,7 @@ ], "description": "Microsoft.Web/serverfarms" }, - "Microsoft.Web_serverfarms_virtualNetworkConnections_gateways": { + "serverfarms_virtualNetworkConnections_gateways": { "type": "object", "properties": { "type": { @@ -265,7 +265,7 @@ ], "description": "Microsoft.Web/serverfarms/virtualNetworkConnections/gateways" }, - "Microsoft.Web_serverfarms_virtualNetworkConnections_routes": { + "serverfarms_virtualNetworkConnections_routes": { "type": "object", "properties": { "type": { @@ -298,7 +298,7 @@ ], "description": "Microsoft.Web/serverfarms/virtualNetworkConnections/routes" }, - "Microsoft.Web_sites": { + "sites": { "type": "object", "properties": { "type": { @@ -329,19 +329,19 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_hybridconnection_childResource" + "$ref": "#/definitions/sites_hybridconnection_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_hostNameBindings_childResource" + "$ref": "#/definitions/sites_hostNameBindings_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_deployments_childResource" + "$ref": "#/definitions/sites_deployments_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_slots_childResource" + "$ref": "#/definitions/sites_slots_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_virtualNetworkConnections_childResource" + "$ref": "#/definitions/sites_virtualNetworkConnections_childResource" } ] } @@ -353,7 +353,7 @@ ], "description": "Microsoft.Web/sites" }, - "Microsoft.Web_sites_deployments": { + "sites_deployments": { "type": "object", "properties": { "type": { @@ -386,7 +386,7 @@ ], "description": "Microsoft.Web/sites/deployments" }, - "Microsoft.Web_sites_hostNameBindings": { + "sites_hostNameBindings": { "type": "object", "properties": { "type": { @@ -419,7 +419,7 @@ ], "description": "Microsoft.Web/sites/hostNameBindings" }, - "Microsoft.Web_sites_hybridconnection": { + "sites_hybridconnection": { "type": "object", "properties": { "type": { @@ -452,7 +452,7 @@ ], "description": "Microsoft.Web/sites/hybridconnection" }, - "Microsoft.Web_sites_instances_deployments": { + "sites_instances_deployments": { "type": "object", "properties": { "type": { @@ -485,7 +485,7 @@ ], "description": "Microsoft.Web/sites/instances/deployments" }, - "Microsoft.Web_sites_slots": { + "sites_slots": { "type": "object", "properties": { "type": { @@ -516,16 +516,16 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_slots_hybridconnection_childResource" + "$ref": "#/definitions/sites_slots_hybridconnection_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_slots_hostNameBindings_childResource" + "$ref": "#/definitions/sites_slots_hostNameBindings_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_slots_deployments_childResource" + "$ref": "#/definitions/sites_slots_deployments_childResource" }, { - "$ref": "#/definitions/Microsoft.Web_sites_slots_virtualNetworkConnections_childResource" + "$ref": "#/definitions/sites_slots_virtualNetworkConnections_childResource" } ] } @@ -537,7 +537,7 @@ ], "description": "Microsoft.Web/sites/slots" }, - "Microsoft.Web_sites_slots_deployments": { + "sites_slots_deployments": { "type": "object", "properties": { "type": { @@ -570,7 +570,7 @@ ], "description": "Microsoft.Web/sites/slots/deployments" }, - "Microsoft.Web_sites_slots_hostNameBindings": { + "sites_slots_hostNameBindings": { "type": "object", "properties": { "type": { @@ -603,7 +603,7 @@ ], "description": "Microsoft.Web/sites/slots/hostNameBindings" }, - "Microsoft.Web_sites_slots_hybridconnection": { + "sites_slots_hybridconnection": { "type": "object", "properties": { "type": { @@ -636,7 +636,7 @@ ], "description": "Microsoft.Web/sites/slots/hybridconnection" }, - "Microsoft.Web_sites_slots_instances_deployments": { + "sites_slots_instances_deployments": { "type": "object", "properties": { "type": { @@ -669,7 +669,7 @@ ], "description": "Microsoft.Web/sites/slots/instances/deployments" }, - "Microsoft.Web_sites_slots_virtualNetworkConnections": { + "sites_slots_virtualNetworkConnections": { "type": "object", "properties": { "type": { @@ -700,7 +700,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_slots_virtualNetworkConnections_gateways_childResource" + "$ref": "#/definitions/sites_slots_virtualNetworkConnections_gateways_childResource" } ] } @@ -712,7 +712,7 @@ ], "description": "Microsoft.Web/sites/slots/virtualNetworkConnections" }, - "Microsoft.Web_sites_slots_virtualNetworkConnections_gateways": { + "sites_slots_virtualNetworkConnections_gateways": { "type": "object", "properties": { "type": { @@ -745,7 +745,7 @@ ], "description": "Microsoft.Web/sites/slots/virtualNetworkConnections/gateways" }, - "Microsoft.Web_sites_virtualNetworkConnections": { + "sites_virtualNetworkConnections": { "type": "object", "properties": { "type": { @@ -776,7 +776,7 @@ "items": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_virtualNetworkConnections_gateways_childResource" + "$ref": "#/definitions/sites_virtualNetworkConnections_gateways_childResource" } ] } @@ -788,7 +788,7 @@ ], "description": "Microsoft.Web/sites/virtualNetworkConnections" }, - "Microsoft.Web_sites_virtualNetworkConnections_gateways": { + "sites_virtualNetworkConnections_gateways": { "type": "object", "properties": { "type": { @@ -1607,6 +1607,49 @@ }, "description": "Specification for a hostingEnvironment (App Service Environment) to use for this resource" }, + "hostingEnvironments_workerPools_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "workerPools" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/WorkerPool_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + }, + "sku": { + "oneOf": [ + { + "$ref": "#/definitions/SkuDescription" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/hostingEnvironments/workerPools" + }, "HostNameBinding_properties": { "type": "object", "properties": { @@ -1735,744 +1778,302 @@ }, "description": "Represents an ip security restriction on a web app." }, - "Microsoft.Web_hostingEnvironments_workerPools_childResource": { + "NameValuePair": { "type": "object", "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "workerPools" - ] + "description": "Pair name" }, - "apiVersion": { + "value": { "type": "string", - "enum": [ - "2015-08-01" - ] - }, - "properties": { + "description": "Pair value" + } + }, + "description": "Name value pair" + }, + "NetworkAccessControlEntry": { + "type": "object", + "properties": { + "action": { "oneOf": [ { - "$ref": "#/definitions/WorkerPool_properties" + "type": "string", + "enum": [ + "Permit", + "Deny" + ] }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] + ], + "description": "Possible values include: 'Permit', 'Deny'" }, - "sku": { + "description": { + "type": "string" + }, + "order": { "oneOf": [ { - "$ref": "#/definitions/SkuDescription" + "type": "integer" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } ] + }, + "remoteSubnet": { + "type": "string" } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/hostingEnvironments/workerPools" + } }, - "Microsoft.Web_sites_deployments_childResource": { + "RampUpRule": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "deployments" - ] - }, - "apiVersion": { + "actionHostName": { "type": "string", - "enum": [ - "2015-08-01" - ] + "description": "Hostname of a slot to which the traffic will be redirected if decided to. E.g. mysite-stage.azurewebsites.net" }, - "properties": { + "reroutePercentage": { "oneOf": [ { - "$ref": "#/definitions/Deployment_properties" + "type": "number" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/deployments" - }, - "Microsoft.Web_sites_hostNameBindings_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "hostNameBindings" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + ], + "description": "Percentage of the traffic which will be redirected to {Microsoft.Web.Hosting.Administration.RampUpRule.ActionHostName}" }, - "properties": { + "changeStep": { "oneOf": [ { - "$ref": "#/definitions/HostNameBinding_properties" + "type": "number" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/hostNameBindings" - }, - "Microsoft.Web_sites_hybridconnection_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "hybridconnection" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + ], + "description": "[Optional] In auto ramp up scenario this is the step to to add/remove from {Microsoft.Web.Hosting.Administration.RampUpRule.ReroutePercentage} until it reaches \r\n {Microsoft.Web.Hosting.Administration.RampUpRule.MinReroutePercentage} or {Microsoft.Web.Hosting.Administration.RampUpRule.MaxReroutePercentage}. Site metrics are checked every N minutes specificed in {Microsoft.Web.Hosting.Administration.RampUpRule.ChangeIntervalInMinutes}.\r\n Custom decision algorithm can be provided in TiPCallback site extension which Url can be specified in {Microsoft.Web.Hosting.Administration.RampUpRule.ChangeDecisionCallbackUrl}" }, - "properties": { + "changeIntervalInMinutes": { "oneOf": [ { - "$ref": "#/definitions/RelayServiceConnectionEntity_properties" + "type": "integer" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/hybridconnection" - }, - "Microsoft.Web_sites_slots_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "slots" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + ], + "description": "[Optional] Specifies interval in mimuntes to reevaluate ReroutePercentage" }, - "properties": { + "minReroutePercentage": { "oneOf": [ { - "$ref": "#/definitions/Site_properties" + "type": "number" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "resources": { - "type": "array", - "items": { + ], + "description": "[Optional] Specifies lower boundary above which ReroutePercentage will stay." + }, + "maxReroutePercentage": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_slots_hybridconnection_childResource" - }, - { - "$ref": "#/definitions/Microsoft.Web_sites_slots_hostNameBindings_childResource" + "type": "number" }, { - "$ref": "#/definitions/Microsoft.Web_sites_slots_deployments_childResource" + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] + ], + "description": "[Optional] Specifies upper boundary below which ReroutePercentage will stay." + }, + "changeDecisionCallbackUrl": { + "type": "string", + "description": "Custom decision algorithm can be provided in TiPCallback site extension which Url can be specified. See TiPCallback site extension for the scaffold and contracts.\r\n https://www.siteextensions.net/packages/TiPCallback/" + }, + "name": { + "type": "string", + "description": "Name of the routing rule. The recommended name would be to point to the slot which will receive the traffic in the experiment." } }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots" + "description": "Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance" }, - "Microsoft.Web_sites_slots_deployments_childResource": { + "RelayServiceConnectionEntity_properties": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "deployments" - ] + "entityName": { + "type": "string" }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + "entityConnectionString": { + "type": "string" }, - "properties": { + "resourceType": { + "type": "string" + }, + "resourceConnectionString": { + "type": "string" + }, + "hostname": { + "type": "string" + }, + "port": { "oneOf": [ { - "$ref": "#/definitions/Deployment_properties" + "type": "integer" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } ] + }, + "biztalkUri": { + "type": "string" } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots/deployments" + } }, - "Microsoft.Web_sites_slots_hostNameBindings_childResource": { + "RequestsBasedTrigger": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "hostNameBindings" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] - }, - "properties": { + "count": { "oneOf": [ { - "$ref": "#/definitions/HostNameBinding_properties" + "type": "integer" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] + ], + "description": "Count" + }, + "timeInterval": { + "type": "string", + "description": "TimeInterval" } }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots/hostNameBindings" + "description": "RequestsBasedTrigger" }, - "Microsoft.Web_sites_slots_hybridconnection_childResource": { + "ServerFarmWithRichSku_properties": { "type": "object", "properties": { - "type": { + "name": { "type": "string", - "enum": [ - "hybridconnection" - ] + "description": "Name for the App Service Plan" }, - "apiVersion": { + "workerTierName": { "type": "string", - "enum": [ - "2015-08-01" - ] + "description": "Target worker tier assigned to the App Service Plan" }, - "properties": { + "adminSiteName": { + "type": "string", + "description": "App Service Plan administration site" + }, + "hostingEnvironmentProfile": { "oneOf": [ { - "$ref": "#/definitions/RelayServiceConnectionEntity_properties" + "$ref": "#/definitions/HostingEnvironmentProfile" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots/hybridconnection" - }, - "Microsoft.Web_sites_slots_virtualNetworkConnections_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "virtualNetworkConnections" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + ], + "description": "Specification for the hosting environment (App Service Environment) to use for the App Service Plan" }, - "properties": { + "maximumNumberOfWorkers": { "oneOf": [ { - "$ref": "#/definitions/VnetInfo_properties" + "type": "integer" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "resources": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/Microsoft.Web_sites_slots_virtualNetworkConnections_gateways_childResource" - } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots/virtualNetworkConnections" - }, - "Microsoft.Web_sites_slots_virtualNetworkConnections_gateways_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "gateways" - ] - }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + ], + "description": "Maximum number of instances that can be assigned to this App Service Plan" }, - "properties": { + "perSiteScaling": { "oneOf": [ { - "$ref": "#/definitions/VnetGateway_properties" + "type": "boolean" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] + ], + "description": "If True apps assigned to this App Service Plan can be scaled independently\r\n If False apps assigned to this App Service Plan will scale to all instances of the plan" } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/slots/virtualNetworkConnections/gateways" + } }, - "Microsoft.Web_sites_virtualNetworkConnections_childResource": { + "Site_properties": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "virtualNetworkConnections" - ] - }, - "apiVersion": { + "name": { "type": "string", - "enum": [ - "2015-08-01" - ] + "description": "Name of web app" }, - "properties": { + "enabled": { "oneOf": [ { - "$ref": "#/definitions/VnetInfo_properties" + "type": "boolean" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "resources": { - "type": "array", - "items": { + ], + "description": "True if the site is enabled; otherwise, false. Setting this value to false disables the site (takes the site off line)." + }, + "hostNameSslStates": { "oneOf": [ { - "$ref": "#/definitions/Microsoft.Web_sites_virtualNetworkConnections_gateways_childResource" + "type": "array", + "items": { + "$ref": "#/definitions/HostNameSslState" + } + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/virtualNetworkConnections" - }, - "Microsoft.Web_sites_virtualNetworkConnections_gateways_childResource": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "gateways" - ] + ], + "description": "Hostname SSL states are used to manage the SSL bindings for site's hostnames." }, - "apiVersion": { - "type": "string", - "enum": [ - "2015-08-01" - ] + "serverFarmId": { + "type": "string" }, - "properties": { + "siteConfig": { "oneOf": [ { - "$ref": "#/definitions/VnetGateway_properties" + "$ref": "#/definitions/SiteConfig" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] - } - }, - "required": [ - "type", - "apiVersion", - "properties" - ], - "description": "Microsoft.Web/sites/virtualNetworkConnections/gateways" - }, - "NameValuePair": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Pair name" + ], + "description": "Configuration of web app" }, - "value": { - "type": "string", - "description": "Pair value" - } - }, - "description": "Name value pair" - }, - "NetworkAccessControlEntry": { - "type": "object", - "properties": { - "action": { + "scmSiteAlsoStopped": { "oneOf": [ { - "type": "string", - "enum": [ - "Permit", - "Deny" - ] + "type": "boolean" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } ], - "description": "Possible values include: 'Permit', 'Deny'" - }, - "description": { - "type": "string" + "description": "If set indicates whether to stop SCM (KUDU) site when the web app is stopped. Default is false." }, - "order": { + "hostingEnvironmentProfile": { "oneOf": [ { - "type": "integer" + "$ref": "#/definitions/HostingEnvironmentProfile" }, { "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" } - ] + ], + "description": "Specification for the hosting environment (App Service Environment) to use for the web app" }, - "remoteSubnet": { - "type": "string" - } - } - }, - "RampUpRule": { - "type": "object", - "properties": { - "actionHostName": { - "type": "string", - "description": "Hostname of a slot to which the traffic will be redirected if decided to. E.g. mysite-stage.azurewebsites.net" - }, - "reroutePercentage": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Percentage of the traffic which will be redirected to {Microsoft.Web.Hosting.Administration.RampUpRule.ActionHostName}" - }, - "changeStep": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "[Optional] In auto ramp up scenario this is the step to to add/remove from {Microsoft.Web.Hosting.Administration.RampUpRule.ReroutePercentage} until it reaches \r\n {Microsoft.Web.Hosting.Administration.RampUpRule.MinReroutePercentage} or {Microsoft.Web.Hosting.Administration.RampUpRule.MaxReroutePercentage}. Site metrics are checked every N minutes specificed in {Microsoft.Web.Hosting.Administration.RampUpRule.ChangeIntervalInMinutes}.\r\n Custom decision algorithm can be provided in TiPCallback site extension which Url can be specified in {Microsoft.Web.Hosting.Administration.RampUpRule.ChangeDecisionCallbackUrl}" - }, - "changeIntervalInMinutes": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "[Optional] Specifies interval in mimuntes to reevaluate ReroutePercentage" - }, - "minReroutePercentage": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "[Optional] Specifies lower boundary above which ReroutePercentage will stay." - }, - "maxReroutePercentage": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "[Optional] Specifies upper boundary below which ReroutePercentage will stay." - }, - "changeDecisionCallbackUrl": { - "type": "string", - "description": "Custom decision algorithm can be provided in TiPCallback site extension which Url can be specified. See TiPCallback site extension for the scaffold and contracts.\r\n https://www.siteextensions.net/packages/TiPCallback/" - }, - "name": { - "type": "string", - "description": "Name of the routing rule. The recommended name would be to point to the slot which will receive the traffic in the experiment." - } - }, - "description": "Routing rules for ramp up testing. This rule allows to redirect static traffic % to a slot or to gradually change routing % based on performance" - }, - "RelayServiceConnectionEntity_properties": { - "type": "object", - "properties": { - "entityName": { - "type": "string" - }, - "entityConnectionString": { - "type": "string" - }, - "resourceType": { - "type": "string" - }, - "resourceConnectionString": { - "type": "string" - }, - "hostname": { - "type": "string" - }, - "port": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ] - }, - "biztalkUri": { - "type": "string" - } - } - }, - "RequestsBasedTrigger": { - "type": "object", - "properties": { - "count": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Count" - }, - "timeInterval": { - "type": "string", - "description": "TimeInterval" - } - }, - "description": "RequestsBasedTrigger" - }, - "ServerFarmWithRichSku_properties": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name for the App Service Plan" - }, - "workerTierName": { - "type": "string", - "description": "Target worker tier assigned to the App Service Plan" - }, - "adminSiteName": { - "type": "string", - "description": "App Service Plan administration site" - }, - "hostingEnvironmentProfile": { - "oneOf": [ - { - "$ref": "#/definitions/HostingEnvironmentProfile" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Specification for the hosting environment (App Service Environment) to use for the App Service Plan" - }, - "maximumNumberOfWorkers": { - "oneOf": [ - { - "type": "integer" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Maximum number of instances that can be assigned to this App Service Plan" - }, - "perSiteScaling": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "If True apps assigned to this App Service Plan can be scaled independently\r\n If False apps assigned to this App Service Plan will scale to all instances of the plan" - } - } - }, - "Site_properties": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of web app" - }, - "enabled": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "True if the site is enabled; otherwise, false. Setting this value to false disables the site (takes the site off line)." - }, - "hostNameSslStates": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/definitions/HostNameSslState" - } - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Hostname SSL states are used to manage the SSL bindings for site's hostnames." - }, - "serverFarmId": { - "type": "string" - }, - "siteConfig": { - "oneOf": [ - { - "$ref": "#/definitions/SiteConfig" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Configuration of web app" - }, - "scmSiteAlsoStopped": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "If set indicates whether to stop SCM (KUDU) site when the web app is stopped. Default is false." - }, - "hostingEnvironmentProfile": { - "oneOf": [ - { - "$ref": "#/definitions/HostingEnvironmentProfile" - }, - { - "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" - } - ], - "description": "Specification for the hosting environment (App Service Environment) to use for the web app" - }, - "microService": { + "microService": { "type": "string" }, "gatewaySiteName": { @@ -3011,6 +2612,405 @@ }, "description": "Represents metric limits set on a web app." }, + "sites_deployments_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "deployments" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/Deployment_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/deployments" + }, + "sites_hostNameBindings_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "hostNameBindings" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/HostNameBinding_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/hostNameBindings" + }, + "sites_hybridconnection_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "hybridconnection" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/RelayServiceConnectionEntity_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/hybridconnection" + }, + "sites_slots_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "slots" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/Site_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "resources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/sites_slots_hybridconnection_childResource" + }, + { + "$ref": "#/definitions/sites_slots_hostNameBindings_childResource" + }, + { + "$ref": "#/definitions/sites_slots_deployments_childResource" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots" + }, + "sites_slots_deployments_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "deployments" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/Deployment_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots/deployments" + }, + "sites_slots_hostNameBindings_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "hostNameBindings" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/HostNameBinding_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots/hostNameBindings" + }, + "sites_slots_hybridconnection_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "hybridconnection" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/RelayServiceConnectionEntity_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots/hybridconnection" + }, + "sites_slots_virtualNetworkConnections_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "virtualNetworkConnections" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/VnetInfo_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "resources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/sites_slots_virtualNetworkConnections_gateways_childResource" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots/virtualNetworkConnections" + }, + "sites_slots_virtualNetworkConnections_gateways_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "gateways" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/VnetGateway_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/slots/virtualNetworkConnections/gateways" + }, + "sites_virtualNetworkConnections_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "virtualNetworkConnections" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/VnetInfo_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "resources": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/definitions/sites_virtualNetworkConnections_gateways_childResource" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/virtualNetworkConnections" + }, + "sites_virtualNetworkConnections_gateways_childResource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "gateways" + ] + }, + "apiVersion": { + "type": "string", + "enum": [ + "2015-08-01" + ] + }, + "properties": { + "oneOf": [ + { + "$ref": "#/definitions/VnetGateway_properties" + }, + { + "$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression" + } + ] + } + }, + "required": [ + "type", + "apiVersion", + "properties" + ], + "description": "Microsoft.Web/sites/virtualNetworkConnections/gateways" + }, "SkuDescription": { "type": "object", "properties": { diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/ResourceSchemaParserTests.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/ResourceSchemaParserTests.cs index 4d85c4f327..4c90684e6a 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/ResourceSchemaParserTests.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema.Tests/ResourceSchemaParserTests.cs @@ -57,7 +57,7 @@ public void ParseWithServiceClientWithCreateResourceMethod() Assert.Equal("Mock.Provider", schema.Title); Assert.Equal("Mock Provider Resource Types", schema.Description); Assert.Equal(1, schema.ResourceDefinitions.Count); - Assert.Equal("Mock.Provider_mockResourceNames", schema.ResourceDefinitions.Keys.Single()); + Assert.Equal("mockResourceNames", schema.ResourceDefinitions.Keys.Single()); Assert.Equal( new JsonSchema() { @@ -70,7 +70,7 @@ public void ParseWithServiceClientWithCreateResourceMethod() } .AddEnum("Mock.Provider/mockResourceNames"), true), - schema.ResourceDefinitions["Mock.Provider_mockResourceNames"]); + schema.ResourceDefinitions["mockResourceNames"]); Assert.NotNull(schema.Definitions); Assert.Equal(0, schema.Definitions.Count); } diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/Properties/AssemblyInfo.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/Properties/AssemblyInfo.cs index da321c159d..37bc04b373 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/Properties/AssemblyInfo.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/Properties/AssemblyInfo.cs @@ -1,6 +1,5 @@ using System; using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -35,4 +34,3 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: CLSCompliant(true)] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: InternalsVisibleTo("AutoRest.Generator.AzureResourceSchema.Tests")] diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs index 28abf47ca8..1e98e8f950 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaParser.cs @@ -122,7 +122,7 @@ public static IDictionary Parse(ServiceClient serviceClie } } - string resourcePropertyName = resourceType.Replace('/', '_'); + string resourcePropertyName = resourceType.Substring(resourceProvider.Length + 1).Replace('/', '_'); Debug.Assert(!resourceSchema.ResourceDefinitions.ContainsKey(resourcePropertyName)); resourceSchema.AddResourceDefinition(resourcePropertyName, resourceDefinition); } @@ -153,7 +153,7 @@ public static IDictionary Parse(ServiceClient serviceClie JsonSchema childResourceDefinition = resourceDefinition.Clone(); childResourceDefinition.ResourceType = childResourceType; - string childResourceDefinitionPropertyName = resourcePropertyName + "_childResource"; + string childResourceDefinitionPropertyName = string.Join("_", resourcePropertyName, "childResource"); resourceSchema.AddDefinition(childResourceDefinitionPropertyName, childResourceDefinition); parentResourceDefinition.AddResource(new JsonSchema() @@ -364,7 +364,7 @@ private static JsonSchema ParsePrimaryType(PrimaryType primaryType) /// /// /// - internal static bool IsCreateResourceMethod(Method method) + public static bool IsCreateResourceMethod(Method method) { if (method == null) { @@ -396,23 +396,23 @@ internal static bool IsCreateResourceMethod(Method method) /// URL path that comes after the resourceProvider section. /// /// - /// + /// /// - internal static string GetResourceType(string resourceProvider, string methodUrlPathAfterProvider) + public static string GetResourceType(string resourceProvider, string methodPathAfterProvider) { if (string.IsNullOrWhiteSpace(resourceProvider)) { throw new ArgumentException("resourceProvider cannot be null or whitespace", "resourceProvider"); } - if (string.IsNullOrWhiteSpace(methodUrlPathAfterProvider)) + if (string.IsNullOrWhiteSpace(methodPathAfterProvider)) { - throw new ArgumentException("methodUrlPathAfterProvider cannot be null or whitespace", "methodUrlPathAfterProvider"); + throw new ArgumentException("methodPathAfterProvider cannot be null or whitespace", "methodPathAfterProvider"); } List resourceTypeParts = new List(); resourceTypeParts.Add(resourceProvider); - string[] pathSegments = methodUrlPathAfterProvider.Split(new char[] { '/' }); + string[] pathSegments = methodPathAfterProvider.Split(new char[] { '/' }); for (int i = 0; i < pathSegments.Length; i += 2) { resourceTypeParts.Add(pathSegments[i]); diff --git a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs index 0a36309d0a..98dcd57d27 100644 --- a/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs +++ b/AutoRest/Generators/AzureResourceSchema/AzureResourceSchema/ResourceSchemaWriter.cs @@ -33,7 +33,7 @@ public static void Write(TextWriter writer, ResourceSchema resourceSchema) } } - internal static void Write(JsonTextWriter writer, ResourceSchema resourceSchema) + public static void Write(JsonWriter writer, ResourceSchema resourceSchema) { if (writer == null) { @@ -58,7 +58,7 @@ internal static void Write(JsonTextWriter writer, ResourceSchema resourceSchema) writer.WriteEndObject(); } - private static void WriteDefinitionMap(JsonTextWriter writer, string definitionMapName, IDictionary definitionMap, bool sortDefinitions = false, bool addExpressionReferences = false) + private static void WriteDefinitionMap(JsonWriter writer, string definitionMapName, IDictionary definitionMap, bool sortDefinitions = false, bool addExpressionReferences = false) { if (definitionMap != null && definitionMap.Count > 0) { @@ -120,8 +120,13 @@ private static void WriteDefinitionMap(JsonTextWriter writer, string definitionM } } - internal static void WriteDefinition(JsonTextWriter writer, string resourceName, JsonSchema definition) + public static void WriteDefinition(JsonWriter writer, string resourceName, JsonSchema definition) { + if (writer == null) + { + throw new ArgumentNullException("writer"); + } + if (definition != null) { writer.WritePropertyName(resourceName); @@ -129,7 +134,7 @@ internal static void WriteDefinition(JsonTextWriter writer, string resourceName, } } - private static void WriteDefinition(JsonTextWriter writer, JsonSchema definition) + private static void WriteDefinition(JsonWriter writer, JsonSchema definition) { if (definition == null) { @@ -151,7 +156,7 @@ private static void WriteDefinition(JsonTextWriter writer, JsonSchema definition writer.WriteEndObject(); } - private static void WriteStringArray(JsonTextWriter writer, string arrayName, IEnumerable arrayValues) + private static void WriteStringArray(JsonWriter writer, string arrayName, IEnumerable arrayValues) { if (arrayValues != null && arrayValues.Count() > 0) { @@ -165,7 +170,7 @@ private static void WriteStringArray(JsonTextWriter writer, string arrayName, IE } } - private static void WriteDefinitionArray(JsonTextWriter writer, string arrayName, IEnumerable arrayDefinitions) + private static void WriteDefinitionArray(JsonWriter writer, string arrayName, IEnumerable arrayDefinitions) { if (arrayDefinitions != null && arrayDefinitions.Count() > 0) { @@ -191,7 +196,7 @@ private static void WriteDefinitionArray(JsonTextWriter writer, string arrayName } } - internal static void WriteProperty(JsonTextWriter writer, string propertyName, string propertyValue) + public static void WriteProperty(JsonWriter writer, string propertyName, string propertyValue) { if (writer == null) { diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure.Tests/LongRunningOperationsTest.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure.Tests/LongRunningOperationsTest.cs index 1d0bb2069f..014446a6b9 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure.Tests/LongRunningOperationsTest.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure.Tests/LongRunningOperationsTest.cs @@ -774,6 +774,12 @@ private IEnumerable MockPutOperaionWithoutProvisioningState }; yield return response1; + + var response2 = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent("{ \"properties\": { }, \"id\": \"100\", \"name\": \"foo\" }") + }; + yield return response2; } private IEnumerable MockPutOperaionWitNonResource() diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/AzureClientExtensions.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/AzureClientExtensions.cs index 422f074bd3..180b9e8add 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/AzureClientExtensions.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/AzureClientExtensions.cs @@ -19,7 +19,7 @@ namespace Microsoft.Rest.Azure public static class AzureClientExtensions { /// - /// Gets operation result for PUT and PATCH operations. + /// Gets operation result for long running operations. /// /// Type of the resource body /// IAzureClient @@ -27,11 +27,11 @@ public static class AzureClientExtensions /// Headers that will be added to request /// Cancellation token /// Response with created resource - public static async Task> GetPutOrPatchOperationResultAsync( + public static async Task> GetLongRunningOperationResultAsync( this IAzureClient client, AzureOperationResponse response, Dictionary> customHeaders, - CancellationToken cancellationToken) where TBody : class + CancellationToken cancellationToken) where TBody : class { if (response == null) { @@ -44,7 +44,7 @@ public static async Task> GetPutOrPatchOperationRe RequestId = response.RequestId, Response = response.Response }; - var longRunningResponse = await GetPutOrPatchOperationResultAsync(client, headerlessResponse, customHeaders, cancellationToken); + var longRunningResponse = await GetLongRunningOperationResultAsync(client, headerlessResponse, customHeaders, cancellationToken); return new AzureOperationResponse { Body = longRunningResponse.Body, @@ -55,7 +55,7 @@ public static async Task> GetPutOrPatchOperationRe } /// - /// Gets operation result for PUT and PATCH operations. + /// Gets operation result for long running operations. /// /// Type of the resource body /// Type of the resource header @@ -64,7 +64,7 @@ public static async Task> GetPutOrPatchOperationRe /// Headers that will be added to request /// Cancellation token /// Response with created resource - public static async Task> GetPutOrPatchOperationResultAsync( + public static async Task> GetLongRunningOperationResultAsync( this IAzureClient client, AzureOperationResponse response, Dictionary> customHeaders, @@ -74,11 +74,29 @@ public static async Task> GetPutOrPatchOp { throw new ValidationException(ValidationRules.CannotBeNull, "response"); } - if (response.Response.StatusCode != HttpStatusCode.OK && - response.Response.StatusCode != HttpStatusCode.Accepted && - response.Response.StatusCode != HttpStatusCode.Created) + + if (response.Response == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "response.Response"); + } + + if (response.Request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "response.Request"); + } + + if (response.Request.Method == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "response.Request.Method"); + } + + var initialRequestMethod = response.Request.Method; + if (CheckResponseStatusCodeFailed(response)) { - throw new CloudException(string.Format(Resources.UnexpectedPollingStatus, response.Response.StatusCode)); + throw new CloudException(string.Format( + Resources.UnexpectedPollingStatus, + response.Response.StatusCode, + initialRequestMethod)); } var pollingState = new PollingState(response, client.LongRunningOperationRetryTimeout); @@ -92,24 +110,31 @@ public static async Task> GetPutOrPatchOp if (!string.IsNullOrEmpty(pollingState.AzureAsyncOperationHeaderLink)) { - await UpdateStateFromAzureAsyncOperationHeader(client, pollingState, customHeaders, false, cancellationToken); + await UpdateStateFromAzureAsyncOperationHeader(client, pollingState, customHeaders, cancellationToken); } else if (!string.IsNullOrEmpty(pollingState.LocationHeaderLink)) { - await UpdateStateFromLocationHeaderOnPut(client, pollingState, customHeaders, cancellationToken); + await UpdateStateFromLocationHeader(client, pollingState, customHeaders, cancellationToken, initialRequestMethod); } - else + else if (initialRequestMethod == HttpMethod.Put) { - await UpdateStateFromGetResourceOperation(client, pollingState, getOperationUrl, + await UpdateStateFromGetResourceOperation(client, pollingState, getOperationUrl, customHeaders, cancellationToken); } + else + { + throw new CloudException("Location header is missing from long running operation."); + } } - if (AzureAsyncOperation.SuccessStatus.Equals(pollingState.Status, StringComparison.OrdinalIgnoreCase) && - pollingState.Resource == null) + if (AzureAsyncOperation.SuccessStatus.Equals(pollingState.Status, StringComparison.OrdinalIgnoreCase)) { - await UpdateStateFromGetResourceOperation(client, pollingState, getOperationUrl, - customHeaders, cancellationToken); + if ((!string.IsNullOrEmpty(pollingState.AzureAsyncOperationHeaderLink) || pollingState.Resource == null) && + (initialRequestMethod == HttpMethod.Put || initialRequestMethod == new HttpMethod("PATCH"))) + { + await UpdateStateFromGetResourceOperation(client, pollingState, getOperationUrl, customHeaders, + cancellationToken); + } } // Check if operation failed @@ -123,14 +148,14 @@ await UpdateStateFromGetResourceOperation(client, pollingState, getOperationUrl, } /// - /// Gets operation result for PUT and PATCH operations. + /// Gets operation result for long running operations. /// /// IAzureClient /// Response from the begin operation /// Headers that will be added to request /// Cancellation token /// Operation response - public static async Task GetPutOrPatchOperationResultAsync( + public static async Task GetLongRunningOperationResultAsync( this IAzureClient client, AzureOperationResponse response, Dictionary> customHeaders, @@ -143,7 +168,7 @@ public static async Task GetPutOrPatchOperationResultAsy RequestId = response.RequestId }; - var azureOperationResponse = await client.GetPutOrPatchOperationResultAsync( + var azureOperationResponse = await client.GetLongRunningOperationResultAsync( newResponse, customHeaders, cancellationToken); return new AzureOperationResponse @@ -155,35 +180,35 @@ public static async Task GetPutOrPatchOperationResultAsy } /// - /// Gets operation result for DELETE and POST operations. + /// Gets operation result for long running operations. /// - /// Type of the resource body + /// Type of the resource headers /// IAzureClient /// Response from the begin operation /// Headers that will be added to request /// Cancellation token /// Operation response - public static async Task> GetPostOrDeleteOperationResultAsync( + public static async Task> GetLongRunningOperationResultAsync( this IAzureClient client, - AzureOperationResponse response, + AzureOperationHeaderResponse response, Dictionary> customHeaders, - CancellationToken cancellationToken) where TBody : class + CancellationToken cancellationToken) where THeader : class { if (response == null) { throw new ArgumentNullException("response"); } - var headerlessResponse = new AzureOperationResponse + var headerlessResponse = new AzureOperationResponse { - Body = response.Body, + Headers = response.Headers, Request = response.Request, RequestId = response.RequestId, Response = response.Response }; - var longRunningResponse = await GetPostOrDeleteOperationResultAsync(client, headerlessResponse, customHeaders, cancellationToken); - return new AzureOperationResponse + var longRunningResponse = await GetLongRunningOperationResultAsync(client, headerlessResponse, customHeaders, cancellationToken); + return new AzureOperationHeaderResponse { - Body = longRunningResponse.Body, + Headers = longRunningResponse.Headers, Request = longRunningResponse.Request, RequestId = longRunningResponse.RequestId, Response = longRunningResponse.Response @@ -191,7 +216,81 @@ public static async Task> GetPostOrDeleteOperation } /// - /// Gets operation result for DELETE and POST operations. + /// Gets operation result for PUT and PATCH operations. (Deprecated, please use GetLongRunningOperationResultAsync) + /// + /// Type of the resource body + /// IAzureClient + /// Response from the begin operation + /// Headers that will be added to request + /// Cancellation token + /// Response with created resource + public static async Task> GetPutOrPatchOperationResultAsync( + this IAzureClient client, + AzureOperationResponse response, + Dictionary> customHeaders, + CancellationToken cancellationToken) where TBody : class + { + return await client.GetLongRunningOperationResultAsync( + response, customHeaders, cancellationToken); + } + + /// + /// Gets operation result for PUT and PATCH operations. (Deprecated, please use GetLongRunningOperationResultAsync) + /// + /// Type of the resource body + /// Type of the resource header + /// IAzureClient + /// Response from the begin operation + /// Headers that will be added to request + /// Cancellation token + /// Response with created resource + public static async Task> GetPutOrPatchOperationResultAsync( + this IAzureClient client, + AzureOperationResponse response, + Dictionary> customHeaders, + CancellationToken cancellationToken) where TBody : class where THeader : class + { + return await GetLongRunningOperationResultAsync(client, response, customHeaders, cancellationToken); + } + + /// + /// Gets operation result for PUT and PATCH operations. (Deprecated, please use GetLongRunningOperationResultAsync) + /// + /// IAzureClient + /// Response from the begin operation + /// Headers that will be added to request + /// Cancellation token + /// Operation response + public static async Task GetPutOrPatchOperationResultAsync( + this IAzureClient client, + AzureOperationResponse response, + Dictionary> customHeaders, + CancellationToken cancellationToken) + { + return await client.GetLongRunningOperationResultAsync( + response, customHeaders, cancellationToken); + } + + /// + /// Gets operation result for DELETE and POST operations. (Deprecated, please use GetLongRunningOperationResultAsync) + /// + /// Type of the resource body + /// IAzureClient + /// Response from the begin operation + /// Headers that will be added to request + /// Cancellation token + /// Operation response + public static async Task> GetPostOrDeleteOperationResultAsync( + this IAzureClient client, + AzureOperationResponse response, + Dictionary> customHeaders, + CancellationToken cancellationToken) where TBody : class + { + return await GetLongRunningOperationResultAsync(client, response, customHeaders, cancellationToken); + } + + /// + /// Gets operation result for DELETE and POST operations. (Deprecated, please use GetLongRunningOperationResultAsync) /// /// Type of the resource headers /// IAzureClient @@ -205,29 +304,11 @@ public static async Task> GetPostOrDeleteO Dictionary> customHeaders, CancellationToken cancellationToken) where THeader : class { - if (response == null) - { - throw new ArgumentNullException("response"); - } - var headerlessResponse = new AzureOperationResponse - { - Headers = response.Headers, - Request = response.Request, - RequestId = response.RequestId, - Response = response.Response - }; - var longRunningResponse = await GetPostOrDeleteOperationResultAsync(client, headerlessResponse, customHeaders, cancellationToken); - return new AzureOperationHeaderResponse - { - Headers = longRunningResponse.Headers, - Request = longRunningResponse.Request, - RequestId = longRunningResponse.RequestId, - Response = longRunningResponse.Response - }; + return await GetLongRunningOperationResultAsync(client, response, customHeaders, cancellationToken); } /// - /// Gets operation result for DELETE and POST operations. + /// Gets operation result for DELETE and POST operations. (Deprecated, please use GetLongRunningOperationResultAsync) /// /// Type of the resource body /// Type of the resource header @@ -242,57 +323,11 @@ public static async Task> GetPostOrDelete Dictionary> customHeaders, CancellationToken cancellationToken) where TBody : class where THeader : class { - if (response == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "response"); - } - - if (response.Response == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "response.Response"); - } - - if (response.Response.StatusCode != HttpStatusCode.OK && - response.Response.StatusCode != HttpStatusCode.Accepted && - response.Response.StatusCode != HttpStatusCode.NoContent) - { - throw new CloudException(string.Format(Resources.UnexpectedPollingStatus, response.Response.StatusCode)); - } - - var pollingState = new PollingState(response, client.LongRunningOperationRetryTimeout); - - // Check provisioning state - while (!AzureAsyncOperation.TerminalStatuses.Any(s => s.Equals(pollingState.Status, - StringComparison.OrdinalIgnoreCase))) - { - await Task.Delay(pollingState.DelayInMilliseconds, cancellationToken).ConfigureAwait(false); - - if (!string.IsNullOrEmpty(pollingState.AzureAsyncOperationHeaderLink)) - { - await UpdateStateFromAzureAsyncOperationHeader(client, pollingState, customHeaders,true, cancellationToken); - } - else if (!string.IsNullOrEmpty(pollingState.LocationHeaderLink)) - { - await UpdateStateFromLocationHeaderOnPostOrDelete(client, pollingState, customHeaders, cancellationToken); - } - else - { - throw new CloudException(Resources.NoHeader); - } - } - - // Check if operation failed - if (AzureAsyncOperation.FailedStatuses.Any( - s => s.Equals(pollingState.Status, StringComparison.OrdinalIgnoreCase))) - { - throw pollingState.CloudException; - } - - return pollingState.AzureOperationResponse; + return await GetLongRunningOperationResultAsync(client, response, customHeaders, cancellationToken); } /// - /// Gets operation result for DELETE and POST operations. + /// Gets operation result for DELETE and POST operations. (Deprecated, please use GetLongRunningOperationResultAsync) /// /// IAzureClient /// Response from the begin operation @@ -305,22 +340,21 @@ public static async Task GetPostOrDeleteOperationResultA Dictionary> customHeaders, CancellationToken cancellationToken) { - var newResponse = new AzureOperationResponse - { - Request = response.Request, - Response = response.Response, - RequestId = response.RequestId - }; - - var azureOperationResponse = await client.GetPostOrDeleteOperationResultAsync( - newResponse, customHeaders, cancellationToken); + return await client.GetLongRunningOperationResultAsync(response, customHeaders, cancellationToken); + } - return new AzureOperationResponse + private static bool CheckResponseStatusCodeFailed( + AzureOperationResponse initialResponse) + { + var statusCode = initialResponse.Response.StatusCode; + var method = initialResponse.Request.Method; + if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Accepted || + (statusCode == HttpStatusCode.Created && method == HttpMethod.Put) || + (statusCode == HttpStatusCode.NoContent && (method == HttpMethod.Delete || method == HttpMethod.Post))) { - Request = azureOperationResponse.Request, - Response = azureOperationResponse.Response, - RequestId = azureOperationResponse.RequestId - }; + return false; + } + return true; } /// @@ -375,7 +409,7 @@ private static async Task UpdateStateFromGetResourceOperation( } /// - /// Updates PollingState from Location header on Put operations. + /// Updates PollingState from Location header. /// /// Type of the resource body. /// Type of the resource header. @@ -383,12 +417,14 @@ private static async Task UpdateStateFromGetResourceOperation( /// Current polling state. /// Headers that will be added to request /// Cancellation token + /// Http method of the initial long running operation request /// Task. - private static async Task UpdateStateFromLocationHeaderOnPut( + private static async Task UpdateStateFromLocationHeader( IAzureClient client, PollingState pollingState, Dictionary> customHeaders, - CancellationToken cancellationToken) where TBody : class where THeader : class + CancellationToken cancellationToken, + HttpMethod method) where TBody : class where THeader : class { AzureOperationResponse responseWithResource = await client.GetRawAsync( pollingState.LocationHeaderLink, @@ -404,73 +440,24 @@ private static async Task UpdateStateFromLocationHeaderOnPut( pollingState.Status = AzureAsyncOperation.InProgressStatus; } else if (statusCode == HttpStatusCode.OK || - statusCode == HttpStatusCode.Created) + (statusCode == HttpStatusCode.Created && method == HttpMethod.Put) || + (statusCode == HttpStatusCode.NoContent && (method == HttpMethod.Delete || method == HttpMethod.Post))) { - if (responseWithResource.Body == null) - { - throw new CloudException(Resources.NoBody); - } - - // In 202 pattern on PUT ProvisioningState may not be present in - // the response. In that case the assumption is the status is Succeeded. - var resource = responseWithResource.Body; - if (resource["properties"] != null && resource["properties"]["provisioningState"] != null) - { - pollingState.Status = (string)resource["properties"]["provisioningState"]; - } - else - { - pollingState.Status = AzureAsyncOperation.SuccessStatus; - } + pollingState.Status = AzureAsyncOperation.SuccessStatus; pollingState.Error = new CloudError() { Code = pollingState.Status, Message = string.Format(Resources.LongRunningOperationFailed, pollingState.Status) }; - pollingState.Resource = responseWithResource.Body.ToObject(JsonSerializer + pollingState.Resource = responseWithResource.Body == null ? null : responseWithResource.Body.ToObject(JsonSerializer .Create(client.DeserializationSettings)); pollingState.ResourceHeaders = responseWithResource.Headers.ToObject(JsonSerializer .Create(client.DeserializationSettings)); } - } - - /// - /// Updates PollingState from Location header on Post or Delete operations. - /// - /// Type of the resource body. - /// Type of the resource header. - /// IAzureClient - /// Current polling state. - /// Headers that will be added to request - /// Cancellation token - /// Task. - private static async Task UpdateStateFromLocationHeaderOnPostOrDelete( - IAzureClient client, - PollingState pollingState, - Dictionary> customHeaders, - CancellationToken cancellationToken) where TBody : class where THeader : class - { - AzureOperationResponse responseWithResource = await client.GetAsync( - pollingState.LocationHeaderLink, - customHeaders, - cancellationToken).ConfigureAwait(false); - - pollingState.Response = responseWithResource.Response; - pollingState.Request = responseWithResource.Request; - pollingState.ResourceHeaders = responseWithResource.Headers; - - var statusCode = responseWithResource.Response.StatusCode; - if (statusCode == HttpStatusCode.Accepted) - { - pollingState.Status = AzureAsyncOperation.InProgressStatus; - } - else if (statusCode == HttpStatusCode.OK || - statusCode == HttpStatusCode.Created || - statusCode == HttpStatusCode.NoContent) + else { - pollingState.Status = AzureAsyncOperation.SuccessStatus; - pollingState.Resource = responseWithResource.Body; + throw new CloudException("The response from long running operation does not have a valid status code."); } } @@ -482,14 +469,12 @@ private static async Task UpdateStateFromLocationHeaderOnPostOrDeleteIAzureClient /// Current polling state. /// Headers that will be added to request - /// Headers that will be added to request /// Cancellation token /// Task. private static async Task UpdateStateFromAzureAsyncOperationHeader( IAzureClient client, PollingState pollingState, - Dictionary> customHeaders, - bool postOrDelete, + Dictionary> customHeaders, CancellationToken cancellationToken) where TBody : class where THeader : class { AzureOperationResponse asyncOperationResponse = @@ -508,21 +493,18 @@ await client.GetAsync( pollingState.Response = asyncOperationResponse.Response; pollingState.Request = asyncOperationResponse.Request; pollingState.Resource = null; - if (postOrDelete) - { - //Try to de-serialize to the response model. (Not required for "PutOrPatch" - //which has the fallback of invoking generic "resource get".) - string responseContent = await pollingState.Response.Content.ReadAsStringAsync(); - var responseHeaders = pollingState.Response.Headers.ToJson(); - try - { - pollingState.Resource = JObject.Parse(responseContent) - .ToObject(JsonSerializer.Create(client.DeserializationSettings)); - pollingState.ResourceHeaders = - responseHeaders.ToObject(JsonSerializer.Create(client.DeserializationSettings)); - } - catch { }; + //Try to de-serialize to the response model. (Not required for "PutOrPatch" + //which has the fallback of invoking generic "resource get".) + string responseContent = await pollingState.Response.Content.ReadAsStringAsync(); + var responseHeaders = pollingState.Response.Headers.ToJson(); + try + { + pollingState.Resource = JObject.Parse(responseContent) + .ToObject(JsonSerializer.Create(client.DeserializationSettings)); + pollingState.ResourceHeaders = + responseHeaders.ToObject(JsonSerializer.Create(client.DeserializationSettings)); } + catch { }; } /// diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/PollingState.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/PollingState.cs index 26681f0f7e..17c38105b0 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/PollingState.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/PollingState.cs @@ -46,29 +46,39 @@ public PollingState(HttpOperationResponse response, int? retryTi } } - if (resource != null && resource["properties"] != null && - resource["properties"]["provisioningState"] != null) + switch (Response.StatusCode) { - Status = (string)resource["properties"]["provisioningState"]; - } - else - { - switch (Response.StatusCode) - { - case HttpStatusCode.Accepted: - Status = AzureAsyncOperation.InProgressStatus; - break; - - case HttpStatusCode.NoContent: - case HttpStatusCode.Created: - case HttpStatusCode.OK: + case HttpStatusCode.Accepted: + Status = AzureAsyncOperation.InProgressStatus; + break; + case HttpStatusCode.OK: + if (resource != null && resource["properties"] != null && + resource["properties"]["provisioningState"] != null) + { + Status = (string)resource["properties"]["provisioningState"]; + } + else + { Status = AzureAsyncOperation.SuccessStatus; - break; - - default: - Status = AzureAsyncOperation.FailedStatus; - break; - } + } + break; + case HttpStatusCode.Created: + if (resource != null && resource["properties"] != null && + resource["properties"]["provisioningState"] != null) + { + Status = (string) resource["properties"]["provisioningState"]; + } + else + { + Status = AzureAsyncOperation.InProgressStatus; + } + break; + case HttpStatusCode.NoContent: + Status = AzureAsyncOperation.SuccessStatus; + break; + default: + Status = AzureAsyncOperation.FailedStatus; + break; } } diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.Designer.cs b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.Designer.cs index fb148df5bd..04e84d7a82 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.Designer.cs +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.Designer.cs @@ -304,7 +304,7 @@ internal static string TaskMustBeScheduled { } /// - /// Looks up a localized string similar to Unexpected polling status code from long running operation '{0}'.. + /// Looks up a localized string similar to Unexpected polling status code from long running operation '{0}' for method '{1}'.. /// internal static string UnexpectedPollingStatus { get { diff --git a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.resx b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.resx index 496a6c2483..8fb340da09 100644 --- a/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.resx +++ b/ClientRuntimes/CSharp/Microsoft.Rest.ClientRuntime.Azure/Properties/Resources.resx @@ -200,6 +200,6 @@ Parameter name: {0} The specified argument '{0}' must return a scheduled task (also known as "hot" task) when invoked. - Unexpected polling status code from long running operation '{0}'. + Unexpected polling status code from long running operation '{0}' for method '{1}'. \ No newline at end of file diff --git a/ClientRuntimes/Java/azure-android-client-authentication/build.gradle b/ClientRuntimes/Java/azure-android-client-authentication/build.gradle index 0884db281a..82a0cc5107 100644 --- a/ClientRuntimes/Java/azure-android-client-authentication/build.gradle +++ b/ClientRuntimes/Java/azure-android-client-authentication/build.gradle @@ -42,7 +42,7 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.microsoft.aad:adal:1.1.11' - compile 'com.microsoft.rest:client-runtime:1.0.0-beta1' + compile 'com.microsoft.rest:client-runtime:1.0.0-SNAPSHOT' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' deployerJars "org.apache.maven.wagon:wagon-ftp:2.10" @@ -116,4 +116,4 @@ artifacts { archives sourcesJar archives javadocJar archives file: file("${projectDir}/.gitrevision") -} \ No newline at end of file +} diff --git a/ClientRuntimes/Java/azure-client-authentication/build.gradle b/ClientRuntimes/Java/azure-client-authentication/build.gradle index a04020e1fd..eaac35660c 100644 --- a/ClientRuntimes/Java/azure-client-authentication/build.gradle +++ b/ClientRuntimes/Java/azure-client-authentication/build.gradle @@ -20,7 +20,7 @@ checkstyle { dependencies { compile 'com.microsoft.azure:adal4j:1.1.2' - compile 'com.microsoft.rest:client-runtime:1.0.0-beta1' + compile 'com.microsoft.rest:client-runtime:1.0.0-SNAPSHOT' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' deployerJars "org.apache.maven.wagon:wagon-ftp:2.10" @@ -105,4 +105,4 @@ test { reports.html.destination = file("${projectDir}/../../../TestResults/JavaAzureRuntime") } -tasks.compileJava.dependsOn 'clean' \ No newline at end of file +tasks.compileJava.dependsOn 'clean' diff --git a/ClientRuntimes/Java/azure-client-runtime/build.gradle b/ClientRuntimes/Java/azure-client-runtime/build.gradle index 3d90bc184c..dcdaddcea2 100644 --- a/ClientRuntimes/Java/azure-client-runtime/build.gradle +++ b/ClientRuntimes/Java/azure-client-runtime/build.gradle @@ -20,7 +20,7 @@ checkstyle { } dependencies { - compile 'com.microsoft.rest:client-runtime:1.0.0-beta1' + compile 'com.microsoft.rest:client-runtime:1.0.0-SNAPSHOT' testCompile 'junit:junit:4.12' testCompile 'junit:junit-dep:4.11' deployerJars "org.apache.maven.wagon:wagon-ftp:2.10" diff --git a/Documentation/building-code.md b/Documentation/building-code.md index 648364f2ec..c8290cd652 100644 --- a/Documentation/building-code.md +++ b/Documentation/building-code.md @@ -111,6 +111,35 @@ Prior to executing `gulp` to build and then test the code, make sure that the la >gulp test +### Running AutoRest +#### Command Line +After building, the `AutoRest.exe` executable will be output to the `/binaries/net45/` folder. You can run it with the command line options specified in the [Command Line Interface](./cli.md) documentation. + +#### Visual Studio +You can run (and debug) AutoRest by providing the command line parameters in the properties for the AutoRest project. To set these: +1. Open the properties for the AutoRest project. +2. Select the `Debug` tab. +3. Set the `Command line arguments` field in the `Start Options` section. +4. Build the entire solution to make sure the generators and modelers are built. +5. F5 the project. + +#### Troubleshooting + +#####If the Client Runtime project.json shows an error for Newtonsoft.Json, saying that the dependency does not support framework `.NETPortable,Version=4.5,Profile=111` +There is an issue with DNX 1.0.0-rc1 for optional frameworks: [https://github.com/aspnet/dnx/issues/2967](https://github.com/aspnet/dnx/issues/2967). If you have Xamarin files in the directory `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile111\SupportedFrameworks`, then it will not be able to find the Newtonsoft.Json dependency. + +#####If the task runner window in Visual Studio does not show any tasks +Make sure that you have run `npm install` in the root folder. + +#####If `AutoRest.exe` complains about not having generators for each language +Make sure that you have built the entire `AutoRest.sln` solution. + +#####If you see the error `gulp is not recognized as an internal or external command` +`gulp` is located at `C:\Users\[user]\AppData\Roaming\npm\gulp` in Windows after you install it globally. + +#####If you see an error about the target framework not being available +Make sure that the correct DNX version is being used with `dnvm upgrade -r coreclr -arch x64`. + # Releasing AutoRest and ClientRuntimes - [ ] Merge pending PRs into the master branch