Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions generator/autogenlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { postProcessor as mediaPostProcessor } from './processors/Microsoft.Medi
import { postProcessor as networkPostProcessor } from './processors/Microsoft.Network';
import { postProcessor as azureStackHciPostProcessor } from './processors/Microsoft.AzureStackHCI';
import { postProcessor as resourcesPostProcessor } from './processors/Microsoft.Resources';
import { postProcessor as resourcesDeploymentsPostProcessor } from './processors/Microsoft.Resources.Deployments';
import { postProcessor as serviceFabricPostProcessor } from './processors/Microsoft.ServiceFabric';
import { postProcessor as awsConnectorPostProcessor } from './processors/Microsoft.AwsConnector';
import { lowerCaseEquals } from './utils';
Expand Down Expand Up @@ -675,10 +676,6 @@ const autoGenList: AutoGenConfig[] = [
basePath: 'resources/resource-manager',
namespace: 'Microsoft.Resources',
resourceConfig: [
{
type: 'deployments',
scopes: ScopeType.Tenant | ScopeType.ManagementGroup | ScopeType.Subscription | ScopeType.ResourceGroup,
},
{
type: 'tags',
scopes: ScopeType.ManagementGroup | ScopeType.Subscription | ScopeType.ResourceGroup | ScopeType.Extension,
Expand All @@ -690,6 +687,37 @@ const autoGenList: AutoGenConfig[] = [
],
postProcessor: resourcesPostProcessor,
},
{
basePath: 'resources/resource-manager/Microsoft.Resources/deployments',
namespace: 'Microsoft.Resources',
useNamespaceFromConfig: true,
suffix: 'Deployments',
resourceConfig: [
{
type: 'deployments',
scopes: ScopeType.Tenant | ScopeType.ManagementGroup | ScopeType.Subscription | ScopeType.ResourceGroup,
},
],
postProcessor: resourcesDeploymentsPostProcessor,
},
{
basePath: 'resources/resource-manager/Microsoft.Resources/deploymentStacks',
namespace: 'Microsoft.Resources',
useNamespaceFromConfig: true,
suffix: 'DeploymentStacks'
},
{
basePath: 'resources/resource-manager/Microsoft.Resources/deploymentScripts',
namespace: 'Microsoft.Resources',
useNamespaceFromConfig: true,
suffix: 'DeploymentScripts'
},
{
basePath: 'resources/resource-manager/Microsoft.Resources/templateSpecs',
namespace: 'Microsoft.Resources',
useNamespaceFromConfig: true,
suffix: 'TemplateSpecs'
},
{
basePath: 'resources/resource-manager',
namespace: 'Microsoft.Authorization',
Expand Down
42 changes: 42 additions & 0 deletions generator/processors/Microsoft.Resources.Deployments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { SchemaPostProcessor } from '../models';
import { merge } from 'lodash';
import { apiVersionCompare } from '../utils';

const subscriptionProps = {
subscriptionId: {
type: 'string',
description: 'The subscription to deploy to'
},
};

const resourceGroupProps = {
resourceGroup: {
type: 'string',
description: 'The resource group to deploy to',
pattern: '^[-\\w\\._\\(\\)]+$',
maxLength: 90
},
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function appendProps(definition: any, props: any[]) {
if (definition?.properties) {
definition.properties = merge(definition.properties, ...props);
}
}

export const postProcessor: SchemaPostProcessor = async (namespace, apiVersion, schema) => {
appendProps(schema.tenant_resourceDefinitions?.deployments, [subscriptionProps]);
appendProps(schema.managementGroup_resourceDefinitions?.deployments, [subscriptionProps]);
appendProps(schema.subscription_resourceDefinitions?.deployments, [resourceGroupProps]);

if (apiVersionCompare(apiVersion, '2018-05-01') > -1) {
appendProps(schema.resourceDefinitions?.deployments, [subscriptionProps]);
}

if (apiVersionCompare(apiVersion, '2017-05-10') > -1) {
appendProps(schema.resourceDefinitions?.deployments, [resourceGroupProps]);
}
}
36 changes: 0 additions & 36 deletions generator/processors/Microsoft.Resources.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { SchemaPostProcessor } from '../models';
import { merge } from 'lodash';
import { schemasBaseUri } from '../constants';
import { apiVersionCompare } from '../utils';

Expand Down Expand Up @@ -61,42 +60,7 @@ const resourceGroupsDefinition = (apiVersion: string) => ({
description: 'Microsoft.Resources/resourceGroups'
});

const subscriptionProps = {
subscriptionId: {
type: 'string',
description: 'The subscription to deploy to'
},
};

const resourceGroupProps = {
resourceGroup: {
type: 'string',
description: 'The resource group to deploy to',
pattern: '^[-\\w\\._\\(\\)]+$',
maxLength: 90
},
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function appendProps(definition: any, props: any[]) {
if (definition?.properties) {
definition.properties = merge(definition.properties, ...props);
}
}

export const postProcessor: SchemaPostProcessor = async (namespace, apiVersion, schema) => {
appendProps(schema.tenant_resourceDefinitions?.deployments, [subscriptionProps]);
appendProps(schema.managementGroup_resourceDefinitions?.deployments, [subscriptionProps]);
appendProps(schema.subscription_resourceDefinitions?.deployments, [resourceGroupProps]);

if (apiVersionCompare(apiVersion, '2018-05-01') > -1) {
appendProps(schema.resourceDefinitions?.deployments, [subscriptionProps]);
}

if (apiVersionCompare(apiVersion, '2017-05-10') > -1) {
appendProps(schema.resourceDefinitions?.deployments, [resourceGroupProps]);
}

if (apiVersionCompare(apiVersion, '2018-05-01') > -1) {
schema.subscription_resourceDefinitions = schema.subscription_resourceDefinitions ?? {};
schema.subscription_resourceDefinitions['resourceGroups'] = resourceGroupsDefinition(apiVersion);
Expand Down
12 changes: 0 additions & 12 deletions schemas/2014-04-01-preview/deploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -1301,18 +1301,6 @@
{
"$ref": "https://schema.management.azure.com/schemas/2017-06-01/Microsoft.StorSimple.8000.json#/resourceDefinitions/managers_storageAccountCredentials"
},
{
"$ref": "https://schema.management.azure.com/schemas/2016-09-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2017-05-10/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2018-05-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2019-05-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2016-09-01-preview/Microsoft.Solutions.resourcesolutions.json#/resourceDefinitions/applianceDefinitions"
},
Expand Down
32 changes: 0 additions & 32 deletions schemas/2015-01-01/deploymentTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -1539,12 +1539,6 @@
{
"$ref": "https://schema.management.azure.com/schemas/2017-06-01/Microsoft.StorSimple.8000.json#/resourceDefinitions/managers_storageAccountCredentials"
},
{
"$ref": "https://schema.management.azure.com/schemas/2016-09-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2017-05-10/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2016-09-01-preview/Microsoft.Solutions.resourcesolutions.json#/resourceDefinitions/applianceDefinitions"
},
Expand Down Expand Up @@ -4970,32 +4964,6 @@
]
}
]
},
{
"allOf": [
{
"$ref": "#/definitions/ARMResourceBase"
},
{
"oneOf": [
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2016-02-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2018-05-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2019-05-01/Microsoft.Resources.json#/resourceDefinitions/deployments"
},
{
"$ref": "https://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#/resourceDefinitions/links"
}
]
}
]
}
]
},
Expand Down
148 changes: 148 additions & 0 deletions schemas/2015-11-01/Microsoft.Resources.Deployments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"id": "https://schema.management.azure.com/schemas/2015-11-01/Microsoft.Resources.Deployments.json#",
"title": "Microsoft.Resources",
"description": "Microsoft Resources Resource Types",
"$schema": "http://json-schema.org/draft-04/schema#",
"resourceDefinitions": {
"deployments": {
"description": "Microsoft.Resources/deployments",
"properties": {
"apiVersion": {
"enum": [
"2015-11-01"
],
"type": "string"
},
"name": {
"description": "The name of the deployment.",
"type": "string"
},
"properties": {
"description": "Gets or sets the deployment properties.",
"oneOf": [
{
"$ref": "#/definitions/DeploymentProperties"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
},
"type": {
"enum": [
"Microsoft.Resources/deployments"
],
"type": "string"
}
},
"required": [
"name",
"properties",
"apiVersion",
"type"
],
"type": "object"
}
},
"definitions": {
"DeploymentProperties": {
"description": "Deployment properties.",
"properties": {
"mode": {
"description": "Gets or sets the deployment mode.",
"oneOf": [
{
"enum": [
"Incremental",
"Complete"
],
"type": "string"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
},
"parameters": {
"description": "Deployment parameters. Use only one of Parameters or ParametersLink.",
"oneOf": [
{
"type": "object"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
},
"parametersLink": {
"description": "Gets or sets the URI referencing the parameters. Use only one of Parameters or ParametersLink.",
"oneOf": [
{
"$ref": "#/definitions/ParametersLink"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
},
"template": {
"description": "Gets or sets the template content. Use only one of Template or TemplateLink.",
"oneOf": [
{
"type": "object"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
},
"templateLink": {
"description": "Gets or sets the URI referencing the template. Use only one of Template or TemplateLink.",
"oneOf": [
{
"$ref": "#/definitions/TemplateLink"
},
{
"$ref": "https://schema.management.azure.com/schemas/common/definitions.json#/definitions/expression"
}
]
}
},
"type": "object"
},
"ParametersLink": {
"description": "Entity representing the reference to the deployment parameters.",
"properties": {
"contentVersion": {
"description": "If included it must match the ContentVersion in the template.",
"type": "string"
},
"uri": {
"description": "URI referencing the template.",
"type": "string"
}
},
"required": [
"uri"
],
"type": "object"
},
"TemplateLink": {
"description": "Entity representing the reference to the template.",
"properties": {
"contentVersion": {
"description": "If included it must match the ContentVersion in the template.",
"type": "string"
},
"uri": {
"description": "URI referencing the template.",
"type": "string"
}
},
"required": [
"uri"
],
"type": "object"
}
}
}
Loading