update dependencies, refactor stuff, fix polymorhpism (#8)

* modern

* don't use disc val as name

* regen

* update format

* cleanup

* regen

* refactorino

* fix
This commit is contained in:
Johannes Bader 2018-01-16 14:00:50 -08:00 коммит произвёл GitHub
Родитель 1c75d7056a
Коммит fc98ed027c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
44 изменённых файлов: 719 добавлений и 1233 удалений

Просмотреть файл

@ -17,15 +17,15 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
``` yaml
use-extension:
"@microsoft.azure/autorest.modeler": "2.1.22" # keep in sync with package.json's dev dependency in order to have meaningful tests
"@microsoft.azure/autorest.modeler": "2.3.38" # keep in sync with package.json's dev dependency in order to have meaningful tests
pipeline:
azureresourceschema/modeler:
input: swagger-document/identity
azureresourceschema/imodeler1:
input: openapi-document/identity
output-artifact: code-model-v1
scope: azureresourceschema
azureresourceschema/commonmarker:
input: modeler
input: imodeler1
output-artifact: code-model-v1
azureresourceschema/cm/transform:
input: commonmarker

Просмотреть файл

@ -31,8 +31,8 @@
},
"homepage": "https://github.com/Azure/autorest.azureresourceschema/blob/master/README.md",
"devDependencies": {
"@microsoft.azure/autorest.modeler": "2.1.22",
"autorest": "^2.0.0",
"@microsoft.azure/autorest.modeler": "2.3.45",
"autorest": "^2.0.4203",
"coffee-script": "^1.11.1",
"dotnet-sdk-2.0.0": "^1.4.4",
"gulp": "^3.9.1",

Просмотреть файл

@ -24,19 +24,22 @@ namespace AutoRest.AzureResourceSchema
public override async Task Generate(CodeModel serviceClient)
{
var apiVersions = serviceClient.Methods.Select(method => method.Parameters.FirstOrDefault(p => p.SerializedName == "api-version")?.DefaultValue.Value ).ConcatSingleItem(serviceClient.ApiVersion).Where(each => each!=null).Distinct().ToArray();
var apiVersions = serviceClient.Methods
.Select(method => method.Parameters.FirstOrDefault(p => p.SerializedName == "api-version")?.DefaultValue.Value)
.Concat(new [] { serviceClient.ApiVersion })
.Where(each => each != null)
.Distinct().ToArray();
foreach(var version in apiVersions)
{
IDictionary<string, ResourceSchema> resourceSchemas = ResourceSchemaParser.Parse(serviceClient, version);
var resourceSchemas = ResourceSchemaParser.Parse(serviceClient, version);
foreach (string resourceProvider in resourceSchemas.Keys)
{
StringWriter stringWriter = new StringWriter();
var stringWriter = new StringWriter();
ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);
await Write(stringWriter.ToString(), Path.Combine(version, resourceProvider + ".json"), true);
stringWriter = new StringWriter();
var md = ResourceMarkdownGenerator.Generate(resourceSchemas[resourceProvider]);
foreach (var m in md)

Просмотреть файл

@ -14,12 +14,6 @@ namespace AutoRest.AzureResourceSchema
public class JsonSchema
{
private string resourceType;
private IList<string> enumList;
private IDictionary<string, JsonSchema> properties;
private IList<string> requiredList;
private IList<JsonSchema> oneOfList;
private IList<JsonSchema> anyOfList;
private IList<JsonSchema> allOfList;
/// <summary>
/// A reference to the location in the parent schema where this schema's definition can be
@ -67,12 +61,12 @@ namespace AutoRest.AzureResourceSchema
// update the value of the type enum. we have to be careful though that we don't
// stomp over some other enum that happens to have the name "type". this code path
// is typically hit when building a child resource definition from a cloned parent.
if (Properties["type"].enumList.Count > 1)
if (Properties["type"].Enum.Count > 1)
throw new InvalidOperationException("Attempt to update 'type' enum that contains more than one member (possible collision).");
if (!Properties["type"].enumList[0].EndsWith(value))
throw new InvalidOperationException($"The updated type value '{value}' is not a child of type value '{Properties["type"].enumList[0]}'");
if (!Properties["type"].Enum[0].EndsWith(value))
throw new InvalidOperationException($"The updated type value '{value}' is not a child of type value '{Properties["type"].Enum[0]}'");
Properties["type"].enumList[0] = value;
Properties["type"].Enum[0] = value;
}
}
}
@ -117,50 +111,32 @@ namespace AutoRest.AzureResourceSchema
/// An enumeration of values that will match this JSON schema. Any value not in this
/// enumeration will not match this schema.
/// </summary>
public IList<string> Enum
{
get { return enumList; }
}
public IList<string> Enum { get; private set;}
/// <summary>
/// The list of oneOf options that exist for this JSON schema.
/// </summary>
public IList<JsonSchema> OneOf
{
get { return oneOfList; }
}
public IList<JsonSchema> OneOf { get; private set;}
/// <summary>
/// The list of anyOf options that exist for this JSON schema.
/// </summary>
public IList<JsonSchema> AnyOf
{
get { return anyOfList; }
}
public IList<JsonSchema> AnyOf { get; private set;}
/// <summary>
/// The list of allOf options that exist for this JSON schema.
/// </summary>
public IList<JsonSchema> AllOf
{
get { return allOfList; }
}
public IList<JsonSchema> AllOf { get; private set;}
/// <summary>
/// The schemas that describe the properties of a matching JSON value.
/// </summary>
public IDictionary<string,JsonSchema> Properties
{
get { return properties; }
}
public IDictionary<string,JsonSchema> Properties { get; private set;}
/// <summary>
/// The names of the properties that are required for a matching JSON value.
/// </summary>
public IList<string> Required
{
get { return requiredList; }
}
public IList<string> Required { get; private set;}
public bool IsEmpty()
{
@ -170,12 +146,12 @@ namespace AutoRest.AzureResourceSchema
Minimum == null &&
Maximum == null &&
Pattern == null &&
IsEmpty(enumList) &&
IsEmpty(properties) &&
IsEmpty(requiredList) &&
IsEmpty(oneOfList) &&
IsEmpty(anyOfList) &&
IsEmpty(allOfList);
IsEmpty(Enum) &&
IsEmpty(Properties) &&
IsEmpty(Required) &&
IsEmpty(OneOf) &&
IsEmpty(AnyOf) &&
IsEmpty(AllOf);
}
private static bool IsEmpty<T>(IEnumerable<T> values)
@ -192,44 +168,32 @@ namespace AutoRest.AzureResourceSchema
/// <returns></returns>
public JsonSchema AddEnum(string enumValue, params string[] extraEnumValues)
{
if (enumList == null)
if (Enum == null)
{
enumList = new List<string>();
Enum = new List<string>();
}
if (enumList.Contains(enumValue))
if (Enum.Contains(enumValue))
{
throw new ArgumentException("enumValue (" + enumValue + ") already exists in the list of allowed values.", "enumValue");
}
enumList.Add(enumValue);
Enum.Add(enumValue);
if (extraEnumValues != null && extraEnumValues.Length > 0)
{
foreach (string extraEnumValue in extraEnumValues)
{
if (enumList.Contains(extraEnumValue))
if (Enum.Contains(extraEnumValue))
{
throw new ArgumentException("extraEnumValue (" + extraEnumValue + ") already exists in the list of allowed values.", "extraEnumValues");
}
enumList.Add(extraEnumValue);
Enum.Add(extraEnumValue);
}
}
return this;
}
/// <summary>
/// Add a new property to this JsonSchema, and then return this JsonSchema so that
/// additional changes can be chained together.
/// </summary>
/// <param name="propertyName">The name of the property to add.</param>
/// <param name="propertyDefinition">The JsonSchema definition of the property to add.</param>
/// <returns></returns>
public JsonSchema AddProperty(string propertyName, JsonSchema propertyDefinition)
{
return AddProperty(propertyName, propertyDefinition, false);
}
/// <summary>
/// Add a new property to this JsonSchema, and then return this JsonSchema so that
/// additional changes can be chained together.
@ -238,7 +202,7 @@ namespace AutoRest.AzureResourceSchema
/// <param name="propertyDefinition">The JsonSchema definition of the property to add.</param>
/// <param name="isRequired">Whether this property is required or not.</param>
/// <returns></returns>
public JsonSchema AddProperty(string propertyName, JsonSchema propertyDefinition, bool isRequired)
public JsonSchema AddProperty(string propertyName, JsonSchema propertyDefinition, bool isRequired = false)
{
if (string.IsNullOrWhiteSpace(propertyName))
{
@ -249,17 +213,17 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException("propertyDefinition");
}
if (properties == null)
if (Properties == null)
{
properties = new Dictionary<string, JsonSchema>();
Properties = new Dictionary<string, JsonSchema>();
}
if (properties.ContainsKey(propertyName))
if (Properties.ContainsKey(propertyName))
{
throw new ArgumentException("A property with the name \"" + propertyName + "\" already exists in this JSONSchema", "propertyName");
}
properties[propertyName] = propertyDefinition;
Properties[propertyName] = propertyDefinition;
if (isRequired)
{
@ -281,16 +245,16 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentException("No property exists with the provided requiredPropertyName (" + requiredPropertyName + ")", nameof(requiredPropertyName));
}
if (requiredList == null)
if (Required == null)
{
requiredList = new List<string>();
Required = new List<string>();
}
if (requiredList.Contains(requiredPropertyName))
if (Required.Contains(requiredPropertyName))
{
throw new ArgumentException("'" + requiredPropertyName + "' is already a required property.", "requiredPropertyName");
}
requiredList.Add(requiredPropertyName);
Required.Add(requiredPropertyName);
if (extraRequiredPropertyNames != null)
{
@ -300,11 +264,11 @@ namespace AutoRest.AzureResourceSchema
{
throw new ArgumentException("No property exists with the provided extraRequiredPropertyName (" + extraRequiredPropertyName + ")", "extraRequiredPropertyNames");
}
if (requiredList.Contains(extraRequiredPropertyName))
if (Required.Contains(extraRequiredPropertyName))
{
throw new ArgumentException("'" + extraRequiredPropertyName + "' is already a required property.", "extraRequiredPropertyNames");
}
requiredList.Add(extraRequiredPropertyName);
Required.Add(extraRequiredPropertyName);
}
}
@ -323,12 +287,12 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException(nameof(anyOfOption));
}
if (anyOfList == null)
if (AnyOf == null)
{
anyOfList = new List<JsonSchema>();
AnyOf = new List<JsonSchema>();
}
anyOfList.Add(anyOfOption);
AnyOf.Add(anyOfOption);
return this;
}
@ -345,12 +309,12 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException(nameof(oneOfOption));
}
if (oneOfList == null)
if (OneOf == null)
{
oneOfList = new List<JsonSchema>();
OneOf = new List<JsonSchema>();
}
oneOfList.Add(oneOfOption);
OneOf.Add(oneOfOption);
return this;
}
@ -367,12 +331,12 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException(nameof(allOfOption));
}
if (allOfList == null)
if (AllOf == null)
{
allOfList = new List<JsonSchema>();
AllOf = new List<JsonSchema>();
}
allOfList.Add(allOfOption);
AllOf.Add(allOfOption);
return this;
}
@ -393,12 +357,12 @@ namespace AutoRest.AzureResourceSchema
result.Maximum = Maximum;
result.Pattern = Pattern;
result.Default = Default;
result.enumList = Clone(Enum);
result.properties = Clone(Properties);
result.requiredList = Clone(Required);
result.oneOfList = Clone(OneOf);
result.anyOfList = Clone(AnyOf);
result.allOfList = Clone(AllOf);
result.Enum = Clone(Enum);
result.Properties = Clone(Properties);
result.Required = Clone(Required);
result.OneOf = Clone(OneOf);
result.AnyOf = Clone(AnyOf);
result.AllOf = Clone(AllOf);
return result;
}

Просмотреть файл

@ -71,38 +71,19 @@ namespace AutoRest.AzureResourceSchema
throw new Exception($"Generator received incorrect number of inputs: {files.Length} : {string.Join(",", files)}");
}
var modelAsJson = (await ReadFile(files[0])).EnsureYamlIsJson();
var codeModelT = new ModelSerializer<CodeModel>().Load(modelAsJson);
// build settings
var altNamespace = (await GetValue<string[]>("input-file") ?? new[] { "" }).FirstOrDefault()?.Split('/').Last().Split('\\').Last().Split('.').First();
new Settings
{
Namespace = await GetValue("namespace"),
ClientName = GetXmsCodeGenSetting<string>(codeModelT, "name") ?? await GetValue("override-client-name"),
PayloadFlatteningThreshold = GetXmsCodeGenSetting<int?>(codeModelT, "ft") ?? await GetValue<int?>("payload-flattening-threshold") ?? 0,
AddCredentials = await GetValue<bool?>("add-credentials") ?? false,
Host = this
};
var header = await GetValue("license-header");
if (header != null)
{
Settings.Instance.Header = header;
}
Settings.Instance.CustomSettings.Add("InternalConstructors", GetXmsCodeGenSetting<bool?>(codeModelT, "internalConstructors") ?? await GetValue<bool?>("use-internal-constructors") ?? false);
Settings.Instance.CustomSettings.Add("SyncMethods", GetXmsCodeGenSetting<string>(codeModelT, "syncMethods") ?? await GetValue("sync-methods") ?? "essential");
Settings.Instance.CustomSettings.Add("UseDateTimeOffset", GetXmsCodeGenSetting<bool?>(codeModelT, "useDateTimeOffset") ?? await GetValue<bool?>("use-datetimeoffset") ?? false);
Settings.Instance.CustomSettings["ClientSideValidation"] = await GetValue<bool?>("client-side-validation") ?? false;
Settings.Instance.MaximumCommentColumns = await GetValue<int?>("max-comment-columns") ?? Settings.DefaultMaximumCommentColumns;
Settings.Instance.OutputFileName = await GetValue<string>("output-file");
// process
var plugin = new AutoRest.AzureResourceSchema.PluginArs();
Settings.PopulateSettings(plugin.Settings, Settings.Instance.CustomSettings);
using (plugin.Activate())
{
Settings.Instance.Namespace = Settings.Instance.Namespace ?? CodeNamer.Instance.GetNamespaceName(altNamespace);
var codeModel = plugin.Serializer.Load(modelAsJson);
codeModel = plugin.Transformer.TransformCodeModel(codeModel);
plugin.CodeGenerator.Generate(codeModel).GetAwaiter().GetResult();

Просмотреть файл

@ -13,9 +13,6 @@ namespace AutoRest.AzureResourceSchema
/// </summary>
public class ResourceSchema
{
private IDictionary<string, JsonSchema> resourceDefinitions = new Dictionary<string,JsonSchema>();
private IDictionary<string, JsonSchema> definitions = new Dictionary<string, JsonSchema>();
/// <summary>
/// The id metadata that uniquely identifies this schema. Usually this will be the URL to
/// the permanent location of this schema in schema.management.azure.com/schemas/.
@ -41,19 +38,13 @@ namespace AutoRest.AzureResourceSchema
/// <summary>
/// The named JSON schemas that define the resources of this resource schema.
/// </summary>
public IDictionary<string, JsonSchema> ResourceDefinitions
{
get { return resourceDefinitions; }
}
public IDictionary<string, JsonSchema> ResourceDefinitions { get; private set; } = new Dictionary<string,JsonSchema>();
/// <summary>
/// The named reusable JSON schemas that the resource definitions reference. These
/// definitions can also reference each other or themselves.
/// </summary>
public IDictionary<string,JsonSchema> Definitions
{
get { return definitions; }
}
public IDictionary<string,JsonSchema> Definitions { get; private set; } = new Dictionary<string,JsonSchema>();
/// <summary>
/// Search this ResourceSchema for a resource definition that has the provided type.
@ -69,9 +60,9 @@ namespace AutoRest.AzureResourceSchema
JsonSchema result = null;
if (resourceDefinitions != null && resourceDefinitions.Count > 0)
if (ResourceDefinitions != null && ResourceDefinitions.Count > 0)
{
foreach(JsonSchema resourceDefinition in resourceDefinitions.Values)
foreach(JsonSchema resourceDefinition in ResourceDefinitions.Values)
{
if (resourceDefinition.ResourceType == resourceType)
{
@ -100,12 +91,12 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException("resourceDefinition");
}
if (resourceDefinitions.ContainsKey(resourceName))
if (ResourceDefinitions.ContainsKey(resourceName))
{
throw new ArgumentException("A resource definition for \"" + resourceName + "\" already exists in this resource schema.", "resourceName");
}
resourceDefinitions.Add(resourceName, resourceDefinition);
ResourceDefinitions.Add(resourceName, resourceDefinition);
return this;
}
@ -126,12 +117,12 @@ namespace AutoRest.AzureResourceSchema
throw new ArgumentNullException("definition");
}
if (definitions.ContainsKey(definitionName))
if (Definitions.ContainsKey(definitionName))
{
throw new ArgumentException("A definition for \"" + definitionName + "\" already exists in this resource schema.", "definitionName");
}
definitions.Add(definitionName, definition);
Definitions.Add(definitionName, definition);
return this;
}

Просмотреть файл

@ -258,68 +258,45 @@ namespace AutoRest.AzureResourceSchema
private static JsonSchema ParseType(Property property, IModelType type, IDictionary<string, JsonSchema> definitions, IEnumerable<CompositeType> modelTypes)
{
JsonSchema result = null;
if (property == null || !property.IsReadOnly)
{
// A schema that matches a JSON object with specific properties, such as
// { "name": { "type": "string" }, "age": { "type": "number" } }
CompositeType compositeType = type as CompositeType;
if (compositeType != null)
if (type is CompositeType compositeType)
{
result = ParseCompositeType(property, compositeType, true, definitions, modelTypes);
return ParseCompositeType(property, compositeType, true, definitions, modelTypes);
}
else
// A schema that matches a "dictionary" JSON object, such as
// { "additionalProperties": { "type": "string" } }
if (type is DictionaryType dictionaryType)
{
// A schema that matches a "dictionary" JSON object, such as
// { "additionalProperties": { "type": "string" } }
DictionaryType dictionaryType = type as DictionaryType;
if (dictionaryType != null)
{
result = ParseDictionaryType(property, dictionaryType, definitions, modelTypes);
}
else
{
// A schema that matches a single value from a given set of values, such as
// { "enum": [ "a", "b" ] }
EnumType enumType = type as EnumType;
if (enumType != null)
{
result = ParseEnumType(property, enumType);
}
else
{
// A schema that matches simple values, such as { "type": "number" }
PrimaryType primaryType = type as PrimaryType;
if (primaryType != null)
{
result = ParsePrimaryType(property, primaryType);
}
else
{
// A schema that matches an array of values, such as
// { "items": { "type": "number" } }
SequenceType sequenceType = type as SequenceType;
if (sequenceType != null)
{
result = ParseSequenceType(property, sequenceType, definitions, modelTypes);
}
else
{
Debug.Fail("Unrecognized property type: " + type.GetType());
}
}
}
}
return ParseDictionaryType(property, dictionaryType, definitions, modelTypes);
}
// A schema that matches a single value from a given set of values, such as
// { "enum": [ "a", "b" ] }
if (type is EnumType enumType)
{
return ParseEnumType(property, enumType);
}
// A schema that matches simple values, such as { "type": "number" }
if (type is PrimaryType primaryType)
{
return ParsePrimaryType(property, primaryType);
}
// A schema that matches an array of values, such as
// { "items": { "type": "number" } }
if (type is SequenceType sequenceType)
{
return ParseSequenceType(property, sequenceType, definitions, modelTypes);
}
Debug.Fail("Unrecognized property type: " + type.GetType());
}
return result;
return null;
}
private static JsonSchema ParseCompositeType(Property property, CompositeType compositeType, bool includeBaseModelTypeProperties, IDictionary<string, JsonSchema> definitions, IEnumerable<CompositeType> modelTypes)
{
string definitionName = compositeType.SerializedName;
string definitionName = compositeType.Name;
if (!definitions.ContainsKey(definitionName))
{
@ -347,6 +324,10 @@ namespace AutoRest.AzureResourceSchema
definition.AddAllOf(baseTypeDefinition);
JsonSchema derivedTypeDefinitionRefs = new JsonSchema();
derivedTypeDefinitionRefs.AddOneOf(new JsonSchema()
{
JsonType = "object"
});
Func<CompositeType, bool> isSubType = null;
isSubType = type => type == compositeType || (type.BaseModelType is CompositeType baseType && isSubType(baseType));
@ -370,23 +351,13 @@ namespace AutoRest.AzureResourceSchema
// sub-type we add the sub-type to the resource schema.
ParseCompositeType(null, subType, false, definitions, modelTypes);
derivedTypeDefinitionRefs.AddAnyOf(new JsonSchema()
derivedTypeDefinitionRefs.AddOneOf(new JsonSchema()
{
Ref = "#/definitions/" + subType.SerializedName,
Ref = "#/definitions/" + subType.Name,
});
}
const string discriminatorValueExtensionName = "x-ms-discriminator-value";
if (subType.Extensions.TryGetValue(discriminatorValueExtensionName, out object val) &&
val is string discriminatorValue &&
!string.IsNullOrWhiteSpace(discriminatorValue))
{
discriminatorDefinition.AddEnum(discriminatorValue);
}
else
{
discriminatorDefinition.AddEnum(subType.SerializedName);
}
discriminatorDefinition.AddEnum(subType.SerializedName);
}
}

Просмотреть файл

@ -61,7 +61,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="YamlDotNet.Signed" Version="4.2.1" />
<PackageReference Include="autorest.common" Version="2.2.27" />
<PackageReference Include="autorest.common" Version="2.4.36" />
<!-- <ProjectReference Include="../../autorest.common/src/autorest.common.csproj" /> -->
</ItemGroup>

Просмотреть файл

@ -1,300 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.IO;
using Xunit;
namespace AutoRest.AzureResourceSchema.Tests
{
[Collection("AutoRest Azure Resource Schema Tests")]
public static class AzureResourceSchemaAcceptanceTests
{
[Fact]
public static void ApiManagement_2016_07_07()
{
RunSwaggerTest("ApiManagement", "2016-07-07", "apimanagement.json");
}
/*
[Fact]
public static void ApiManagement_2016_07_07b()
{
RunSwaggerTest("ApiManagement", "2016-07-07b", "apimanagement.json");
}
*/
[Fact]
public static void Authorization_2015_07_01()
{
RunSwaggerTest("Authorization", "2015-07-01", "authorization.json");
}
[Fact]
public static void Batch_2015_12_01()
{
RunSwaggerTest("Batch", "2015-12-01", "BatchManagement.json");
}
[Fact]
public static void Cdn_2015_06_01()
{
RunSwaggerTest("CDN", "2015-06-01", "cdn.json");
}
[Fact]
public static void Cdn_2016_04_02()
{
RunSwaggerTest("CDN", "2016-04-02", "cdn.json");
}
[Fact]
public static void CognitiveServices_2016_02_01_preview()
{
RunSwaggerTest("CognitiveServices", "2016-02-01-preview", "cognitiveservices.json");
}
[Fact]
public static void CommitmentPlans_2016_05_01_preview()
{
RunSwaggerTest("CommitmentPlans", "2016-05-01-preview", "commitmentPlans.json");
}
[Fact]
public static void Compute_2015_06_15()
{
RunSwaggerTest("Compute", "2015-06-15", "compute.json");
}
[Fact]
public static void Compute_2016_03_30()
{
RunSwaggerTest("Compute", "2016-03-30", "compute.json");
}
/*
[Fact]
public static void Compute_2016_03_30b()
{
RunSwaggerTest("Compute", "2016-03-30b", "compute.json");
}
*/
[Fact]
public static void ContainerService_2016_03_30()
{
RunSwaggerTest("ContainerService", "2016-03-30", "containerService.json");
}
[Fact]
public static void DataLakeAnalytics_2015_10_01_preview()
{
RunSwaggerTest("DataLakeAnalytics", "2015-10-01-preview", "account.json");
}
[Fact]
public static void DataLakeStore_2015_10_01_preview()
{
RunSwaggerTest("DataLakeStore", "2015-10-01-preview", "account.json");
}
[Fact]
public static void DevTestLabs_2015_05_21_preview()
{
RunSwaggerTest("DevTestLabs", "2015-05-21-preview", "DTL.json");
}
[Fact]
public static void Dns_2015_05_04_preview()
{
RunSwaggerTest("DNS", "2015-05-04-preview", "dns.json");
}
[Fact]
public static void Dns_2016_04_01()
{
RunSwaggerTest("DNS", "2016-04-01", "dns.json");
}
[Fact(Skip = "invalid Swagger spec, nowadays AutoRest complains")]
public static void Logic_2015_02_01_preview()
{
RunSwaggerTest("Logic", "2015-02-01-preview", "logic.json");
}
[Fact]
public static void Logic_2016_06_01()
{
RunSwaggerTest("Logic", "2016-06-01", "logic.json");
}
[Fact]
public static void MachineLearning_2016_05_01_preview()
{
RunSwaggerTest("MachineLearning", "2016-05-01-preview", "webservices.json");
}
[Fact]
public static void MobileEngagement_2014_12_01()
{
RunSwaggerTest("MobileEngagement", "2014-12-01", "mobile-engagement.json");
}
[Fact]
public static void Network_2015_05_01_preview()
{
RunSwaggerTest("Network", "2015-05-01-preview", "network.json");
}
[Fact]
public static void Network_2015_06_15()
{
RunSwaggerTest("Network", "2015-06-15", "network.json");
}
[Fact]
public static void Network_2016_03_30()
{
RunSwaggerTest("Network", "2016-03-30", "network.json");
}
[Fact]
public static void Network_2016_09_01()
{
RunSwaggerTest("Network", "2016-09-01", "network.json");
}
[Fact]
public static void NotificationHubs_2016_03_01()
{
RunSwaggerTest("NotificationHubs", "2016-03-01", "notificationhubs.json");
}
[Fact]
public static void PowerBIEmbedded_2016_01_29()
{
RunSwaggerTest("PowerBIEmbedded", "2016-01-29", "powerbiembedded.json");
}
[Fact]
public static void RecoveryServices_2016_06_01()
{
RunSwaggerTest("RecoveryServices", "2016-06-01", "recoveryservices.json");
}
[Fact]
public static void Redis_2016_04_01()
{
RunSwaggerTest("Redis", "2016-04-01", "redis.json");
}
[Fact]
public static void Resources_Features_2015_12_01()
{
RunSwaggerTest("Resources/Features", "2015-12-01", "features.json");
}
[Fact]
public static void Resources_Locks_2016_09_01()
{
RunSwaggerTest("Resources/Locks", "2016-09-01", "locks.json");
}
[Fact]
public static void Resources_Policy_2016_04_01()
{
RunSwaggerTest("Resources/Policy", "2016-04-01", "policy.json");
}
[Fact]
public static void Resources_Resources_2016_09_01()
{
RunSwaggerTest("Resources/Resources", "2016-09-01", "resources.json");
}
[Fact]
public static void Resources_Subscriptions_2016_06_01()
{
RunSwaggerTest("Resources/Subscriptions", "2016-06-01", "subscriptions.json");
}
[Fact]
public static void Scheduler_2016_03_01()
{
RunSwaggerTest("Scheduler", "2016-03-01", "scheduler.json");
}
[Fact]
public static void Search_2015_02_28()
{
RunSwaggerTest("Search", "2015-02-28", "search.json");
}
[Fact]
public static void ServerManagement_2016_07_01()
{
RunSwaggerTest("ServerManagement", "2016-07-01-preview", "servermanagement.json");
}
[Fact]
public static void ServiceBus_2015_08_01()
{
RunSwaggerTest("ServiceBus", "2015-08-01", "servicebus.json");
}
[Fact]
public static void ServiceFabric_2016_01_28()
{
RunSwaggerTest("ServiceFabric", "2016-01-28", "servicefabric.json");
}
[Fact]
public static void SQL_2015_05_01()
{
RunSwaggerTest("SQL", "2015-05-01", "sql.json");
}
[Fact]
public static void Storage_2015_05_01_preview()
{
RunSwaggerTest("Storage", "2015-05-01-preview", "storage.json");
}
[Fact]
public static void Storage_2015_06_15()
{
RunSwaggerTest("Storage", "2015-06-15", "storage.json");
}
[Fact]
public static void Storage_2016_01_01()
{
RunSwaggerTest("Storage", "2016-01-01", "storage.json");
}
[Fact]
public static void TrafficManager_2015_11_01()
{
RunSwaggerTest("TrafficManager", "2015-11-01", "trafficmanager.json");
}
[Fact]
public static void Web_2015_08_01()
{
RunSwaggerTest("Web", "2015-08-01", "web.json");
}
[Fact]
public static void WebYaml_2015_08_01()
{
// same test as Web(), but converted to YAML
RunSwaggerTest("Web", "2015-08-01", "web.yaml");
}
private static void RunSwaggerTest(string resourceType, string apiVersion, string swaggerFileName)
{
var codeBaseDir = Core.Utilities.Extensions.CodeBaseDirectory(typeof(AzureResourceSchemaAcceptanceTests));
SwaggerSpecHelper.RunTests(
Path.Combine(codeBaseDir, "Resource", "Swagger", resourceType, apiVersion, swaggerFileName),
Path.Combine(codeBaseDir, "Resource", "Expected", resourceType, apiVersion));
}
}
}

Просмотреть файл

@ -117,46 +117,7 @@
],
"description": "An alert rule."
},
"ManagementEventAggregationCondition": {
"type": "object",
"properties": {
"operator": {
"oneOf": [
{
"type": "string",
"enum": [
"GreaterThan",
"GreaterThanOrEqual",
"LessThan",
"LessThanOrEqual"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "the condition operator."
},
"threshold": {
"oneOf": [
{
"type": "number"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "the condition threshold."
},
"windowSize": {
"type": "string",
"format": "duration",
"description": "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day."
}
},
"description": "A management event aggregation condition."
},
"Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition": {
"LocationThresholdRuleCondition": {
"type": "object",
"allOf": [
{
@ -196,7 +157,46 @@
],
"description": "A rule condition based on a certain number of locations failing."
},
"Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition": {
"ManagementEventAggregationCondition": {
"type": "object",
"properties": {
"operator": {
"oneOf": [
{
"type": "string",
"enum": [
"GreaterThan",
"GreaterThanOrEqual",
"LessThan",
"LessThanOrEqual"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "the condition operator."
},
"threshold": {
"oneOf": [
{
"type": "number"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "the condition threshold."
},
"windowSize": {
"type": "string",
"format": "duration",
"description": "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day."
}
},
"description": "A management event aggregation condition."
},
"ManagementEventRuleCondition": {
"type": "object",
"allOf": [
{
@ -228,7 +228,119 @@
],
"description": "A management event rule condition."
},
"Microsoft.Azure.Management.Insights.Models.RuleEmailAction": {
"RuleAction": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleAction",
"Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"oneOf": [
{},
{
"$ref": "#/definitions/RuleEmailAction"
},
{
"$ref": "#/definitions/RuleWebhookAction"
}
]
}
],
"description": "The action that is performed when the alert rule becomes active, and when an alert condition is resolved."
},
"RuleCondition": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleCondition",
"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
"Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"oneOf": [
{},
{
"$ref": "#/definitions/ThresholdRuleCondition"
},
{
"$ref": "#/definitions/LocationThresholdRuleCondition"
},
{
"$ref": "#/definitions/ManagementEventRuleCondition"
}
]
}
],
"description": "The condition that results in the alert rule being activated."
},
"RuleDataSource": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleDataSource",
"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"oneOf": [
{},
{
"$ref": "#/definitions/RuleMetricDataSource"
},
{
"$ref": "#/definitions/RuleManagementEventDataSource"
}
]
}
],
"description": "The resource from which the rule collects its data."
},
"RuleEmailAction": {
"type": "object",
"allOf": [
{
@ -263,7 +375,17 @@
],
"description": "Specifies the action to send email when the rule condition is evaluated."
},
"Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource": {
"RuleManagementEventClaimsDataSource": {
"type": "object",
"properties": {
"emailAddress": {
"type": "string",
"description": "the email address."
}
},
"description": "The claims for a rule management event data source."
},
"RuleManagementEventDataSource": {
"type": "object",
"allOf": [
{
@ -320,7 +442,7 @@
],
"description": "A rule management event data source."
},
"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource": {
"RuleMetricDataSource": {
"type": "object",
"allOf": [
{
@ -338,7 +460,7 @@
],
"description": "A rule metric data source."
},
"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction": {
"RuleWebhookAction": {
"type": "object",
"allOf": [
{
@ -366,7 +488,7 @@
],
"description": "Specifies the action to post to service when the rule condition is evaluated."
},
"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition": {
"ThresholdRuleCondition": {
"type": "object",
"allOf": [
{
@ -441,125 +563,6 @@
}
],
"description": "A rule condition based on a metric crossing a threshold."
},
"RuleAction": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleAction",
"Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"anyOf": [
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.RuleEmailAction"
},
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.RuleWebhookAction"
}
]
}
],
"description": "The action that is performed when the alert rule becomes active, and when an alert condition is resolved."
},
"RuleCondition": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleCondition",
"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition",
"Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"anyOf": [
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"
},
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition"
},
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition"
}
]
}
],
"description": "The condition that results in the alert rule being activated."
},
"RuleDataSource": {
"type": "object",
"allOf": [
{
"properties": {
"odata.type": {
"oneOf": [
{
"type": "string",
"enum": [
"RuleDataSource",
"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
}
},
{
"anyOf": [
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"
},
{
"$ref": "#/definitions/Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource"
}
]
}
],
"description": "The resource from which the rule collects its data."
},
"RuleManagementEventClaimsDataSource": {
"type": "object",
"properties": {
"emailAddress": {
"type": "string",
"description": "the email address."
}
},
"description": "The claims for a rule management event data source."
}
}
}

Просмотреть файл

@ -334,27 +334,6 @@
},
"description": "Sample input data for the service's input(s)."
},
"Graph": {
"type": "object",
"allOf": [
{
"properties": {
"package": {
"oneOf": [
{
"$ref": "#/definitions/GraphPackage"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The definition of the graph package making up this web service."
}
}
}
],
"description": "Properties specific to a Graph based web service."
},
"GraphEdge": {
"type": "object",
"properties": {
@ -919,14 +898,36 @@
}
},
{
"anyOf": [
"oneOf": [
{},
{
"$ref": "#/definitions/Graph"
"$ref": "#/definitions/WebServicePropertiesForGraph"
}
]
}
],
"description": "The set of properties specific to the Azure ML web service resource."
},
"WebServicePropertiesForGraph": {
"type": "object",
"allOf": [
{
"properties": {
"package": {
"oneOf": [
{
"$ref": "#/definitions/GraphPackage"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The definition of the graph package making up this web service."
}
}
}
],
"description": "Properties specific to a Graph based web service."
}
}
}

Просмотреть файл

@ -32,7 +32,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/GatewayParameters_properties"
"$ref": "#/definitions/GatewayParametersProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -77,7 +77,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/NodeParameters_properties"
"$ref": "#/definitions/NodeParametersProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -125,7 +125,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/SessionParameters_properties"
"$ref": "#/definitions/SessionParametersProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -170,7 +170,7 @@
}
},
"definitions": {
"GatewayParameters_properties": {
"GatewayParametersProperties": {
"type": "object",
"properties": {
"upgradeMode": {
@ -191,7 +191,7 @@
},
"description": "collection of properties"
},
"NodeParameters_properties": {
"NodeParametersProperties": {
"type": "object",
"properties": {
"gatewayId": {
@ -235,7 +235,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/SessionParameters_properties"
"$ref": "#/definitions/SessionParametersProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -252,7 +252,7 @@
],
"description": "Microsoft.ServerManagement/nodes/sessions"
},
"SessionParameters_properties": {
"SessionParametersProperties": {
"type": "object",
"properties": {
"userName": {

Просмотреть файл

@ -29,11 +29,11 @@ The following tables describe the values you need to set in the schema.
| apiVersion | enum | Yes | 2016-07-01-preview |
| location | string | No | location of the resource |
| tags | object | No | resource tags |
| properties | object | Yes | collection of properties - [GatewayParameters_properties object](#GatewayParameters_properties) |
| properties | object | Yes | collection of properties - [GatewayParametersProperties object](#GatewayParametersProperties) |
<a id="GatewayParameters_properties" />
### GatewayParameters_properties object
<a id="GatewayParametersProperties" />
### GatewayParametersProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| upgradeMode | enum | No | The upgradeMode property gives the flexibility to gateway to auto upgrade itself. If properties value not specified, then we assume upgradeMode = Automatic. - Manual or Automatic |

Просмотреть файл

@ -33,12 +33,12 @@ The following tables describe the values you need to set in the schema.
| apiVersion | enum | Yes | 2016-07-01-preview |
| location | string | No | location of the resource? |
| tags | object | No | resource tags |
| properties | object | Yes | collection of properties - [NodeParameters_properties object](#NodeParameters_properties) |
| properties | object | Yes | collection of properties - [NodeParametersProperties object](#NodeParametersProperties) |
| resources | array | No | [sessions](./nodes/sessions.md) |
<a id="NodeParameters_properties" />
### NodeParameters_properties object
<a id="NodeParametersProperties" />
### NodeParametersProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| gatewayId | string | No | Gateway id which will manage this node |

Просмотреть файл

@ -29,11 +29,11 @@ The following tables describe the values you need to set in the schema.
| name | string | Yes | |
| type | enum | Yes | Microsoft.ServerManagement/nodes/sessions |
| apiVersion | enum | Yes | 2016-07-01-preview |
| properties | object | Yes | collection of properties - [SessionParameters_properties object](#SessionParameters_properties) |
| properties | object | Yes | collection of properties - [SessionParametersProperties object](#SessionParametersProperties) |
<a id="SessionParameters_properties" />
### SessionParameters_properties object
<a id="SessionParametersProperties" />
### SessionParametersProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| userName | string | No | encrypted User name to be used to connect to node |

Просмотреть файл

@ -51,7 +51,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateOrder_properties"
"$ref": "#/definitions/CertificateOrderProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -125,7 +125,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateOrderCertificate_properties"
"$ref": "#/definitions/CertificateOrderCertificateProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -184,7 +184,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateDetails_properties"
"$ref": "#/definitions/CertificateDetailsProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -197,7 +197,7 @@
],
"description": "Certificate Details"
},
"CertificateDetails_properties": {
"CertificateDetailsProperties": {
"type": "object",
"properties": {
"version": {
@ -247,7 +247,96 @@
}
}
},
"CertificateOrder_properties": {
"CertificateOrderCertificate": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Resource Id"
},
"name": {
"type": "string",
"description": "Resource Name"
},
"kind": {
"type": "string",
"description": "Kind of resource"
},
"location": {
"type": "string",
"description": "Resource Location"
},
"type": {
"type": "string",
"description": "Resource type"
},
"tags": {
"oneOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Resource tags"
},
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateOrderCertificateProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
},
"required": [
"location"
],
"description": "Class representing the Key Vault container for certificate purchased through Azure"
},
"CertificateOrderCertificateProperties": {
"type": "object",
"properties": {
"keyVaultId": {
"type": "string",
"description": "Key Vault Csm resource Id"
},
"keyVaultSecretName": {
"type": "string",
"description": "Key Vault secret name"
},
"provisioningState": {
"oneOf": [
{
"type": "string",
"enum": [
"Initialized",
"WaitingOnCertificateOrder",
"Succeeded",
"CertificateOrderFailed",
"OperationNotPermittedOnKeyVault",
"AzureServiceUnauthorizedToAccessKeyVault",
"KeyVaultDoesNotExist",
"KeyVaultSecretDoesNotExist",
"UnknownError",
"Unknown"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Status of the Key Vault secret."
}
}
},
"CertificateOrderProperties": {
"type": "object",
"properties": {
"certificates": {
@ -414,95 +503,6 @@
}
}
},
"CertificateOrderCertificate": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Resource Id"
},
"name": {
"type": "string",
"description": "Resource Name"
},
"kind": {
"type": "string",
"description": "Kind of resource"
},
"location": {
"type": "string",
"description": "Resource Location"
},
"type": {
"type": "string",
"description": "Resource type"
},
"tags": {
"oneOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Resource tags"
},
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateOrderCertificate_properties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
},
"required": [
"location"
],
"description": "Class representing the Key Vault container for certificate purchased through Azure"
},
"CertificateOrderCertificate_properties": {
"type": "object",
"properties": {
"keyVaultId": {
"type": "string",
"description": "Key Vault Csm resource Id"
},
"keyVaultSecretName": {
"type": "string",
"description": "Key Vault secret name"
},
"provisioningState": {
"oneOf": [
{
"type": "string",
"enum": [
"Initialized",
"WaitingOnCertificateOrder",
"Succeeded",
"CertificateOrderFailed",
"OperationNotPermittedOnKeyVault",
"AzureServiceUnauthorizedToAccessKeyVault",
"KeyVaultDoesNotExist",
"KeyVaultSecretDoesNotExist",
"UnknownError",
"Unknown"
]
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Status of the Key Vault secret."
}
}
},
"certificateOrders_certificates_childResource": {
"type": "object",
"properties": {
@ -550,7 +550,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/CertificateOrderCertificate_properties"
"$ref": "#/definitions/CertificateOrderCertificateProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"

Просмотреть файл

@ -51,7 +51,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Domain_properties"
"$ref": "#/definitions/DomainProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -149,7 +149,7 @@
},
"description": "Contact information for domain registration. If 'Domain Privacy' option is not selected then the contact information will be be made publicly available through the Whois directories as per ICANN requirements."
},
"Domain_properties": {
"DomainProperties": {
"type": "object",
"properties": {
"contactAdmin": {

Просмотреть файл

@ -51,7 +51,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Certificate_properties"
"$ref": "#/definitions/CertificateProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -115,7 +115,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Csr_properties"
"$ref": "#/definitions/CsrProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -179,7 +179,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostingEnvironment_properties"
"$ref": "#/definitions/HostingEnvironmentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -253,7 +253,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/WorkerPool_properties"
"$ref": "#/definitions/WorkerPoolProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -327,7 +327,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostingEnvironment_properties"
"$ref": "#/definitions/HostingEnvironmentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -391,7 +391,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/ServerFarmWithRichSku_properties"
"$ref": "#/definitions/ServerFarmWithRichSkuProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -465,7 +465,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetGateway_properties"
"$ref": "#/definitions/VnetGatewayProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -529,7 +529,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetRoute_properties"
"$ref": "#/definitions/VnetRouteProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -593,7 +593,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Site_properties"
"$ref": "#/definitions/SiteProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -682,7 +682,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -746,7 +746,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostNameBinding_properties"
"$ref": "#/definitions/HostNameBindingProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -810,7 +810,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/RelayServiceConnectionEntity_properties"
"$ref": "#/definitions/RelayServiceConnectionEntityProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -874,7 +874,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1008,7 +1008,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Site_properties"
"$ref": "#/definitions/SiteProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1094,7 +1094,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1158,7 +1158,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostNameBinding_properties"
"$ref": "#/definitions/HostNameBindingProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1222,7 +1222,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/RelayServiceConnectionEntity_properties"
"$ref": "#/definitions/RelayServiceConnectionEntityProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1286,7 +1286,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1420,7 +1420,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetInfo_properties"
"$ref": "#/definitions/VnetInfoProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1494,7 +1494,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetGateway_properties"
"$ref": "#/definitions/VnetGatewayProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1558,7 +1558,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetInfo_properties"
"$ref": "#/definitions/VnetInfoProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1632,7 +1632,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetGateway_properties"
"$ref": "#/definitions/VnetGatewayProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -1822,7 +1822,7 @@
},
"description": "AutoHealTriggers - describes the triggers for auto-heal."
},
"Certificate_properties": {
"CertificateProperties": {
"type": "object",
"properties": {
"friendlyName": {
@ -2044,7 +2044,7 @@
},
"description": "Cross-Origin Resource Sharing (CORS) settings for the web app."
},
"Csr_properties": {
"CsrProperties": {
"type": "object",
"properties": {
"name": {
@ -2077,7 +2077,7 @@
}
}
},
"Deployment_properties": {
"DeploymentProperties": {
"type": "object",
"properties": {
"id": {
@ -2176,7 +2176,25 @@
},
"description": "The IIS handler mappings used to define which handler processes HTTP requests with certain extension. \r\n For example it is used to configure php-cgi.exe process to handle all HTTP requests with *.php extension."
},
"HostingEnvironment_properties": {
"HostingEnvironmentProfile": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Resource id of the hostingEnvironment (App Service Environment)"
},
"name": {
"type": "string",
"description": "Name of the hostingEnvironment (App Service Environment) (read only)"
},
"type": {
"type": "string",
"description": "Resource type of the hostingEnvironment (App Service Environment) (read only)"
}
},
"description": "Specification for a hostingEnvironment (App Service Environment) to use for this resource"
},
"HostingEnvironmentProperties": {
"type": "object",
"properties": {
"name": {
@ -2445,25 +2463,10 @@
],
"description": "Custom settings for changing the behavior of the hosting environment"
}
}
},
"HostingEnvironmentProfile": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Resource id of the hostingEnvironment (App Service Environment)"
},
"name": {
"type": "string",
"description": "Name of the hostingEnvironment (App Service Environment) (read only)"
},
"type": {
"type": "string",
"description": "Resource type of the hostingEnvironment (App Service Environment) (read only)"
}
},
"description": "Specification for a hostingEnvironment (App Service Environment) to use for this resource"
"required": [
"status"
]
},
"hostingEnvironments_workerPools_childResource": {
"type": "object",
@ -2512,7 +2515,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/WorkerPool_properties"
"$ref": "#/definitions/WorkerPoolProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -2539,7 +2542,7 @@
],
"description": "Microsoft.Web/hostingEnvironments/workerPools"
},
"HostNameBinding_properties": {
"HostNameBindingProperties": {
"type": "object",
"properties": {
"name": {
@ -2789,7 +2792,7 @@
},
"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": {
"RelayServiceConnectionEntityProperties": {
"type": "object",
"properties": {
"entityName": {
@ -2843,7 +2846,7 @@
},
"description": "RequestsBasedTrigger"
},
"ServerFarmWithRichSku_properties": {
"ServerFarmWithRichSkuProperties": {
"type": "object",
"properties": {
"name": {
@ -2893,149 +2896,6 @@
}
}
},
"Site_properties": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of web app"
},
"enabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://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": "https://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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Configuration of web app"
},
"scmSiteAlsoStopped": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://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": "https://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": {
"type": "string"
},
"gatewaySiteName": {
"type": "string",
"description": "Name of gateway app associated with web app"
},
"clientAffinityEnabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the client affinity is enabled when load balancing http request for multiple instances of the web app"
},
"clientCertEnabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the client certificate is enabled for the web app"
},
"hostNamesDisabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the public hostnames are disabled the web app.\r\n If set to true the app is only accessible via API Management process"
},
"containerSize": {
"oneOf": [
{
"type": "integer"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Size of a function container"
},
"maxNumberOfWorkers": {
"oneOf": [
{
"type": "integer"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Maximum number of workers\r\n This only applies to function container"
},
"cloningInfo": {
"oneOf": [
{
"$ref": "#/definitions/CloningInfo"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "This is only valid for web app creation. If specified, web app is cloned from \r\n a source web app"
}
}
},
"SiteConfig": {
"type": "object",
"properties": {
@ -3076,7 +2936,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/SiteConfig_properties"
"$ref": "#/definitions/SiteConfigProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3089,7 +2949,7 @@
],
"description": "Configuration of Azure web site"
},
"SiteConfig_properties": {
"SiteConfigProperties": {
"type": "object",
"properties": {
"numberOfWorkers": {
@ -3501,6 +3361,149 @@
},
"description": "Represents metric limits set on a web app."
},
"SiteProperties": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of web app"
},
"enabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://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": "https://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": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Configuration of web app"
},
"scmSiteAlsoStopped": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://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": "https://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": {
"type": "string"
},
"gatewaySiteName": {
"type": "string",
"description": "Name of gateway app associated with web app"
},
"clientAffinityEnabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the client affinity is enabled when load balancing http request for multiple instances of the web app"
},
"clientCertEnabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the client certificate is enabled for the web app"
},
"hostNamesDisabled": {
"oneOf": [
{
"type": "boolean"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Specifies if the public hostnames are disabled the web app.\r\n If set to true the app is only accessible via API Management process"
},
"containerSize": {
"oneOf": [
{
"type": "integer"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Size of a function container"
},
"maxNumberOfWorkers": {
"oneOf": [
{
"type": "integer"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Maximum number of workers\r\n This only applies to function container"
},
"cloningInfo": {
"oneOf": [
{
"$ref": "#/definitions/CloningInfo"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "This is only valid for web app creation. If specified, web app is cloned from \r\n a source web app"
}
}
},
"sites_deployments_childResource": {
"type": "object",
"properties": {
@ -3548,7 +3551,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3612,7 +3615,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostNameBinding_properties"
"$ref": "#/definitions/HostNameBindingProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3676,7 +3679,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/RelayServiceConnectionEntity_properties"
"$ref": "#/definitions/RelayServiceConnectionEntityProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3810,7 +3813,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Site_properties"
"$ref": "#/definitions/SiteProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3893,7 +3896,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/Deployment_properties"
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -3957,7 +3960,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/HostNameBinding_properties"
"$ref": "#/definitions/HostNameBindingProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4021,7 +4024,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/RelayServiceConnectionEntity_properties"
"$ref": "#/definitions/RelayServiceConnectionEntityProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4155,7 +4158,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetInfo_properties"
"$ref": "#/definitions/VnetInfoProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4229,7 +4232,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetGateway_properties"
"$ref": "#/definitions/VnetGatewayProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4293,7 +4296,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetInfo_properties"
"$ref": "#/definitions/VnetInfoProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4367,7 +4370,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetGateway_properties"
"$ref": "#/definitions/VnetGatewayProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4712,7 +4715,7 @@
},
"description": "Specification for using a virtual network"
},
"VnetGateway_properties": {
"VnetGatewayProperties": {
"type": "object",
"properties": {
"vnetName": {
@ -4725,7 +4728,7 @@
}
}
},
"VnetInfo_properties": {
"VnetInfoProperties": {
"type": "object",
"properties": {
"vnetResourceId": {
@ -4811,7 +4814,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/VnetRoute_properties"
"$ref": "#/definitions/VnetRouteProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4824,7 +4827,7 @@
],
"description": "VnetRoute contract used to pass routing information for a vnet."
},
"VnetRoute_properties": {
"VnetRouteProperties": {
"type": "object",
"properties": {
"name": {
@ -4885,7 +4888,7 @@
"properties": {
"oneOf": [
{
"$ref": "#/definitions/WorkerPool_properties"
"$ref": "#/definitions/WorkerPoolProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
@ -4908,7 +4911,7 @@
],
"description": "Worker pool of a hostingEnvironment (App Service Environment)"
},
"WorkerPool_properties": {
"WorkerPoolProperties": {
"type": "object",
"properties": {
"workerSizeId": {

Просмотреть файл

@ -103,12 +103,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [CertificateOrder_properties object](#CertificateOrder_properties) |
| properties | object | Yes | [CertificateOrderProperties object](#CertificateOrderProperties) |
| resources | array | No | [certificates](./certificateOrders/certificates.md) |
<a id="CertificateOrder_properties" />
### CertificateOrder_properties object
<a id="CertificateOrderProperties" />
### CertificateOrderProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| certificates | object | No | State of the Key Vault secret |
@ -139,11 +139,11 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [CertificateDetails_properties object](#CertificateDetails_properties) |
| properties | object | No | [CertificateDetailsProperties object](#CertificateDetailsProperties) |
<a id="CertificateDetails_properties" />
### CertificateDetails_properties object
<a id="CertificateDetailsProperties" />
### CertificateDetailsProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| version | integer | No | Version |

Просмотреть файл

@ -35,11 +35,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [CertificateOrderCertificate_properties object](#CertificateOrderCertificate_properties) |
| properties | object | Yes | [CertificateOrderCertificateProperties object](#CertificateOrderCertificateProperties) |
<a id="CertificateOrderCertificate_properties" />
### CertificateOrderCertificate_properties object
<a id="CertificateOrderCertificateProperties" />
### CertificateOrderCertificateProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| keyVaultId | string | No | Key Vault Csm resource Id |

Просмотреть файл

@ -53,11 +53,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Certificate_properties object](#Certificate_properties) |
| properties | object | Yes | [CertificateProperties object](#CertificateProperties) |
<a id="Certificate_properties" />
### Certificate_properties object
<a id="CertificateProperties" />
### CertificateProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| friendlyName | string | No | Friendly name of the certificate |

Просмотреть файл

@ -39,11 +39,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Csr_properties object](#Csr_properties) |
| properties | object | Yes | [CsrProperties object](#CsrProperties) |
<a id="Csr_properties" />
### Csr_properties object
<a id="CsrProperties" />
### CsrProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name used to locate CSR object |

Просмотреть файл

@ -137,11 +137,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Domain_properties object](#Domain_properties) |
| properties | object | Yes | [DomainProperties object](#DomainProperties) |
<a id="Domain_properties" />
### Domain_properties object
<a id="DomainProperties" />
### DomainProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| contactAdmin | object | No | Admin contact information - [Contact object](#Contact) |

Просмотреть файл

@ -127,18 +127,18 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [HostingEnvironment_properties object](#HostingEnvironment_properties) |
| properties | object | Yes | [HostingEnvironmentProperties object](#HostingEnvironmentProperties) |
| resources | array | No | [workerPools](./hostingEnvironments/workerPools.md) |
<a id="HostingEnvironment_properties" />
### HostingEnvironment_properties object
<a id="HostingEnvironmentProperties" />
### HostingEnvironmentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name of the hostingEnvironment (App Service Environment) |
| location | string | No | Location of the hostingEnvironment (App Service Environment), e.g. "West US" |
| provisioningState | enum | No | Provisioning state of the hostingEnvironment (App Service Environment). - Succeeded, Failed, Canceled, InProgress, Deleting |
| status | enum | No | Current status of the hostingEnvironment (App Service Environment). - Preparing, Ready, Scaling, Deleting |
| status | enum | Yes | Current status of the hostingEnvironment (App Service Environment). - Preparing, Ready, Scaling, Deleting |
| vnetName | string | No | Name of the hostingEnvironment's (App Service Environment) virtual network |
| vnetResourceGroupName | string | No | Resource group of the hostingEnvironment's (App Service Environment) virtual network |
| vnetSubnetName | string | No | Subnet of the hostingEnvironment's (App Service Environment) virtual network |
@ -190,7 +190,7 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [WorkerPool_properties object](#WorkerPool_properties) |
| properties | object | No | [WorkerPoolProperties object](#WorkerPoolProperties) |
| sku | object | No | [SkuDescription object](#SkuDescription) |
@ -242,8 +242,8 @@ The following tables describe the values you need to set in the schema.
| value | string | No | Pair value |
<a id="WorkerPool_properties" />
### WorkerPool_properties object
<a id="WorkerPoolProperties" />
### WorkerPoolProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| workerSizeId | integer | No | Worker size id for referencing this worker pool |

Просмотреть файл

@ -46,12 +46,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [WorkerPool_properties object](#WorkerPool_properties) |
| properties | object | Yes | [WorkerPoolProperties object](#WorkerPoolProperties) |
| sku | object | No | [SkuDescription object](#SkuDescription) |
<a id="WorkerPool_properties" />
### WorkerPool_properties object
<a id="WorkerPoolProperties" />
### WorkerPoolProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| workerSizeId | integer | No | Worker size id for referencing this worker pool |

Просмотреть файл

@ -126,17 +126,17 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [HostingEnvironment_properties object](#HostingEnvironment_properties) |
| properties | object | Yes | [HostingEnvironmentProperties object](#HostingEnvironmentProperties) |
<a id="HostingEnvironment_properties" />
### HostingEnvironment_properties object
<a id="HostingEnvironmentProperties" />
### HostingEnvironmentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name of the hostingEnvironment (App Service Environment) |
| location | string | No | Location of the hostingEnvironment (App Service Environment), e.g. "West US" |
| provisioningState | enum | No | Provisioning state of the hostingEnvironment (App Service Environment). - Succeeded, Failed, Canceled, InProgress, Deleting |
| status | enum | No | Current status of the hostingEnvironment (App Service Environment). - Preparing, Ready, Scaling, Deleting |
| status | enum | Yes | Current status of the hostingEnvironment (App Service Environment). - Preparing, Ready, Scaling, Deleting |
| vnetName | string | No | Name of the hostingEnvironment's (App Service Environment) virtual network |
| vnetResourceGroupName | string | No | Resource group of the hostingEnvironment's (App Service Environment) virtual network |
| vnetSubnetName | string | No | Subnet of the hostingEnvironment's (App Service Environment) virtual network |
@ -188,7 +188,7 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [WorkerPool_properties object](#WorkerPool_properties) |
| properties | object | No | [WorkerPoolProperties object](#WorkerPoolProperties) |
| sku | object | No | [SkuDescription object](#SkuDescription) |
@ -240,8 +240,8 @@ The following tables describe the values you need to set in the schema.
| value | string | No | Pair value |
<a id="WorkerPool_properties" />
### WorkerPool_properties object
<a id="WorkerPoolProperties" />
### WorkerPoolProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| workerSizeId | integer | No | Worker size id for referencing this worker pool |

Просмотреть файл

@ -49,12 +49,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [ServerFarmWithRichSku_properties object](#ServerFarmWithRichSku_properties) |
| properties | object | Yes | [ServerFarmWithRichSkuProperties object](#ServerFarmWithRichSkuProperties) |
| sku | object | No | [SkuDescription object](#SkuDescription) |
<a id="ServerFarmWithRichSku_properties" />
### ServerFarmWithRichSku_properties object
<a id="ServerFarmWithRichSkuProperties" />
### ServerFarmWithRichSkuProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name for the App Service Plan |

Просмотреть файл

@ -34,11 +34,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetGateway_properties object](#VnetGateway_properties) |
| properties | object | Yes | [VnetGatewayProperties object](#VnetGatewayProperties) |
<a id="VnetGateway_properties" />
### VnetGateway_properties object
<a id="VnetGatewayProperties" />
### VnetGatewayProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| vnetName | string | No | The VNET name. |

Просмотреть файл

@ -36,11 +36,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetRoute_properties object](#VnetRoute_properties) |
| properties | object | Yes | [VnetRouteProperties object](#VnetRouteProperties) |
<a id="VnetRoute_properties" />
### VnetRoute_properties object
<a id="VnetRouteProperties" />
### VnetRouteProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | The name of this route. This is only returned by the server and does not need to be set by the client. |

Просмотреть файл

@ -214,12 +214,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Site_properties object](#Site_properties) |
| properties | object | Yes | [SiteProperties object](#SiteProperties) |
| resources | array | No | [hybridconnection](./sites/hybridconnection.md) [premieraddons](./sites/premieraddons.md) [hostNameBindings](./sites/hostNameBindings.md) [deployments](./sites/deployments.md) [slots](./sites/slots.md) [virtualNetworkConnections](./sites/virtualNetworkConnections.md) |
<a id="Site_properties" />
### Site_properties object
<a id="SiteProperties" />
### SiteProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name of web app |
@ -263,7 +263,7 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [SiteConfig_properties object](#SiteConfig_properties) |
| properties | object | No | [SiteConfigProperties object](#SiteConfigProperties) |
<a id="HostingEnvironmentProfile" />
@ -296,8 +296,8 @@ The following tables describe the values you need to set in the schema.
| trafficManagerProfileName | string | No | Name of traffic manager profile to create. This is only needed if traffic manager profile does not already exist |
<a id="SiteConfig_properties" />
### SiteConfig_properties object
<a id="SiteConfigProperties" />
### SiteConfigProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| numberOfWorkers | integer | No | Number of workers |

Просмотреть файл

@ -42,11 +42,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Deployment_properties object](#Deployment_properties) |
| properties | object | Yes | [DeploymentProperties object](#DeploymentProperties) |
<a id="Deployment_properties" />
### Deployment_properties object
<a id="DeploymentProperties" />
### DeploymentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| id | string | No | Id |

Просмотреть файл

@ -39,11 +39,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [HostNameBinding_properties object](#HostNameBinding_properties) |
| properties | object | Yes | [HostNameBindingProperties object](#HostNameBindingProperties) |
<a id="HostNameBinding_properties" />
### HostNameBinding_properties object
<a id="HostNameBindingProperties" />
### HostNameBindingProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Hostname |

Просмотреть файл

@ -39,11 +39,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [RelayServiceConnectionEntity_properties object](#RelayServiceConnectionEntity_properties) |
| properties | object | Yes | [RelayServiceConnectionEntityProperties object](#RelayServiceConnectionEntityProperties) |
<a id="RelayServiceConnectionEntity_properties" />
### RelayServiceConnectionEntity_properties object
<a id="RelayServiceConnectionEntityProperties" />
### RelayServiceConnectionEntityProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| entityName | string | No | |

Просмотреть файл

@ -42,11 +42,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Deployment_properties object](#Deployment_properties) |
| properties | object | Yes | [DeploymentProperties object](#DeploymentProperties) |
<a id="Deployment_properties" />
### Deployment_properties object
<a id="DeploymentProperties" />
### DeploymentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| id | string | No | Id |

Просмотреть файл

@ -214,12 +214,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Site_properties object](#Site_properties) |
| properties | object | Yes | [SiteProperties object](#SiteProperties) |
| resources | array | No | [hybridconnection](./slots/hybridconnection.md) [premieraddons](./slots/premieraddons.md) [hostNameBindings](./slots/hostNameBindings.md) [deployments](./slots/deployments.md) [virtualNetworkConnections](./slots/virtualNetworkConnections.md) |
<a id="Site_properties" />
### Site_properties object
<a id="SiteProperties" />
### SiteProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Name of web app |
@ -263,7 +263,7 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [SiteConfig_properties object](#SiteConfig_properties) |
| properties | object | No | [SiteConfigProperties object](#SiteConfigProperties) |
<a id="HostingEnvironmentProfile" />
@ -296,8 +296,8 @@ The following tables describe the values you need to set in the schema.
| trafficManagerProfileName | string | No | Name of traffic manager profile to create. This is only needed if traffic manager profile does not already exist |
<a id="SiteConfig_properties" />
### SiteConfig_properties object
<a id="SiteConfigProperties" />
### SiteConfigProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| numberOfWorkers | integer | No | Number of workers |

Просмотреть файл

@ -42,11 +42,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Deployment_properties object](#Deployment_properties) |
| properties | object | Yes | [DeploymentProperties object](#DeploymentProperties) |
<a id="Deployment_properties" />
### Deployment_properties object
<a id="DeploymentProperties" />
### DeploymentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| id | string | No | Id |

Просмотреть файл

@ -39,11 +39,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [HostNameBinding_properties object](#HostNameBinding_properties) |
| properties | object | Yes | [HostNameBindingProperties object](#HostNameBindingProperties) |
<a id="HostNameBinding_properties" />
### HostNameBinding_properties object
<a id="HostNameBindingProperties" />
### HostNameBindingProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | Hostname |

Просмотреть файл

@ -39,11 +39,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [RelayServiceConnectionEntity_properties object](#RelayServiceConnectionEntity_properties) |
| properties | object | Yes | [RelayServiceConnectionEntityProperties object](#RelayServiceConnectionEntityProperties) |
<a id="RelayServiceConnectionEntity_properties" />
### RelayServiceConnectionEntity_properties object
<a id="RelayServiceConnectionEntityProperties" />
### RelayServiceConnectionEntityProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| entityName | string | No | |

Просмотреть файл

@ -42,11 +42,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [Deployment_properties object](#Deployment_properties) |
| properties | object | Yes | [DeploymentProperties object](#DeploymentProperties) |
<a id="Deployment_properties" />
### Deployment_properties object
<a id="DeploymentProperties" />
### DeploymentProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| id | string | No | Id |

Просмотреть файл

@ -54,12 +54,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetInfo_properties object](#VnetInfo_properties) |
| properties | object | Yes | [VnetInfoProperties object](#VnetInfoProperties) |
| resources | array | No | [gateways](./virtualNetworkConnections/gateways.md) |
<a id="VnetInfo_properties" />
### VnetInfo_properties object
<a id="VnetInfoProperties" />
### VnetInfoProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| vnetResourceId | string | No | The vnet resource id |
@ -81,11 +81,11 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [VnetRoute_properties object](#VnetRoute_properties) |
| properties | object | No | [VnetRouteProperties object](#VnetRouteProperties) |
<a id="VnetRoute_properties" />
### VnetRoute_properties object
<a id="VnetRouteProperties" />
### VnetRouteProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | The name of this route. This is only returned by the server and does not need to be set by the client. |

Просмотреть файл

@ -34,11 +34,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetGateway_properties object](#VnetGateway_properties) |
| properties | object | Yes | [VnetGatewayProperties object](#VnetGatewayProperties) |
<a id="VnetGateway_properties" />
### VnetGateway_properties object
<a id="VnetGatewayProperties" />
### VnetGatewayProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| vnetName | string | No | The VNET name. |

Просмотреть файл

@ -54,12 +54,12 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetInfo_properties object](#VnetInfo_properties) |
| properties | object | Yes | [VnetInfoProperties object](#VnetInfoProperties) |
| resources | array | No | [gateways](./virtualNetworkConnections/gateways.md) |
<a id="VnetInfo_properties" />
### VnetInfo_properties object
<a id="VnetInfoProperties" />
### VnetInfoProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| vnetResourceId | string | No | The vnet resource id |
@ -81,11 +81,11 @@ The following tables describe the values you need to set in the schema.
| location | string | Yes | Resource Location |
| type | string | No | Resource type |
| tags | object | No | Resource tags |
| properties | object | No | [VnetRoute_properties object](#VnetRoute_properties) |
| properties | object | No | [VnetRouteProperties object](#VnetRouteProperties) |
<a id="VnetRoute_properties" />
### VnetRoute_properties object
<a id="VnetRouteProperties" />
### VnetRouteProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| name | string | No | The name of this route. This is only returned by the server and does not need to be set by the client. |

Просмотреть файл

@ -34,11 +34,11 @@ The following tables describe the values you need to set in the schema.
| kind | string | No | Kind of resource |
| location | string | Yes | Resource Location |
| tags | object | No | Resource tags |
| properties | object | Yes | [VnetGateway_properties object](#VnetGateway_properties) |
| properties | object | Yes | [VnetGatewayProperties object](#VnetGatewayProperties) |
<a id="VnetGateway_properties" />
### VnetGateway_properties object
<a id="VnetGatewayProperties" />
### VnetGatewayProperties object
| Name | Type | Required | Value |
| ---- | ---- | ---- | ---- |
| vnetName | string | No | The VNET name. |

Просмотреть файл

@ -1,131 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Linq;
using AutoRest.Core;
using AutoRest.Core.Utilities;
using Xunit;
using static AutoRest.Core.Utilities.DependencyInjection;
namespace AutoRest.AzureResourceSchema.Tests
{
using AutoRest.Core.Logging;
using AutoRest.Core.Model;
using AutoRest.Modeler;
using AutoRest.Swagger;
using Core.Extensibility;
public static class SwaggerSpecHelper
{
public static void RunTests(string specFile, string resultFolder)
{
using (NewContext)
{
RunTests(
new Settings
{
Input = specFile ?? throw new ArgumentNullException(nameof(specFile)),
Header = "MICROSOFT_MIT_NO_VERSION",
PayloadFlatteningThreshold = 1
},
resultFolder ?? throw new ArgumentNullException(nameof(resultFolder)));
}
}
private static void RunTests(Settings settings, string resultFolder)
{
settings.FileSystemInput = new MemoryFileSystem();
settings.FileSystemInput.CreateDirectory(Path.GetDirectoryName(settings.Input));
settings.FileSystemInput.WriteAllText(settings.Input, File.ReadAllText(settings.Input));
var expectedWithSeparator = "Expected" + Path.DirectorySeparatorChar;
var specFileName = resultFolder.StartsWith(expectedWithSeparator, StringComparison.Ordinal)
? resultFolder.Substring(expectedWithSeparator.Length)
: resultFolder;
var name = "AzureResourceSchema";
settings.Namespace = string.IsNullOrEmpty(settings.Namespace)
? "Fixtures." + (name.Contains("Azure") ? "Azure." : "") + specFileName.
Replace(".cs", "").Replace(".Cs", "").Replace(".java", "").
Replace(".js", "").Replace(".", "").
Replace(Path.DirectorySeparatorChar.ToString(), "").Replace("-", "")
: settings.Namespace;
Generate(settings);
var actualFiles = settings.FileSystemOutput.GetFiles("", "*.*", SearchOption.AllDirectories).OrderBy(f => f).ToArray();
var expectedFiles = Directory.Exists(resultFolder) ? Directory.GetFiles(resultFolder, "*.*", SearchOption.AllDirectories).OrderBy(f => f).ToArray() : new string[0];
Assert.Equal(expectedFiles.Length, actualFiles.Length);
for (int i = 0; i < expectedFiles.Length; i++)
{
var actualFile = actualFiles[i];
var expectedFile = expectedFiles[i];
EnsureFilesMatch(File.ReadAllText(expectedFile), settings.FileSystemOutput.ReadAllText(actualFile));
}
}
private static void Generate(Settings settings)
{
CodeModel codeModel = null;
var modeler = new SwaggerModeler(settings);
try
{
using (NewContext)
{
// generate model from swagger
codeModel = modeler.Build(SwaggerParser.Parse(Settings.Instance.FileSystemInput.ReadAllText(Settings.Instance.Input)));
}
}
catch (Exception exception)
{
throw ErrorManager.CreateError("Error generating client model", exception);
}
var plugin = ExtensionsLoader.GetPlugin("AzureResourceSchema");
try
{
var genericSerializer = new ModelSerializer<CodeModel>();
var modelAsJson = genericSerializer.ToJson(codeModel);
// ensure once we're doing language-specific work, that we're working
// in context provided by the language-specific transformer.
using (plugin.Activate())
{
// load model into language-specific code model
codeModel = plugin.Serializer.Load(modelAsJson);
// apply language-specific tranformation (more than just language-specific types)
// used to be called "NormalizeClientModel" .
codeModel = plugin.Transformer.TransformCodeModel(codeModel);
// Generate code from CodeModel.
plugin.CodeGenerator.Generate(codeModel).GetAwaiter().GetResult();
}
}
catch (Exception exception)
{
throw ErrorManager.CreateError("Error generating client code", exception);
}
}
private static void EnsureFilesMatch(string expectedFileContent, string actualFileContent)
{
char[] wsChars = { '\r', ' ' };
string[] expectedLines = expectedFileContent.Trim().Split('\n').Select(p => p.TrimEnd(wsChars)).ToArray();
string[] actualLines = actualFileContent.Trim().Split('\n').Select(p => p.TrimEnd(wsChars)).ToArray();
Assert.Equal(expectedLines.Length, actualLines.Length);
for (int i = 0; i < expectedLines.Length; i++)
{
Assert.Equal(expectedLines[i], actualLines[i]);
}
}
}
}