diff --git a/DEPLOYMENT_STACKS_WHATIF_MODELS_GUIDE.md b/DEPLOYMENT_STACKS_WHATIF_MODELS_GUIDE.md new file mode 100644 index 000000000000..7b296bfb5432 --- /dev/null +++ b/DEPLOYMENT_STACKS_WHATIF_MODELS_GUIDE.md @@ -0,0 +1,761 @@ +# Deployment Stacks What-If Generated Models Guide + +## Overview +This guide documents the 38+ generated models available in `Resources.Management.Sdk` for implementing Deployment Stacks What-If functionality. These models are auto-generated from the Azure REST API specifications. + +--- + +## Core What-If Models (19 models) + +### 1. **DeploymentStacksWhatIfResult** - Main Result Container +**Purpose**: Top-level result object returned from What-If operations +**Key Properties**: +- `Properties`: `DeploymentStacksWhatIfResultProperties` - Contains all what-if data +- `Location`: `string` - Geo-location of the stack +- `Tags`: `IDictionary` - Resource tags +- `Id`, `Name`, `Type`, `SystemData`: Inherited from `ProxyResource` + +**Usage**: This is returned from SDK operations and should be wrapped in a PS model. + +--- + +### 2. **DeploymentStacksWhatIfResultProperties** - What-If Details +**Purpose**: Contains all the detailed what-if results and parameters +**Key Properties**: + +#### Input/Configuration Properties: +- `Template`: `IDictionary` - Template content +- `TemplateLink`: `DeploymentStacksTemplateLink` - Template URI +- `Parameters`: `IDictionary` - Parameter values +- `ParametersLink`: `DeploymentStacksParametersLink` - Parameters URI +- `ActionOnUnmanage`: `ActionOnUnmanage` - What to do with unmanaged resources +- `DenySettings`: `DenySettings` - Lock settings +- `DeploymentScope`: `string` - Scope for initial deployment +- `Description`: `string` - Stack description (max 4096 chars) +- `DebugSetting`: `DeploymentStacksDebugSetting` - Debug configuration + +#### What-If Result Properties: +- `Changes`: `DeploymentStacksWhatIfChange` - **THE MAIN CHANGES OBJECT** (READ-ONLY) +- `Diagnostics`: `IList` - Warnings/errors (READ-ONLY) +- `Error`: `ErrorDetail` - Error details if operation failed + +#### Comparison Context Properties: +- `DeploymentStackResourceId`: `string` - ID of existing stack to compare against +- `DeploymentStackLastModified`: `DateTime?` - When the comparison stack was last modified (READ-ONLY) +- `RetentionInterval`: `TimeSpan` - How long to persist the result (ISO 8601 format) +- `ProvisioningState`: `string` - State of the stack (READ-ONLY) +- `CorrelationId`: `string` - Correlation ID for tracing (READ-ONLY) +- `ValidationLevel`: `string` - Validation level ('Template', 'Provider', 'ProviderNoRbac') + +**Usage**: Extract `Changes` property for formatting and display to user. + +--- + +### 3. **DeploymentStacksWhatIfChange** - Changes Container +**Purpose**: Contains all predicted changes from the what-if operation +**Key Properties**: +- `ResourceChanges`: `IList` - **REQUIRED** - List of individual resource changes +- `DenySettingsChange`: `DeploymentStacksWhatIfChangeDenySettingsChange` - **REQUIRED** - Changes to deny settings +- `DeploymentScopeChange`: `DeploymentStacksWhatIfChangeDeploymentScopeChange` - Changes to deployment scope (optional) + +**Usage**: +```csharp +// Main iteration point for displaying what-if results +var changes = result.Properties.Changes; +foreach (var resourceChange in changes.ResourceChanges) +{ + // Display each resource change +} +// Display deny settings changes +DisplayDenySettingsChange(changes.DenySettingsChange); +// Display deployment scope changes if present +if (changes.DeploymentScopeChange != null) +{ + DisplayDeploymentScopeChange(changes.DeploymentScopeChange); +} +``` + +--- + +### 4. **DeploymentStacksWhatIfResourceChange** - Individual Resource Change +**Purpose**: Represents a predicted change to a single resource +**Key Properties**: + +#### Resource Identity: +- `Id`: `string` - ARM Resource ID (READ-ONLY) +- `Type`: `string` - Resource type (e.g., "Microsoft.Storage/storageAccounts") (READ-ONLY) +- `ApiVersion`: `string` - API version used (READ-ONLY) +- `SymbolicName`: `string` - Symbolic name from template +- `Identifiers`: `IDictionary` - Extensible identifiers (READ-ONLY) +- `Extension`: `DeploymentExtension` - Extension used for deployment (READ-ONLY) +- `DeploymentId`: `string` - Deployment resource ID + +#### Change Information: +- `ChangeType`: `string` - **REQUIRED** - Type of change ('create', 'delete', 'detach', 'modify', 'noChange', 'unsupported') +- `ChangeCertainty`: `string` - **REQUIRED** - Confidence level ('definite', 'potential') +- `UnsupportedReason`: `string` - Explanation if unsupported + +#### Stack-Specific Changes: +- `ManagementStatusChange`: `DeploymentStacksWhatIfResourceChangeManagementStatusChange` - Changes to managed/unmanaged status +- `DenyStatusChange`: `DeploymentStacksWhatIfResourceChangeDenyStatusChange` - Changes to deny assignments +- `ResourceConfigurationChanges`: `DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges` - Property-level changes + +**Usage**: +```csharp +var resourceChange = changes.ResourceChanges[0]; +string changeType = resourceChange.ChangeType; // "create", "modify", etc. +string certainty = resourceChange.ChangeCertainty; // "definite" or "potential" + +// Check if resource configuration changed +if (resourceChange.ResourceConfigurationChanges != null) +{ + var propertyChanges = resourceChange.ResourceConfigurationChanges.Delta; + // Display property-level changes +} + +// Check management status changes (managed/unmanaged) +if (resourceChange.ManagementStatusChange != null) +{ + var before = resourceChange.ManagementStatusChange.Before; // "managed", "unmanaged", "unknown" + var after = resourceChange.ManagementStatusChange.After; +} + +// Check deny status changes (lock changes) +if (resourceChange.DenyStatusChange != null) +{ + var before = resourceChange.DenyStatusChange.Before; // "denyDelete", "denyWriteAndDelete", etc. + var after = resourceChange.DenyStatusChange.After; +} +``` + +--- + +### 5. **DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges** - Property Changes +**Purpose**: Contains before/after snapshots and property-level changes +**Key Properties**: +- `Before`: `IDictionary` - Full resource state before +- `After`: `IDictionary` - Full resource state after +- `Delta`: `IList` - Individual property changes + +**Usage**: Iterate through `Delta` to display property-by-property changes. + +--- + +### 6. **DeploymentStacksWhatIfPropertyChange** - Individual Property Change +**Purpose**: Represents a single property change (can be nested) +**Key Properties**: +- `Path`: `string` - **REQUIRED** - JSON path to the property (e.g., "properties.ipAddress") +- `ChangeType`: `string` - **REQUIRED** - Change type ('create', 'delete', 'modify', 'noEffect', 'array') +- `Before`: `object` - Value before change +- `After`: `object` - Value after change +- `Children`: `IList` - Nested property changes + +**Usage**: +```csharp +void DisplayPropertyChange(DeploymentStacksWhatIfPropertyChange change, int indent = 0) +{ + WriteLine($"{new string(' ', indent)}{change.Path}: {change.ChangeType}"); + WriteLine($"{new string(' ', indent)} Before: {change.Before}"); + WriteLine($"{new string(' ', indent)} After: {change.After}"); + + // Handle nested changes recursively + if (change.Children != null) + { + foreach (var child in change.Children) + { + DisplayPropertyChange(child, indent + 2); + } + } +} +``` + +--- + +### 7. **DeploymentStacksWhatIfChangeDenySettingsChange** - Deny Settings Changes +**Purpose**: Predicts changes to the deployment stack's deny/lock settings +**Key Properties**: +- `Before`: `DenySettings` - Current deny settings +- `After`: `DenySettings` - Predicted deny settings after operation +- `Delta`: `IList` - Property-level changes + +**Usage**: Display changes to stack-level lock configuration (denyDelete, denyWriteAndDelete, etc.) + +--- + +### 8. **DeploymentStacksWhatIfChangeDeploymentScopeChange** - Scope Changes +**Purpose**: Predicts changes to the deployment scope +**Key Properties**: +- `Before`: `string` - Current deployment scope +- `After`: `string` - Predicted deployment scope after operation + +**Usage**: Display if the deployment scope is changing (e.g., from subscription to resource group) + +--- + +### 9. **DeploymentStacksWhatIfResourceChangeManagementStatusChange** - Management Status Changes +**Purpose**: Predicts if a resource will become managed/unmanaged +**Key Properties**: +- `Before`: `string` - Current status ('managed', 'unmanaged', 'unknown') +- `After`: `string` - Predicted status ('managed', 'unmanaged', 'unknown') + +**Usage**: Show if resource is being added to or removed from stack management. + +--- + +### 10. **DeploymentStacksWhatIfResourceChangeDenyStatusChange** - Deny Status Changes +**Purpose**: Predicts changes to resource-level deny assignments (locks) +**Key Properties**: +- `Before`: `string` - Current deny status +- `After`: `string` - Predicted deny status + +**Possible Values**: +- `denyDelete` - Read and modify allowed, delete blocked +- `denyWriteAndDelete` - Only read allowed +- `notSupported` - Resource type doesn't support deny assignments +- `inapplicable` - Resource outside stack scope +- `removedBySystem` - Removed by Azure (e.g., after management group move) +- `none` - No deny assignments +- `unknown` - Status unknown + +**Usage**: Display resource-level lock changes. + +--- + +### 11. **DeploymentStacksDiagnostic** - Warnings and Errors +**Purpose**: Contains diagnostic messages from the what-if operation +**Key Properties**: +- `Level`: `string` - **REQUIRED** - Severity ('info', 'warning', 'error') +- `Code`: `string` - **REQUIRED** - Error/warning code +- `Message`: `string` - **REQUIRED** - Human-readable message +- `Target`: `string` - What the diagnostic applies to +- `AdditionalInfo`: `IList` - Extra context + +**Usage**: Display warnings and errors to user, grouped by severity. + +--- + +## Enum Models (6 models) + +### 12. **DeploymentStacksWhatIfChangeType** - Resource Change Types +**Purpose**: Defines the type of change for a resource +**Values**: +- `Create` = "create" - Resource will be created +- `Delete` = "delete" - Resource will be deleted +- `Detach` = "detach" - Resource will be detached (removed from stack but kept in Azure) +- `Modify` = "modify" - Resource will be modified +- `NoChange` = "noChange" - Resource will be redeployed but properties won't change +- `Unsupported` = "unsupported" - Resource type not supported by What-If + +**Usage**: Use constants for comparison and color coding in output. + +--- + +### 13. **DeploymentStacksWhatIfPropertyChangeType** - Property Change Types +**Purpose**: Defines the type of change for a property +**Values**: +- `Array` = "array" - Property is an array with nested changes +- `Create` = "create" - Property will be created +- `Delete` = "delete" - Property will be deleted +- `Modify` = "modify" - Property will be modified +- `NoEffect` = "noEffect" - Property will not change + +**Usage**: Use for property-level change display and formatting. + +--- + +### 14. **DeploymentStacksWhatIfChangeCertainty** - Change Confidence Level +**Purpose**: Indicates confidence in the predicted change +**Values**: +- `Definite` = "definite" - Change will definitely occur +- `Potential` = "potential" - Change may occur based on runtime conditions + +**Usage**: Display uncertainty to users (e.g., with "~" prefix for potential changes). + +--- + +### 15. **DeploymentStacksManagementStatus** - Management State +**Purpose**: Indicates if resource is managed by stack +**Values**: +- `Managed` = "managed" - Resource is managed by deployment stack +- `Unmanaged` = "unmanaged" - Resource is not managed +- `Unknown` = "unknown" - Management state unknown + +**Usage**: Use when displaying management status changes. + +--- + +### 16. **DenyStatusMode** - Deny Assignment Status +**Purpose**: Defines the lock/deny assignment status of a resource +**Values**: +- `DenyDelete` = "denyDelete" - Can read/modify, cannot delete +- `DenyWriteAndDelete` = "denyWriteAndDelete" - Can only read +- `NotSupported` = "notSupported" - Resource type doesn't support locks +- `Inapplicable` = "inapplicable" - Resource outside stack scope +- `RemovedBySystem` = "removedBySystem" - Lock removed by Azure +- `None` = "none" - No locks applied +- `Unknown` = "unknown" - Status unknown + +**Usage**: Display resource lock status changes. + +--- + +### 17. **DeploymentStacksDiagnosticLevel** - Diagnostic Severity +**Purpose**: Severity level for diagnostics +**Values**: +- `Info` = "info" +- `Warning` = "warning" +- `Error` = "error" + +**Usage**: Color code diagnostics by severity. + +--- + +## Supporting Models (13+ models) + +### 18. **ActionOnUnmanage** - Unmanaged Resource Behavior +**Key Properties**: +- `Resources`: Action for resources ('delete', 'detach') +- `ResourceGroups`: Action for resource groups ('delete', 'detach') +- `ManagementGroups`: Action for management groups ('delete', 'detach') + +**Usage**: Passed as input parameter; affects what happens to resources removed from template. + +--- + +### 19. **DenySettings** - Lock Configuration +**Key Properties**: +- `Mode`: `string` - Lock mode ('denyDelete', 'denyWriteAndDelete', 'none') +- `ExcludedPrincipals`: `IList` - Principal IDs exempt from locks +- `ExcludedActions`: `IList` - Actions exempt from locks +- `ApplyToChildScopes`: `bool` - Whether locks apply to child scopes + +**Usage**: Configure stack-level locking; compare before/after in deny settings changes. + +--- + +### 20. **DeploymentParameter** - Template Parameter +**Key Properties**: +- `Value`: `object` - Parameter value +- `Reference`: `KeyVaultParameterReference` - Key Vault reference + +**Usage**: Pass template parameters for what-if evaluation. + +--- + +### 21. **DeploymentStacksTemplateLink** - Template URI Reference +**Key Properties**: +- `Uri`: `string` - Template file URI +- `Id`: `string` - Resource ID if using linked template +- `ContentVersion`: `string` - Template version +- `QueryString`: `string` - SAS token or query string + +**Usage**: Reference external template file instead of inline template. + +--- + +### 22. **DeploymentStacksParametersLink** - Parameters URI Reference +**Key Properties**: +- `Uri`: `string` - Parameters file URI +- `ContentVersion`: `string` - Parameters file version + +**Usage**: Reference external parameters file. + +--- + +### 23. **DeploymentStacksDebugSetting** - Debug Configuration +**Key Properties**: +- `DetailLevel`: `string` - Debug level + +**Usage**: Control debugging output during deployment. + +--- + +### 24. **DeploymentExtension** - Extension Information +**Key Properties**: +- `Alias`: `string` - Extension alias +- `ResourceId`: `string` - Extension resource ID + +**Usage**: Identifies which extension deployed a resource (READ-ONLY in results). + +--- + +### 25. **ErrorDetail** - Error Information +**Key Properties**: +- `Code`: `string` - Error code +- `Message`: `string` - Error message +- `Target`: `string` - Error target +- `Details`: `IList` - Nested errors +- `AdditionalInfo`: `IList` - Additional context + +**Usage**: Display errors from failed what-if operations. + +--- + +### 26. **SystemData** - Metadata +**Key Properties**: +- `CreatedBy`: `string` - Who created the resource +- `CreatedAt`: `DateTime?` - When created +- `LastModifiedBy`: `string` - Who last modified +- `LastModifiedAt`: `DateTime?` - When last modified + +**Usage**: Display creation/modification metadata. + +--- + +## HTTP Header Models (6 models) +These are used internally by the SDK for async operations: + +- `DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders` +- `DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders` +- `DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders` +- `DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders` +- `DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders` +- `DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders` + +**Usage**: SDK internal - contain headers like `Location`, `Retry-After`, `Azure-AsyncOperation`. + +--- + +## Models NOT Used for What-If (but related to Deployment Stacks) + +### Other Deployment Stack Models: +- `DeploymentStack` - Actual deployment stack resource (not what-if) +- `DeploymentStackProperties` - Stack properties (not what-if) +- `DeploymentStackProvisioningState` - Stack state enum +- `DeploymentStacksDeleteDetachEnum` - Delete operation modes +- `DeploymentStacksResourcesWithoutDeleteSupportEnum` - Resources that can't be deleted +- `DeploymentStacksError` / `DeploymentStacksErrorException` - Error handling + +--- + +## Implementation Pattern for What-If Cmdlets + +### Step 1: Prepare Request Parameters +```csharp +var parameters = new PSDeploymentStackWhatIfParameters +{ + Template = templateContent, + TemplateLink = templateLink, + Parameters = parameters, + ActionOnUnmanage = actionOnUnmanage, + DenySettings = denySettings, + DeploymentStackResourceId = existingStackId, + RetentionInterval = TimeSpan.FromHours(2) +}; +``` + +### Step 2: Call SDK What-If Operation +```csharp +// In DeploymentStacksSdkClient +var result = DeploymentStacksWhatIfResultsAtResourceGroupOperations + .BeginWhatIfAsync(resourceGroupName, stackName, deploymentStacksWhatIf, cancellationToken) + .GetAwaiter().GetResult(); +``` + +### Step 3: Process the Result +```csharp +// Extract changes from result +var changes = result.Properties.Changes; + +// 3a. Process resource changes +foreach (var resourceChange in changes.ResourceChanges) +{ + switch (resourceChange.ChangeType) + { + case DeploymentStacksWhatIfChangeType.Create: + // Display create operation with Green color + break; + case DeploymentStacksWhatIfChangeType.Delete: + // Display delete operation with Orange/Red color + break; + case DeploymentStacksWhatIfChangeType.Modify: + // Display modify operation with Orange color + // Show property changes from resourceChange.ResourceConfigurationChanges.Delta + break; + case DeploymentStacksWhatIfChangeType.Detach: + // Display detach operation (resource kept but unmanaged) + break; + case DeploymentStacksWhatIfChangeType.NoChange: + // Display no change operation (Gray color) + break; + case DeploymentStacksWhatIfChangeType.Unsupported: + // Display unsupported with reason + break; + } + + // 3b. Display management status changes + if (resourceChange.ManagementStatusChange != null) + { + // Show: "Management Status: unmanaged -> managed" + } + + // 3c. Display deny status changes + if (resourceChange.DenyStatusChange != null) + { + // Show: "Deny Status: none -> denyDelete" + } +} + +// 3d. Display deny settings changes (stack level) +if (changes.DenySettingsChange != null) +{ + // Show stack-level lock configuration changes +} + +// 3e. Display deployment scope changes +if (changes.DeploymentScopeChange != null) +{ + // Show: "Deployment Scope: old -> new" +} +``` + +### Step 4: Display Diagnostics +```csharp +if (result.Properties.Diagnostics != null) +{ + foreach (var diagnostic in result.Properties.Diagnostics) + { + switch (diagnostic.Level) + { + case "error": + // Display in Red + break; + case "warning": + // Display in Yellow + break; + case "info": + // Display normally + break; + } + } +} +``` + +### Step 5: Handle Errors +```csharp +if (result.Properties.Error != null) +{ + // Display error details + var error = result.Properties.Error; + WriteError($"Error {error.Code}: {error.Message}"); + // Recurse through error.Details if present +} +``` + +--- + +## Color Coding Recommendations (Based on Existing Formatter) + +Use the `Color` enum from `ResourceManager.Formatters` for consistent formatting: + +| Change Type | Color | Symbol | +|-------------|-------|--------| +| Create | Green | + | +| Modify | Orange | ~ | +| Delete | Orange/Red | - | +| Detach | Yellow | x | +| NoChange | Grey | = | +| Unsupported | Purple | * | +| Definite | (normal) | | +| Potential | (lighter/italic) | ~ prefix | + +--- + +## Key Differences from Regular Deployment What-If + +Deployment Stacks What-If has **additional concepts** beyond regular deployment what-if: + +1. **Management Status**: Whether resources are managed/unmanaged by the stack +2. **Deny Status**: Resource-level lock status (inherited from stack deny settings) +3. **Detach Operation**: Resources can be detached (removed from stack but kept in Azure) +4. **Stack-Level Changes**: Deny settings and deployment scope are stack-level configurations +5. **ActionOnUnmanage**: Defines behavior for resources removed from template + +--- + +## Complete List of All 38 Generated Models + +### What-If Core (19): +1. ? DeploymentStacksWhatIfResult +2. ? DeploymentStacksWhatIfResultProperties +3. ? DeploymentStacksWhatIfChange +4. ? DeploymentStacksWhatIfResourceChange +5. ? DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges +6. ? DeploymentStacksWhatIfPropertyChange +7. ? DeploymentStacksWhatIfChangeDenySettingsChange +8. ? DeploymentStacksWhatIfChangeDeploymentScopeChange +9. ? DeploymentStacksWhatIfResourceChangeManagementStatusChange +10. ? DeploymentStacksWhatIfResourceChangeDenyStatusChange +11. ? DeploymentStacksWhatIfChangeType (enum) +12. ? DeploymentStacksWhatIfPropertyChangeType (enum) +13. ? DeploymentStacksWhatIfChangeCertainty (enum) +14. ? DeploymentStacksDiagnostic +15. ? DeploymentStacksDiagnosticLevel (enum) +16. ? DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders +17. ? DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders +18. ? DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders +19. ? DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders +20. ? DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders +21. ? DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders + +### Stack Management (17): +22. DeploymentStack +23. DeploymentStackProperties +24. DeploymentStackProvisioningState (enum) +25. DeploymentStacksTemplateLink +26. DeploymentStacksParametersLink +27. DeploymentStacksDebugSetting +28. DeploymentStacksCreateOrUpdateAtManagementGroupHeaders +29. DeploymentStacksCreateOrUpdateAtResourceGroupHeaders +30. DeploymentStacksCreateOrUpdateAtSubscriptionHeaders +31. DeploymentStacksDeleteAtManagementGroupHeaders +32. DeploymentStacksDeleteAtResourceGroupHeaders +33. DeploymentStacksDeleteAtSubscriptionHeaders +34. DeploymentStacksDeleteDetachEnum (enum) +35. DeploymentStacksResourcesWithoutDeleteSupportEnum (enum) +36. DeploymentStacksValidateStackAtManagementGroupHeaders +37. DeploymentStacksValidateStackAtResourceGroupHeaders +38. DeploymentStacksValidateStackAtSubscriptionHeaders + +### Supporting Models (shared): +- DeploymentStacksManagementStatus (enum) +- DenyStatusMode (enum) +- DeploymentStacksError +- DeploymentStacksErrorException + +--- + +## Quick Reference: Most Important Models for What-If Implementation + +### Must Use: +1. **DeploymentStacksWhatIfResult** - Top-level result +2. **DeploymentStacksWhatIfResultProperties** - Contains `.Changes` and `.Diagnostics` +3. **DeploymentStacksWhatIfChange** - Contains `.ResourceChanges`, `.DenySettingsChange`, `.DeploymentScopeChange` +4. **DeploymentStacksWhatIfResourceChange** - Individual resource change with changeType, certainty, and nested changes + +### For Display Logic: +5. **DeploymentStacksWhatIfChangeType** - Use constants for change type comparison +6. **DeploymentStacksWhatIfChangeCertainty** - Display definite vs potential changes differently +7. **DeploymentStacksWhatIfPropertyChange** - Recursive property changes with Before/After + +### For Stack-Specific Features: +8. **DeploymentStacksWhatIfResourceChangeManagementStatusChange** - Show managed/unmanaged status +9. **DeploymentStacksWhatIfResourceChangeDenyStatusChange** - Show lock changes +10. **DeploymentStacksWhatIfChangeDenySettingsChange** - Show stack-level lock changes + +### For Diagnostics: +11. **DeploymentStacksDiagnostic** - Warnings and errors to display + +--- + +## Example Workflow + +```csharp +// 1. SDK returns result +DeploymentStacksWhatIfResult result = await sdkClient.GetWhatIfResultAsync(...); + +// 2. Extract changes +var changes = result.Properties.Changes; + +// 3. Iterate resource changes +foreach (var resourceChange in changes.ResourceChanges) +{ + // Display resource identity + Console.WriteLine($"Resource: {resourceChange.Id}"); + Console.WriteLine($"Type: {resourceChange.Type}"); + + // Display change type with color + string symbol = GetSymbolForChangeType(resourceChange.ChangeType); + Color color = GetColorForChangeType(resourceChange.ChangeType); + ColorWrite($"{symbol} {resourceChange.ChangeType}", color); + + // Display certainty + if (resourceChange.ChangeCertainty == DeploymentStacksWhatIfChangeCertainty.Potential) + { + Console.WriteLine(" [Potential]"); + } + + // Display management status change + if (resourceChange.ManagementStatusChange != null) + { + Console.WriteLine($" Management: {resourceChange.ManagementStatusChange.Before} -> {resourceChange.ManagementStatusChange.After}"); + } + + // Display deny status change + if (resourceChange.DenyStatusChange != null) + { + Console.WriteLine($" Lock: {resourceChange.DenyStatusChange.Before} -> {resourceChange.DenyStatusChange.After}"); + } + + // Display property changes + if (resourceChange.ResourceConfigurationChanges?.Delta != null) + { + foreach (var propChange in resourceChange.ResourceConfigurationChanges.Delta) + { + DisplayPropertyChange(propChange, indent: 2); + } + } +} + +// 4. Display stack-level changes +if (changes.DenySettingsChange != null) +{ + Console.WriteLine("Stack Deny Settings Changes:"); + DisplayDenySettingsChange(changes.DenySettingsChange); +} + +// 5. Display diagnostics +foreach (var diag in result.Properties.Diagnostics ?? Enumerable.Empty()) +{ + var color = GetColorForDiagnosticLevel(diag.Level); + ColorWrite($"{diag.Level.ToUpper()}: {diag.Message}", color); +} +``` + +--- + +## Validation Notes + +All models have `Validate()` methods that check: +- Required properties are not null +- String enums have valid values +- Nested objects are valid + +Call `result.Validate()` to ensure SDK returned valid data. + +--- + +## Comparison with Regular Deployment What-If + +| Feature | Regular Deployment What-If | Deployment Stacks What-If | +|---------|---------------------------|---------------------------| +| Resource Changes | ? WhatIfResourceChange | ? DeploymentStacksWhatIfResourceChange | +| Property Changes | ? WhatIfPropertyChange | ? DeploymentStacksWhatIfPropertyChange | +| Change Types | Create, Delete, Modify, Ignore, Deploy, NoChange | Create, Delete, **Detach**, Modify, NoChange, Unsupported | +| Management Status | ? Not applicable | ? Managed/Unmanaged tracking | +| Deny Status | ? Not applicable | ? Resource-level lock status | +| Stack Deny Settings | ? Not applicable | ? Stack-level lock changes | +| Deployment Scope | ? Not applicable | ? Can change deployment scope | + +--- + +## Summary + +**Total Models**: 38+ in `Resources.Management.Sdk.Generated.Models` + +**For What-If Implementation, you primarily need**: +- **11 core models** for displaying results +- **6 enum models** for constants and comparison +- **6 supporting models** for input parameters and metadata +- **6 header models** for SDK internals (transparent to cmdlet) + +**The flow is**: +1. User provides parameters ? `ActionOnUnmanage`, `DenySettings`, `DeploymentParameter` +2. SDK returns ? `DeploymentStacksWhatIfResult` +3. Extract changes ? `result.Properties.Changes` (type: `DeploymentStacksWhatIfChange`) +4. Iterate resources ? `changes.ResourceChanges` (type: `IList`) +5. Display each change ? Use `ChangeType`, `ChangeCertainty`, property changes, status changes +6. Display diagnostics ? `result.Properties.Diagnostics` +7. Display stack changes ? `changes.DenySettingsChange`, `changes.DeploymentScopeChange` + +The key insight is that **Deployment Stacks What-If extends regular deployment what-if** with management tracking (managed/unmanaged) and deny assignment (lock) tracking at both the resource and stack level. diff --git a/src/Resources/ResourceManager/Formatters/Color.cs b/src/Resources/ResourceManager/Formatters/Color.cs index a9e765c0533f..afa3ed74ead3 100644 --- a/src/Resources/ResourceManager/Formatters/Color.cs +++ b/src/Resources/ResourceManager/Formatters/Color.cs @@ -30,6 +30,8 @@ public class Color : IEquatable public static Color Blue { get; } = new Color($"{Esc}[38;5;39m"); + public static Color Cyan { get; } = new Color($"{Esc}[38;5;51m"); + public static Color Gray { get; } = new Color($"{Esc}[38;5;246m"); public static Color Reset { get; } = new Color($"{Esc}[0m"); diff --git a/src/Resources/ResourceManager/Formatters/ColoredStringBuilder.cs b/src/Resources/ResourceManager/Formatters/ColoredStringBuilder.cs index 9c34a1192f74..afbb8fd1e46b 100644 --- a/src/Resources/ResourceManager/Formatters/ColoredStringBuilder.cs +++ b/src/Resources/ResourceManager/Formatters/ColoredStringBuilder.cs @@ -24,6 +24,8 @@ public class ColoredStringBuilder private readonly Stack colorStack = new Stack(); + private readonly List indentStack = new List(); + public override string ToString() { return stringBuilder.ToString(); @@ -89,6 +91,78 @@ public AnsiColorScope NewColorScope(Color color) return new AnsiColorScope(this, color); } + public void Insert(int index, string value) + { + if (index >= 0 && index <= this.stringBuilder.Length) + { + this.stringBuilder.Insert(index, value); + } + } + + public void InsertLine(int index, string value, Color color) + { + if (color != Color.Reset) + { + this.Insert(index, color.ToString()); + } + this.Insert(index, value + Environment.NewLine); + if (color != Color.Reset) + { + this.Insert(index, Color.Reset.ToString()); + } + } + + public int GetCurrentIndex() + { + return this.stringBuilder.Length; + } + + public void PushIndent(string indent) + { + this.indentStack.Add(indent); + } + + public void PopIndent() + { + if (this.indentStack.Count > 0) + { + this.indentStack.RemoveAt(this.indentStack.Count - 1); + } + } + + public void EnsureNumNewLines(int numNewLines) + { + if (this.stringBuilder.Length == 0) + { + for (int i = 0; i < numNewLines; i++) + { + this.stringBuilder.AppendLine(); + } + return; + } + + string currentText = this.stringBuilder.ToString(); + int existingNewlines = 0; + + for (int i = currentText.Length - 1; i >= 0 && currentText[i] == '\n'; i--) + { + existingNewlines++; + } + + int remainingNewlines = numNewLines - existingNewlines; + for (int i = 0; i < remainingNewlines; i++) + { + this.stringBuilder.AppendLine(); + } + } + + public void Clear() + { + this.stringBuilder.Clear(); + this.colorStack.Clear(); + this.indentStack.Clear(); + } + private void PushColor(Color color) { this.colorStack.Push(color); @@ -101,7 +175,7 @@ private void PopColor() this.stringBuilder.Append(this.colorStack.Count > 0 ? this.colorStack.Peek() : Color.Reset); } - public class AnsiColorScope: IDisposable + public class AnsiColorScope : IDisposable { private readonly ColoredStringBuilder builder; @@ -117,4 +191,4 @@ public void Dispose() } } } -} +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/Formatters/DeploymentStackWhatIfFormatter.cs b/src/Resources/ResourceManager/Formatters/DeploymentStackWhatIfFormatter.cs new file mode 100644 index 000000000000..5696163f3bf3 --- /dev/null +++ b/src/Resources/ResourceManager/Formatters/DeploymentStackWhatIfFormatter.cs @@ -0,0 +1,617 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Formatters +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments; + using Newtonsoft.Json; + + /// + /// Formatter for Deployment Stack What-If operation results. + /// Produces output matching Azure CLI format exactly. + /// + public class DeploymentStackWhatIfFormatter + { + private const int IndentSize = 2; + + private static readonly string[] AllWhatIfTopLevelChangeTypes = new[] + { + "Create", + "Unsupported", + "Modify", + "Delete", + "NoChange", + "Detach" + }; + + private static readonly Dictionary ChangeTypeSymbols = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + { "Array", "~" }, + { "Create", "+" }, + { "Delete", "-" }, + { "Detach", "v" }, + { "Modify", "~" }, + { "NoChange", "=" }, + { "NoEffect", "=" }, + { "Unsupported", "!" } + }; + + private static readonly Dictionary ChangeTypeColors = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + { "Array", Color.Purple }, + { "Create", Color.Green }, + { "Delete", Color.Red }, + { "Detach", Color.Blue }, + { "Modify", Color.Purple } + }; + + private readonly ColoredStringBuilder builder; + private PSDeploymentStackWhatIfResult whatIfResult; + private DeploymentStackWhatIfProperties whatIfProps; + private DeploymentStackWhatIfChanges whatIfChanges; + + public DeploymentStackWhatIfFormatter(ColoredStringBuilder builder) + { + this.builder = builder ?? new ColoredStringBuilder(); + } + + /// + /// Formats a Deployment Stack What-If result. + /// + public static string Format(PSDeploymentStackWhatIfResult result) + { + if (result == null) + { + return null; + } + + var builder = new ColoredStringBuilder(); + var formatter = new DeploymentStackWhatIfFormatter(builder); + + return formatter.FormatInternal(result); + } + + private string FormatInternal(PSDeploymentStackWhatIfResult result) + { + this.whatIfResult = result; + this.whatIfProps = result.Properties; + this.whatIfChanges = this.whatIfProps?.Changes; + + if (FormatChangeTypeLegend()) + { + this.builder.EnsureNumNewLines(2); + } + + if (FormatStackChanges()) + { + this.builder.EnsureNumNewLines(2); + } + + if (FormatResourceChangesAndDeletionSummary()) + { + this.builder.EnsureNumNewLines(2); + } + + FormatDiagnostics(); + + string output = this.builder.ToString(); + + this.whatIfResult = null; + this.whatIfProps = null; + this.whatIfChanges = null; + + return output; + } + + private bool FormatChangeTypeLegend() + { + const int changeTypeMaxLength = 20; + + this.builder.AppendLine("Resource and property changes are indicated with these symbols:"); + this.builder.PushIndent(new string(' ', IndentSize)); + + for (int i = 0; i < AllWhatIfTopLevelChangeTypes.Length; i++) + { + string changeType = AllWhatIfTopLevelChangeTypes[i]; + var (symbol, color) = GetChangeTypeFormatting(changeType); + + this.builder.Append(symbol, color).Append(" "); + this.builder.Append(changeType.PadRight(changeTypeMaxLength - symbol.Length)); + + if (i % 2 == 0 && i < AllWhatIfTopLevelChangeTypes.Length - 1) + { + this.builder.Append(" "); + } + else if (i < AllWhatIfTopLevelChangeTypes.Length - 1) + { + this.builder.AppendLine(); + } + } + + this.builder.PopIndent(); + this.builder.AppendLine(); + + return true; + } + + private bool FormatStackChanges() + { + if (this.whatIfChanges == null) + { + return false; + } + + bool printed = false; + int titleIndex = this.builder.GetCurrentIndex(); + + if (this.whatIfChanges.DeploymentScopeChange != null) + { + if (FormatPrimitiveChange(this.whatIfChanges.DeploymentScopeChange, "DeploymentScope")) + { + printed = true; + } + } + + if (this.whatIfChanges.DenySettingsChange != null) + { + if (FormatDenySettingsChange(this.whatIfChanges.DenySettingsChange)) + { + printed = true; + } + } + + if (printed) + { + this.builder.InsertLine(titleIndex, + $"Changes to Stack {this.whatIfProps.DeploymentStackResourceId}:", + Color.DarkYellow); + } + + return printed; + } + + private bool FormatDenySettingsChange(DeploymentStackChangeDeltaRecord denySettingsChange) + { + if (denySettingsChange?.Delta == null || denySettingsChange.Delta.Count == 0) + { + return false; + } + + bool printed = false; + + foreach (var change in denySettingsChange.Delta) + { + string fullPath = $"DenySettings.{change.Path}"; + + if (string.Equals(change.ChangeType, "Array", StringComparison.OrdinalIgnoreCase)) + { + if (FormatArrayChange(change, fullPath)) + { + printed = true; + } + } + else + { + if (FormatPrimitiveChange(change, fullPath)) + { + printed = true; + } + } + } + + return printed; + } + + private bool FormatArrayChange(DeploymentStackPropertyChange arrayChange, string path) + { + var (symbol, color) = GetChangeTypeFormatting("Modify"); + + this.builder.Append(symbol, color).Append(" ").Append(path).AppendLine(": ", color); + this.builder.PushIndent(new string(' ', IndentSize)); + + if (arrayChange.Children != null && arrayChange.Children.Count > 0) + { + bool hasIndices = arrayChange.Children.All(c => !string.IsNullOrEmpty(c.Path)); + + var sortedChildren = hasIndices + ? arrayChange.Children.OrderBy(c => int.TryParse(c.Path, out int idx) ? idx : int.MaxValue).ToList() + : arrayChange.Children.ToList(); + + foreach (var child in sortedChildren) + { + if (hasIndices) + { + var (childSymbol, childColor) = GetChangeTypeFormatting(child.ChangeType); + this.builder.Append(childSymbol, childColor).AppendLine($" {child.Path}:"); + this.builder.PushIndent(new string(' ', IndentSize)); + + FormatPrimitiveValue(child); + + this.builder.PopIndent(); + } + else + { + FormatPrimitiveValue(child); + } + } + } + + this.builder.PopIndent(); + + return true; + } + + private void FormatPrimitiveValue(DeploymentStackPropertyChange change) + { + var (symbol, color) = GetChangeTypeFormatting(change.ChangeType); + this.builder.Append(symbol, color).Append(" ").AppendLine(FormatValue(change.After), color); + } + + private bool FormatResourceChangesAndDeletionSummary() + { + if (this.whatIfChanges?.ResourceChanges == null || this.whatIfChanges.ResourceChanges.Count == 0) + { + return false; + } + + bool printed = false; + var resourceChangesSorted = SortResourceChanges(this.whatIfChanges.ResourceChanges); + + if (FormatResourceChanges(resourceChangesSorted)) + { + printed = true; + } + + if (FormatResourceDeletionsSummary(resourceChangesSorted)) + { + printed = true; + } + + return printed; + } + + private List SortResourceChanges( + IList resourceChanges) + { + return resourceChanges + .OrderBy(x => string.IsNullOrEmpty(x.Id) ? 1 : 0) + .ThenBy(x => GetChangeCertaintyPriority(x.ChangeCertainty)) + .ThenBy(x => x.Id?.ToLowerInvariant() ?? "") + .ThenBy(x => x.Extension?.Name ?? "") + .ThenBy(x => x.Extension?.Version ?? "") + .ToList(); + } + + private int GetChangeCertaintyPriority(string certainty) + { + return string.Equals(certainty, "Definite", StringComparison.OrdinalIgnoreCase) ? 0 : 1; + } + + private bool FormatResourceChanges(List resourceChangesSorted) + { + if (resourceChangesSorted == null || resourceChangesSorted.Count == 0) + { + return false; + } + + this.builder.AppendLine("Changes to Managed Resources:", Color.DarkYellow); + this.builder.AppendLine(); + + string lastGroup = null; + bool hasPotentialChanges = false; + + foreach (var change in resourceChangesSorted) + { + string group = FormatResourceClassHeader(change); + + if (group != lastGroup) + { + lastGroup = group; + hasPotentialChanges = false; + this.builder.AppendLine(group); + } + + if (!hasPotentialChanges && + string.Equals(change.ChangeCertainty, "Potential", StringComparison.OrdinalIgnoreCase)) + { + this.builder.Append(">> ").AppendLine( + "Potential Resource Changes (Learn more at https://aka.ms/whatIfPotentialChanges)", + Color.Purple); + hasPotentialChanges = true; + } + + FormatResourceChange(change); + } + + return true; + } + + private void FormatResourceChange(DeploymentStackResourceChange resourceChange) + { + FormatResourceHeadingLine(resourceChange); + + this.builder.PushIndent(new string(' ', IndentSize)); + + if (resourceChange.ManagementStatusChange != null) + { + FormatPrimitiveChange(resourceChange.ManagementStatusChange, "Management Status"); + } + + if (resourceChange.DenyStatusChange != null) + { + FormatPrimitiveChange(resourceChange.DenyStatusChange, "Deny Status"); + } + + if (resourceChange.ResourceConfigurationChanges?.Delta != null) + { + foreach (var delta in resourceChange.ResourceConfigurationChanges.Delta) + { + FormatPrimitiveChange(delta, delta.Path); + } + } + + this.builder.PopIndent(); + } + + private void FormatResourceHeadingLine(DeploymentStackResourceChange resourceChange) + { + var (symbol, color) = GetChangeTypeFormatting(resourceChange.ChangeType); + bool isPotential = string.Equals(resourceChange.ChangeCertainty, "Potential", StringComparison.OrdinalIgnoreCase); + + if (isPotential) + { + this.builder.Append("?", Color.Cyan); + } + + this.builder.Append(symbol, color).Append(" "); + + if (isPotential) + { + this.builder.Append("[Potential] ", Color.Cyan); + } + + string resourceId = !string.IsNullOrEmpty(resourceChange.Id) + ? resourceChange.Id + : $"{resourceChange.Type} {FormatExtResourceIdentifiers(resourceChange.Identifiers)}"; + + this.builder.AppendLine(resourceId, color); + } + + private bool FormatResourceDeletionsSummary(List resourceChangesSorted) + { + var deleteChanges = resourceChangesSorted + .Where(x => string.Equals(x.ChangeType, "Delete", StringComparison.OrdinalIgnoreCase)) + .ToList(); + + if (deleteChanges.Count == 0) + { + return false; + } + + this.builder.Append("Deleting - ", Color.Red); + this.builder.AppendLine($"Resources Marked for Deletion {deleteChanges.Count} total:"); + this.builder.AppendLine(); + + string lastGroup = null; + bool hasPotentialDeletions = false; + + foreach (var change in deleteChanges) + { + string group = FormatResourceClassHeader(change); + + if (group != lastGroup) + { + lastGroup = group; + hasPotentialDeletions = false; + this.builder.AppendLine(group); + } + + if (!hasPotentialDeletions && + string.Equals(change.ChangeCertainty, "Potential", StringComparison.OrdinalIgnoreCase)) + { + int numPotential = deleteChanges.Skip(deleteChanges.IndexOf(change)) + .TakeWhile(c => string.Equals(c.ChangeCertainty, "Potential", StringComparison.OrdinalIgnoreCase)) + .Count(); + + this.builder.Append(">> ").AppendLine( + $"Potential Deletions {numPotential} total (Learn more at https://aka.ms/whatIfPotentialChanges)", + Color.Red); + hasPotentialDeletions = true; + } + + FormatResourceHeadingLine(change); + } + + return true; + } + + private void FormatDiagnostics() + { + if (this.whatIfProps?.Diagnostics == null || this.whatIfProps.Diagnostics.Count == 0) + { + return; + } + + var diagnosticsSorted = this.whatIfProps.Diagnostics + .OrderBy(x => GetDiagnosticLevelPriority(x.Level)) + .ThenBy(x => x.Code ?? "") + .ToList(); + + this.builder.AppendLine($"Diagnostics ({diagnosticsSorted.Count}):"); + + foreach (var diagnostic in diagnosticsSorted) + { + Color color = GetDiagnosticColor(diagnostic.Level); + this.builder.AppendLine( + $"{diagnostic.Level?.ToUpperInvariant()}: [{diagnostic.Code}] {diagnostic.Message}", + color); + } + } + + private bool FormatPrimitiveChange(object change, string path) + { + var baseChange = change as DeploymentStackChangeBase; + var propertyChange = change as DeploymentStackPropertyChange; + + if (baseChange == null && propertyChange == null) + { + return false; + } + + object before = baseChange?.Before ?? propertyChange?.Before; + object after = baseChange?.After ?? propertyChange?.After; + string changeType = baseChange?.ChangeType ?? propertyChange?.ChangeType; + + if (changeType == null) + { + changeType = Equals(before, after) ? "NoEffect" : "Modify"; + } + + var (symbol, color) = GetChangeTypeFormatting(changeType); + + this.builder.Append(symbol, color).Append(" "); + this.builder.Append(path).Append(": "); + + if (string.Equals(changeType, "Modify", StringComparison.OrdinalIgnoreCase)) + { + this.builder.AppendLine($"{FormatValue(before)} => {FormatValue(after)}", color); + } + else + { + object value = string.Equals(changeType, "Delete", StringComparison.OrdinalIgnoreCase) ? before : after; + this.builder.AppendLine(FormatValue(value)); + } + + return true; + } + + private static string FormatValue(object value) + { + if (value == null) + { + return "null"; + } + + if (value is string strValue) + { + return $"\"{strValue}\""; + } + + if (value is bool boolValue) + { + return $"\"{(boolValue ? "True" : "False")}\""; + } + + return value.ToString(); + } + + private static (string symbol, Color color) GetChangeTypeFormatting(string changeType) + { + if (changeType == null) + { + return (null, Color.Reset); + } + + string symbol = ChangeTypeSymbols.GetValueOrDefault(changeType, "?"); + Color color = ChangeTypeColors.GetValueOrDefault(changeType, Color.Reset); + + return (symbol, color); + } + + private static string FormatResourceClassHeader(DeploymentStackResourceChange change) + { + if (!string.IsNullOrEmpty(change.Id)) + { + return "Azure"; + } + + if (change.Extension == null) + { + return "Unknown"; + } + + string result = $"{change.Extension.Name}@{change.Extension.Version}"; + + if (change.Extension.Config != null && change.Extension.Config.Count > 0) + { + var configParts = new List(); + + foreach (var kvp in change.Extension.Config.OrderBy(c => c.Value?.KeyVaultReference != null).ThenBy(c => c.Key)) + { + if (kvp.Value == null) + { + continue; + } + + if (kvp.Value.KeyVaultReference != null) + { + string secretName = kvp.Value.KeyVaultReference.SecretName; + string secretVersion = kvp.Value.KeyVaultReference.SecretVersion; + string kvId = kvp.Value.KeyVaultReference.KeyVault?.Id; + string versionSuffix = !string.IsNullOrEmpty(secretVersion) ? $"@{secretVersion}" : ""; + + configParts.Add($"{kvp.Key}="); + } + else if (kvp.Value.Value != null) + { + string jsonValue = JsonConvert.SerializeObject(kvp.Value.Value); + configParts.Add($"{kvp.Key}={jsonValue}"); + } + } + + if (configParts.Count > 0) + { + result += $" {string.Join(", ", configParts)}"; + } + } + + return result; + } + + private static string FormatExtResourceIdentifiers(IDictionary identifiers) + { + if (identifiers == null || identifiers.Count == 0) + { + return string.Empty; + } + + return string.Join(", ", identifiers.OrderBy(kvp => kvp.Key) + .Select(kvp => $"{kvp.Key}={JsonConvert.SerializeObject(kvp.Value)}")); + } + + private static int GetDiagnosticLevelPriority(string level) + { + return level?.ToLowerInvariant() switch + { + "info" => 1, + "warning" => 2, + "error" => 3, + _ => 0 + }; + } + + private static Color GetDiagnosticColor(string level) + { + return level?.ToLowerInvariant() switch + { + "warning" => Color.DarkYellow, + "error" => Color.Red, + _ => Color.Reset + }; + } + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStackWhatIfCmdlet.cs b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStackWhatIfCmdlet.cs new file mode 100644 index 000000000000..d3c4decfb984 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStackWhatIfCmdlet.cs @@ -0,0 +1,69 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase +{ + using System; + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments; + + /// + /// Base class for Deployment Stack What-If cmdlets. + /// + public abstract class DeploymentStackWhatIfCmdlet : DeploymentStacksCreateCmdletBase + { + /// + /// It's important not to call this function more than once during an invocation, as it can call the Bicep CLI. + /// This is slow, and can also cause diagnostics to be emitted multiple times. + /// + protected abstract PSDeploymentStackWhatIfParameters BuildWhatIfParameters(); + + protected override void OnProcessRecord() + { + PSDeploymentStackWhatIfResult whatIfResult = this.ExecuteWhatIf(); + + // The ToString() method on PSDeploymentStackWhatIfResult calls the formatter + this.WriteObject(whatIfResult); + } + + protected PSDeploymentStackWhatIfResult ExecuteWhatIf() + { + const string statusMessage = "Getting the latest status of all resources..."; + var clearMessage = new string(' ', statusMessage.Length); + var information = new HostInformationMessage { Message = statusMessage, NoNewLine = true }; + var clearInformation = new HostInformationMessage { Message = $"\r{clearMessage}\r", NoNewLine = true }; + var tags = new[] { "PSHOST" }; + + try + { + // Write status message. + this.WriteInformation(information, tags); + + var parameters = this.BuildWhatIfParameters(); + var whatIfResult = DeploymentStacksSdkClient.ExecuteDeploymentStackWhatIf(parameters); + + // Clear status before returning result. + this.WriteInformation(clearInformation, tags); + + return whatIfResult; + } + catch (Exception) + { + // Clear status on exception. + this.WriteInformation(clearInformation, tags); + throw; + } + } + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStacksCmdletBase.cs b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStacksCmdletBase.cs index 2b275d0edb58..067d28b6289b 100644 --- a/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStacksCmdletBase.cs +++ b/src/Resources/ResourceManager/Implementation/CmdletBase/DeploymentStacksCmdletBase.cs @@ -16,6 +16,7 @@ using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities; using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; diff --git a/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzManagementGroupDeploymentStackWhatIf.cs b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzManagementGroupDeploymentStackWhatIf.cs new file mode 100644 index 000000000000..7386e5df4b72 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzManagementGroupDeploymentStackWhatIf.cs @@ -0,0 +1,107 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.DeploymentStacks +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks; + using Microsoft.Azure.Commands.ResourceManager.Common; + + /// + /// Cmdlet to preview changes for a Management Group Deployment Stack. + /// + [Cmdlet("Get", AzureRMConstants.AzureRMPrefix + "ManagementGroupDeploymentStackWhatIf", + DefaultParameterSetName = ParameterlessTemplateFileParameterSetName)] + [OutputType(typeof(PSDeploymentStackWhatIfResult))] + public class GetAzManagementGroupDeploymentStackWhatIf : DeploymentStackWhatIfCmdlet + { + #region Cmdlet Parameters + + [Alias("StackName")] + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The name of the DeploymentStack to preview changes for.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The ID of the target management group.")] + [ValidateNotNullOrEmpty] + public string ManagementGroupId { get; set; } + + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The location to store deployment data.")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "Description for the stack.")] + public string Description { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "The scope for the deployment stack. Determines where managed resources can be deployed.")] + public string DeploymentScope { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Action to take on resources that become unmanaged. Possible values include: " + + "'detachAll', 'deleteResources', and 'deleteAll'.")] + public PSActionOnUnmanage ActionOnUnmanage { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Mode for DenySettings. Possible values include: 'denyDelete', 'denyWriteAndDelete', and 'none'.")] + public PSDenySettingsMode DenySettingsMode { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of AAD principal IDs excluded from the lock. Up to 5 principals are permitted.")] + public string[] DenySettingsExcludedPrincipal { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of role-based management operations excluded from the denySettings. Up to 200 actions are permitted.")] + public string[] DenySettingsExcludedAction { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Apply to child scopes.")] + public SwitchParameter DenySettingsApplyToChildScopes { get; set; } + + #endregion + + #region Cmdlet Implementation + + protected override PSDeploymentStackWhatIfParameters BuildWhatIfParameters() + { + var shouldDeleteResources = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll || ActionOnUnmanage is PSActionOnUnmanage.DeleteResources); + var shouldDeleteResourceGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + var shouldDeleteManagementGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + + return new PSDeploymentStackWhatIfParameters + { + StackName = Name, + ManagementGroupId = ManagementGroupId, + Location = Location, + TemplateFile = TemplateFile, + TemplateUri = !string.IsNullOrEmpty(protectedTemplateUri) ? protectedTemplateUri : TemplateUri, + TemplateSpecId = TemplateSpecId, + TemplateObject = TemplateObject, + TemplateParameterUri = TemplateParameterUri, + TemplateParameterObject = GetTemplateParameterObject(), + Description = Description, + DeploymentScope = DeploymentScope, + ResourcesCleanupAction = shouldDeleteResources ? "delete" : "detach", + ResourceGroupsCleanupAction = shouldDeleteResourceGroups ? "delete" : "detach", + ManagementGroupsCleanupAction = shouldDeleteManagementGroups ? "delete" : "detach", + DenySettingsMode = DenySettingsMode != 0 ? DenySettingsMode.ToString() : null, + DenySettingsExcludedPrincipals = DenySettingsExcludedPrincipal, + DenySettingsExcludedActions = DenySettingsExcludedAction, + DenySettingsApplyToChildScopes = DenySettingsApplyToChildScopes.IsPresent + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzResourceGroupDeploymentStackWhatIf.cs b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzResourceGroupDeploymentStackWhatIf.cs new file mode 100644 index 000000000000..3abc5abcf3ed --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzResourceGroupDeploymentStackWhatIf.cs @@ -0,0 +1,99 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.DeploymentStacks +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks; + using Microsoft.Azure.Commands.ResourceManager.Common; + using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; + + /// + /// Cmdlet to preview changes for a Resource Group Deployment Stack. + /// + [Cmdlet("Get", AzureRMConstants.AzureRMPrefix + "ResourceGroupDeploymentStackWhatIf", + DefaultParameterSetName = ParameterlessTemplateFileParameterSetName)] + [OutputType(typeof(PSDeploymentStackWhatIfResult))] + public class GetAzResourceGroupDeploymentStackWhatIf : DeploymentStackWhatIfCmdlet + { + #region Cmdlet Parameters + + [Alias("StackName")] + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The name of the DeploymentStack to preview changes for.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The name of the ResourceGroup.")] + [ResourceGroupCompleter] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "Description for the stack.")] + public string Description { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Action to take on resources that become unmanaged. Possible values include: " + + "'detachAll', 'deleteResources', and 'deleteAll'.")] + public PSActionOnUnmanage ActionOnUnmanage { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Mode for DenySettings. Possible values include: 'denyDelete', 'denyWriteAndDelete', and 'none'.")] + public PSDenySettingsMode DenySettingsMode { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of AAD principal IDs excluded from the lock. Up to 5 principals are permitted.")] + public string[] DenySettingsExcludedPrincipal { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of role-based management operations excluded from the denySettings. Up to 200 actions are permitted.")] + public string[] DenySettingsExcludedAction { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Apply to child scopes.")] + public SwitchParameter DenySettingsApplyToChildScopes { get; set; } + + #endregion + + #region Cmdlet Implementation + + protected override PSDeploymentStackWhatIfParameters BuildWhatIfParameters() + { + var shouldDeleteResources = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll || ActionOnUnmanage is PSActionOnUnmanage.DeleteResources); + var shouldDeleteResourceGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + var shouldDeleteManagementGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + + return new PSDeploymentStackWhatIfParameters + { + StackName = Name, + ResourceGroupName = ResourceGroupName, + TemplateFile = TemplateFile, + TemplateUri = !string.IsNullOrEmpty(protectedTemplateUri) ? protectedTemplateUri : TemplateUri, + TemplateSpecId = TemplateSpecId, + TemplateObject = TemplateObject, + TemplateParameterUri = TemplateParameterUri, + TemplateParameterObject = GetTemplateParameterObject(), + Description = Description, + ResourcesCleanupAction = shouldDeleteResources ? "delete" : "detach", + ResourceGroupsCleanupAction = shouldDeleteResourceGroups ? "delete" : "detach", + ManagementGroupsCleanupAction = shouldDeleteManagementGroups ? "delete" : "detach", + DenySettingsMode = DenySettingsMode != 0 ? DenySettingsMode.ToString() : null, + DenySettingsExcludedPrincipals = DenySettingsExcludedPrincipal, + DenySettingsExcludedActions = DenySettingsExcludedAction, + DenySettingsApplyToChildScopes = DenySettingsApplyToChildScopes.IsPresent + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzSubscriptionDeploymentStackWhatIf.cs b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzSubscriptionDeploymentStackWhatIf.cs new file mode 100644 index 000000000000..7b52d2f21975 --- /dev/null +++ b/src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzSubscriptionDeploymentStackWhatIf.cs @@ -0,0 +1,101 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.DeploymentStacks +{ + using System.Management.Automation; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.CmdletBase; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks; + using Microsoft.Azure.Commands.ResourceManager.Common; + + /// + /// Cmdlet to preview changes for a Subscription Deployment Stack. + /// + [Cmdlet("Get", AzureRMConstants.AzureRMPrefix + "SubscriptionDeploymentStackWhatIf", + DefaultParameterSetName = ParameterlessTemplateFileParameterSetName)] + [OutputType(typeof(PSDeploymentStackWhatIfResult))] + public class GetAzSubscriptionDeploymentStackWhatIf : DeploymentStackWhatIfCmdlet + { + #region Cmdlet Parameters + + [Alias("StackName")] + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The name of the DeploymentStack to preview changes for.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The location to store deployment data.")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "Description for the stack.")] + public string Description { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "The scope for the deployment stack. Determines where managed resources can be deployed.")] + public string DeploymentScope { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Action to take on resources that become unmanaged. Possible values include: " + + "'detachAll', 'deleteResources', and 'deleteAll'.")] + public PSActionOnUnmanage ActionOnUnmanage { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Mode for DenySettings. Possible values include: 'denyDelete', 'denyWriteAndDelete', and 'none'.")] + public PSDenySettingsMode DenySettingsMode { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of AAD principal IDs excluded from the lock. Up to 5 principals are permitted.")] + public string[] DenySettingsExcludedPrincipal { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "List of role-based management operations excluded from the denySettings. Up to 200 actions are permitted.")] + public string[] DenySettingsExcludedAction { get; set; } + + [Parameter(Mandatory = false, HelpMessage = "Apply to child scopes.")] + public SwitchParameter DenySettingsApplyToChildScopes { get; set; } + + #endregion + + #region Cmdlet Implementation + + protected override PSDeploymentStackWhatIfParameters BuildWhatIfParameters() + { + var shouldDeleteResources = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll || ActionOnUnmanage is PSActionOnUnmanage.DeleteResources); + var shouldDeleteResourceGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + var shouldDeleteManagementGroups = (ActionOnUnmanage is PSActionOnUnmanage.DeleteAll); + + return new PSDeploymentStackWhatIfParameters + { + StackName = Name, + Location = Location, + TemplateFile = TemplateFile, + TemplateUri = !string.IsNullOrEmpty(protectedTemplateUri) ? protectedTemplateUri : TemplateUri, + TemplateSpecId = TemplateSpecId, + TemplateObject = TemplateObject, + TemplateParameterUri = TemplateParameterUri, + TemplateParameterObject = GetTemplateParameterObject(), + Description = Description, + DeploymentScope = DeploymentScope, + ResourcesCleanupAction = shouldDeleteResources ? "delete" : "detach", + ResourceGroupsCleanupAction = shouldDeleteResourceGroups ? "delete" : "detach", + ManagementGroupsCleanupAction = shouldDeleteManagementGroups ? "delete" : "detach", + DenySettingsMode = DenySettingsMode != 0 ? DenySettingsMode.ToString() : null, + DenySettingsExcludedPrincipals = DenySettingsExcludedPrincipal, + DenySettingsExcludedActions = DenySettingsExcludedAction, + DenySettingsApplyToChildScopes = DenySettingsApplyToChildScopes.IsPresent + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/ResourceManager.csproj b/src/Resources/ResourceManager/ResourceManager.csproj index a6ccd8aeed9b..77f807bc33f3 100644 --- a/src/Resources/ResourceManager/ResourceManager.csproj +++ b/src/Resources/ResourceManager/ResourceManager.csproj @@ -1,44 +1,48 @@ - - Resources - - - - - - $(AzAssemblyPrefix)ResourceManager - $(LegacyAssemblyPrefix)ResourceManager.Cmdlets - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - - + + Resources + + + + + + $(AzAssemblyPrefix)ResourceManager + $(LegacyAssemblyPrefix)ResourceManager.Cmdlets + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + \ No newline at end of file diff --git a/src/Resources/ResourceManager/SdkClient/DeploymentStacksSdkClient.cs b/src/Resources/ResourceManager/SdkClient/DeploymentStacksSdkClient.cs index 6135e11e029b..8f0e41760858 100644 --- a/src/Resources/ResourceManager/SdkClient/DeploymentStacksSdkClient.cs +++ b/src/Resources/ResourceManager/SdkClient/DeploymentStacksSdkClient.cs @@ -16,6 +16,7 @@ using System.Collections; using System.Collections.Generic; using System.Text; +using System.Threading; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components; @@ -35,6 +36,9 @@ using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Json; using Microsoft.WindowsAzure.Commands.Common; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient { @@ -84,13 +88,34 @@ private NewResourceManagerSdkClient ResourceManagerSdkClient set { this.resourceManagerSdkClient = value; } } + /// + /// Field that holds the ARM client instance for Track 2 SDK + /// + private ArmClient armClient; + + /// + /// Gets the ARM client for Track 2 SDK operations (e.g., What-If) + /// + private ArmClient ArmClient + { + get + { + if (this.armClient == null && this.azureContext != null) + { + var credential = new AzureContextCredential(this.azureContext); + var armClientOptions = new ArmClientOptions(); + this.armClient = new ArmClient(credential, this.azureContext.Subscription.Id, armClientOptions); + } + return this.armClient; + } + } + private enum DeploymentStackScope { ResourceGroup = 0, Subscription, ManagementGroup } - /// /// Parameter-less constructor for mocking /// @@ -507,10 +532,10 @@ bool bypassStackOutOfSyncError } internal void DeleteResourceGroupDeploymentStack( - string resourceGroupName, - string name, - string resourcesCleanupAction, - string resourceGroupsCleanupAction, + string resourceGroupName, + string name, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, string managementGroupsCleanupAction, bool bypassStackOutOfSyncError ) @@ -531,9 +556,9 @@ bool bypassStackOutOfSyncError } internal void DeleteSubscriptionDeploymentStack( - string name, - string resourcesCleanupAction, - string resourceGroupsCleanupAction, + string name, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, string managementGroupsCleanupAction, bool bypassStackOutOfSyncError ) @@ -613,27 +638,27 @@ bool bypassStackOutOfSyncError return new PSDeploymentStack(finalStack); } - public void SubscriptionValidateDeploymentStack( - string deploymentStackName, - string location, - string templateFile, - string templateUri, - string templateSpec, - Hashtable templateObject, - string parameterUri, - Hashtable parameters, - string description, - string resourcesCleanupAction, - string resourceGroupsCleanupAction, - string managementGroupsCleanupAction, - string deploymentScope, - string denySettingsMode, - string[] denySettingsExcludedPrincipals, - string[] denySettingsExcludedActions, - bool denySettingsApplyToChildScopes, - Hashtable tags, - bool bypassStackOutOfSyncError -) + public void SubscriptionValidateDeploymentStack( + string deploymentStackName, + string location, + string templateFile, + string templateUri, + string templateSpec, + Hashtable templateObject, + string parameterUri, + Hashtable parameters, + string description, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, + string managementGroupsCleanupAction, + string deploymentScope, + string denySettingsMode, + string[] denySettingsExcludedPrincipals, + string[] denySettingsExcludedActions, + bool denySettingsApplyToChildScopes, + Hashtable tags, + bool bypassStackOutOfSyncError + ) { // Create Deployment stack deployment model: var deploymentStackModel = CreateDeploymentStackModel( @@ -661,10 +686,10 @@ bool bypassStackOutOfSyncError } internal void DeleteManagementGroupDeploymentStack( - string name, - string managementGroupId, - string resourcesCleanupAction, - string resourceGroupsCleanupAction, + string name, + string managementGroupId, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, string managementGroupsCleanupAction, bool bypassStackOutOfSyncError ) @@ -818,13 +843,13 @@ public DeploymentStack CreateDeploymentStackModel( bool bypassStackOutOfSyncError ) { - var actionOnUnmanage = new ActionOnUnmanage + var actionOnUnmanage = new Microsoft.Azure.Management.Resources.Models.ActionOnUnmanage { Resources = resourcesCleanupAction, ResourceGroups = resourceGroupsCleanupAction, ManagementGroups = managementGroupsCleanupAction }; - var denySettings = new DenySettings + var denySettings = new Microsoft.Azure.Management.Resources.Models.DenySettings { Mode = denySettingsMode, ExcludedPrincipals = denySettingsExcludedPrincipals, @@ -1056,7 +1081,7 @@ private List ExtractErrorMessages(ErrorDetail error) private PSDeploymentStackValidationInfo ValidateDeploymentStack(DeploymentStack deploymentStack, string deploymentStackName, DeploymentStackScope scope, string scopeName = "") { - var validationResult = RunDeploymentStackValidation(deploymentStack, deploymentStackName, scope, scopeName); + var validationResult = RunDeploymentStackValidation(deploymentStack, deploymentStackName, scope, scopeName); if (validationResult.Error != null) { @@ -1069,13 +1094,13 @@ private PSDeploymentStackValidationInfo ValidateDeploymentStack(DeploymentStack } WriteError(sb.ToString()); - + throw new InvalidOperationException($"Validation for deployment stack '{deploymentStackName}' failed."); } else { WriteVerbose(ProjectResources.TemplateValid); - + return validationResult; } } @@ -1148,5 +1173,442 @@ private IList ConvertCloudErrorListToErrorDetailList(IList + /// Converts Azure SDK What-If result to PowerShell model + /// + private PSDeploymentStackWhatIfResult ConvertToPSDeploymentStackWhatIfResult(object sdkWhatIfResult) + { + // Serialize SDK result to JSON and deserialize to PS model + // This provides a flexible conversion that handles the complex nested structure + var json = JsonConvert.SerializeObject(sdkWhatIfResult); + var psResult = JsonConvert.DeserializeObject(json); + return psResult; + } + + /// + /// Creates a DeploymentStacksWhatIfResult request object for the What-If operation + /// + private DeploymentStacksWhatIfResult CreateDeploymentStacksWhatIfResult( + string location, + string templateFile, + string templateUri, + string templateSpec, + Hashtable templateObject, + string parameterUri, + Hashtable parameters, + string description, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, + string managementGroupsCleanupAction, + string deploymentScope, + string denySettingsMode, + string[] denySettingsExcludedPrincipals, + string[] denySettingsExcludedActions, + bool denySettingsApplyToChildScopes, + string deploymentStackName, + string resourceGroupName, + string managementGroupId) + { + var actionOnUnmanage = new ActionOnUnmanage + { + Resources = resourcesCleanupAction, + ResourceGroups = resourceGroupsCleanupAction, + ManagementGroups = managementGroupsCleanupAction + }; + + var denySettings = new DenySettings + { + Mode = denySettingsMode, + ExcludedPrincipals = denySettingsExcludedPrincipals, + ExcludedActions = denySettingsExcludedActions, + ApplyToChildScopes = denySettingsApplyToChildScopes + }; + + // Build the deployment stack resource ID for comparison + string stackResourceId = null; + if (!string.IsNullOrEmpty(resourceGroupName)) + { + stackResourceId = $"/subscriptions/{azureContext.Subscription.Id}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}"; + } + else if (!string.IsNullOrEmpty(managementGroupId)) + { + stackResourceId = $"/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}"; + } + else + { + stackResourceId = $"/subscriptions/{azureContext.Subscription.Id}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}"; + } + + var properties = new DeploymentStacksWhatIfResultProperties( + actionOnUnmanage: actionOnUnmanage, + denySettings: denySettings, + deploymentStackResourceId: stackResourceId, + retentionInterval: TimeSpan.FromHours(2)) + { + Description = description, + DeploymentScope = deploymentScope + }; + + // Evaluate Template + if (templateSpec != null) + { + properties.TemplateLink = new DeploymentStacksTemplateLink + { + Id = templateSpec, + }; + } + else if (Uri.IsWellFormedUriString(templateUri, UriKind.Absolute)) + { + properties.TemplateLink = new DeploymentStacksTemplateLink + { + Uri = templateUri, + }; + } + else if (!string.IsNullOrEmpty(templateFile)) + { + properties.Template = FileUtilities.DataStore.ReadFileAsStream(templateFile).FromJson(); + } + else + { + properties.Template = templateObject.ToJToken(); + } + + // Evaluate Template Parameters + if (Uri.IsWellFormedUriString(parameterUri, UriKind.Absolute)) + { + properties.ParametersLink = new DeploymentStacksParametersLink + { + Uri = parameterUri + }; + } + else if (parameters != null) + { + properties.Parameters = ConvertParameterHashtableToDictionary(parameters); + } + + var whatIfResult = new DeploymentStacksWhatIfResult + { + Location = location, + Properties = properties + }; + + return whatIfResult; + } + + #region What-If Operations + + /// + /// Executes a what-if operation for a deployment stack. + /// Main entry point that determines scope and routes to appropriate method. + /// NOTE: What-If for Deployment Stacks is not yet supported by the Azure REST API. + /// + public PSDeploymentStackWhatIfResult ExecuteDeploymentStackWhatIf(PSDeploymentStackWhatIfParameters parameters) + { + if (parameters == null) + { + throw new ArgumentNullException(nameof(parameters)); + } + + // Determine scope and call appropriate method + if (!string.IsNullOrEmpty(parameters.ResourceGroupName)) + { + return ExecuteResourceGroupDeploymentStackWhatIf( + parameters.StackName, + parameters.ResourceGroupName, + parameters.TemplateFile, + parameters.TemplateUri, + parameters.TemplateSpecId, + parameters.TemplateObject, + parameters.TemplateParameterUri, + parameters.TemplateParameterObject, + parameters.Description, + parameters.ResourcesCleanupAction, + parameters.ResourceGroupsCleanupAction, + parameters.ManagementGroupsCleanupAction, + parameters.DenySettingsMode, + parameters.DenySettingsExcludedPrincipals, + parameters.DenySettingsExcludedActions, + parameters.DenySettingsApplyToChildScopes, + false); + } + else if (!string.IsNullOrEmpty(parameters.ManagementGroupId)) + { + return ExecuteManagementGroupDeploymentStackWhatIf( + parameters.StackName, + parameters.ManagementGroupId, + parameters.Location, + parameters.TemplateFile, + parameters.TemplateUri, + parameters.TemplateSpecId, + parameters.TemplateObject, + parameters.TemplateParameterUri, + parameters.TemplateParameterObject, + parameters.Description, + parameters.ResourcesCleanupAction, + parameters.ResourceGroupsCleanupAction, + parameters.ManagementGroupsCleanupAction, + parameters.DeploymentScope, + parameters.DenySettingsMode, + parameters.DenySettingsExcludedPrincipals, + parameters.DenySettingsExcludedActions, + parameters.DenySettingsApplyToChildScopes, + false); + } + else + { + // Subscription scope + return ExecuteSubscriptionDeploymentStackWhatIf( + parameters.StackName, + parameters.Location, + parameters.TemplateFile, + parameters.TemplateUri, + parameters.TemplateSpecId, + parameters.TemplateObject, + parameters.TemplateParameterUri, + parameters.TemplateParameterObject, + parameters.Description, + parameters.ResourcesCleanupAction, + parameters.ResourceGroupsCleanupAction, + parameters.ManagementGroupsCleanupAction, + parameters.DeploymentScope, + parameters.DenySettingsMode, + parameters.DenySettingsExcludedPrincipals, + parameters.DenySettingsExcludedActions, + parameters.DenySettingsApplyToChildScopes, + false); + } + } + + /// + /// Executes a what-if operation for a deployment stack at resource group scope. + /// + public PSDeploymentStackWhatIfResult ExecuteResourceGroupDeploymentStackWhatIf( + string deploymentStackName, + string resourceGroupName, + string templateFile, + string templateUri, + string templateSpec, + Hashtable templateObject, + string parameterUri, + Hashtable parameters, + string description, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, + string managementGroupsCleanupAction, + string denySettingsMode, + string[] denySettingsExcludedPrincipals, + string[] denySettingsExcludedActions, + bool denySettingsApplyToChildScopes, + bool bypassStackOutOfSyncError) + { + try + { + WriteVerbose($"Executing What-If for deployment stack '{deploymentStackName}' in resource group '{resourceGroupName}'"); + + // Create what-if result object to submit + var whatIfRequest = CreateDeploymentStacksWhatIfResult( + location: null, + templateFile, + templateUri, + templateSpec, + templateObject, + parameterUri, + parameters, + description, + resourcesCleanupAction, + resourceGroupsCleanupAction, + managementGroupsCleanupAction, + deploymentScope: null, + denySettingsMode, + denySettingsExcludedPrincipals, + denySettingsExcludedActions, + denySettingsApplyToChildScopes, + deploymentStackName, + resourceGroupName, + null + ); + + // Execute What-If operation using Track 1 SDK + var whatIfResult = DeploymentStacksClient.DeploymentStacksWhatIfResultsAtResourceGroup.CreateOrUpdate( + resourceGroupName, + deploymentStackName, + whatIfRequest); + + // Convert SDK result to PowerShell model + return ConvertToPSDeploymentStackWhatIfResult(whatIfResult); + } + catch (Exception ex) + { + WriteError($"Error executing What-If: {ex.Message}"); + throw; + } + } + + /// + /// Executes a what-if operation for a deployment stack at subscription scope. + /// + public PSDeploymentStackWhatIfResult ExecuteSubscriptionDeploymentStackWhatIf( + string deploymentStackName, + string location, + string templateFile, + string templateUri, + string templateSpec, + Hashtable templateObject, + string parameterUri, + Hashtable parameters, + string description, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, + string managementGroupsCleanupAction, + string deploymentScope, + string denySettingsMode, + string[] denySettingsExcludedPrincipals, + string[] denySettingsExcludedActions, + bool denySettingsApplyToChildScopes, + bool bypassStackOutOfSyncError) + { + try + { + WriteVerbose($"Executing What-If for deployment stack '{deploymentStackName}' at subscription scope"); + + // Create what-if result object to submit + var whatIfRequest = CreateDeploymentStacksWhatIfResult( + location, + templateFile, + templateUri, + templateSpec, + templateObject, + parameterUri, + parameters, + description, + resourcesCleanupAction, + resourceGroupsCleanupAction, + managementGroupsCleanupAction, + deploymentScope, + denySettingsMode, + denySettingsExcludedPrincipals, + denySettingsExcludedActions, + denySettingsApplyToChildScopes, + deploymentStackName, + null, + null + ); + + // Execute What-If operation using Track 1 SDK + var whatIfResult = DeploymentStacksClient.DeploymentStacksWhatIfResultsAtSubscription.CreateOrUpdate( + deploymentStackName, + whatIfRequest); + + // Convert SDK result to PowerShell model + return ConvertToPSDeploymentStackWhatIfResult(whatIfResult); + } + catch (Exception ex) + { + WriteError($"Error executing What-If: {ex.Message}"); + throw; + } + } + + /// + /// Executes a what-if operation for a deployment stack at management group scope. + /// + public PSDeploymentStackWhatIfResult ExecuteManagementGroupDeploymentStackWhatIf( + string deploymentStackName, + string managementGroupId, + string location, + string templateFile, + string templateUri, + string templateSpec, + Hashtable templateObject, + string parameterUri, + Hashtable parameters, + string description, + string resourcesCleanupAction, + string resourceGroupsCleanupAction, + string managementGroupsCleanupAction, + string deploymentScope, + string denySettingsMode, + string[] denySettingsExcludedPrincipals, + string[] denySettingsExcludedActions, + bool denySettingsApplyToChildScopes, + bool bypassStackOutOfSyncError) + { + try + { + WriteVerbose($"Executing What-If for deployment stack '{deploymentStackName}' in management group '{managementGroupId}'"); + + // Create what-if result object to submit + var whatIfRequest = CreateDeploymentStacksWhatIfResult( + location, + templateFile, + templateUri, + templateSpec, + templateObject, + parameterUri, + parameters, + description, + resourcesCleanupAction, + resourceGroupsCleanupAction, + managementGroupsCleanupAction, + deploymentScope, + denySettingsMode, + denySettingsExcludedPrincipals, + denySettingsExcludedActions, + denySettingsApplyToChildScopes, + deploymentStackName, + null, + managementGroupId + ); + + // Execute What-If operation using Track 1 SDK + var whatIfResult = DeploymentStacksClient.DeploymentStacksWhatIfResultsAtManagementGroup.CreateOrUpdate( + managementGroupId, + deploymentStackName, + whatIfRequest); + + // Convert SDK result to PowerShell model + return ConvertToPSDeploymentStackWhatIfResult(whatIfResult); + } + catch (Exception ex) + { + WriteError($"Error executing What-If: {ex.Message}"); + throw; + } + } + + #endregion + } + + /// + /// Token credential implementation for Azure Context + /// + internal class AzureContextCredential : TokenCredential + { + private readonly IAzureContext context; + + public AzureContextCredential(IAzureContext context) + { + this.context = context ?? throw new ArgumentNullException(nameof(context)); + } + + public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) + { + return GetTokenAsync(requestContext, cancellationToken).GetAwaiter().GetResult(); + } + + public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) + { + var accessToken = await AzureSession.Instance.AuthenticationFactory.Authenticate( + context.Account, + context.Environment, + context.Tenant.Id, + null, + ShowDialog.Never, + null, + requestContext.Scopes); + + return new AccessToken(accessToken.AccessToken, DateTimeOffset.Parse(accessToken.ExpiresOn)); + } } } \ No newline at end of file diff --git a/src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDenySettingsMode.cs b/src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDenySettingsMode.cs index 2b74fe42272d..c8216d7f4028 100644 --- a/src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDenySettingsMode.cs +++ b/src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDenySettingsMode.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks { public enum PSDenySettingsMode { @@ -20,4 +20,4 @@ public enum PSDenySettingsMode DenyDelete, DenyWriteAndDelete } -} +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfParameters.cs b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfParameters.cs new file mode 100644 index 000000000000..38cffd684d1c --- /dev/null +++ b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfParameters.cs @@ -0,0 +1,62 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments +{ + using System.Collections; + + /// + /// Parameters for Deployment Stack What-If operation. + /// + public class PSDeploymentStackWhatIfParameters + { + public string StackName { get; set; } + + public string ResourceGroupName { get; set; } + + public string ManagementGroupId { get; set; } + + public string Location { get; set; } + + public string TemplateFile { get; set; } + + public string TemplateUri { get; set; } + + public string TemplateSpecId { get; set; } + + public Hashtable TemplateObject { get; set; } + + public string TemplateParameterUri { get; set; } + + public Hashtable TemplateParameterObject { get; set; } + + public string Description { get; set; } + + public string DeploymentScope { get; set; } + + public string ResourcesCleanupAction { get; set; } + + public string ResourceGroupsCleanupAction { get; set; } + + public string ManagementGroupsCleanupAction { get; set; } + + public string DenySettingsMode { get; set; } + + public string[] DenySettingsExcludedPrincipals { get; set; } + + public string[] DenySettingsExcludedActions { get; set; } + + public bool DenySettingsApplyToChildScopes { get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfResult.cs b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfResult.cs new file mode 100644 index 000000000000..070a566c0eb7 --- /dev/null +++ b/src/Resources/ResourceManager/SdkModels/Deployments/PSDeploymentStackWhatIfResult.cs @@ -0,0 +1,303 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.Deployments +{ + using System; + using System.Collections.Generic; + using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Formatters; + using Newtonsoft.Json; + + /// + /// Represents the result of a Deployment Stack What-If operation. + /// Maps to the API response from Azure Resource Manager. + /// + public class PSDeploymentStackWhatIfResult + { + [JsonProperty("id")] + public string Id { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("properties")] + public DeploymentStackWhatIfProperties Properties { get; set; } + + public override string ToString() + { + return DeploymentStackWhatIfFormatter.Format(this); + } + } + + public class DeploymentStackWhatIfProperties + { + [JsonProperty("deploymentStackResourceId")] + public string DeploymentStackResourceId { get; set; } + + [JsonProperty("retentionInterval")] + public string RetentionInterval { get; set; } + + [JsonProperty("provisioningState")] + public string ProvisioningState { get; set; } + + [JsonProperty("deploymentStackLastModified")] + public DateTime? DeploymentStackLastModified { get; set; } + + [JsonProperty("deploymentExtensions")] + public IList DeploymentExtensions { get; set; } + + [JsonProperty("changes")] + public DeploymentStackWhatIfChanges Changes { get; set; } + + [JsonProperty("diagnostics")] + public IList Diagnostics { get; set; } + + [JsonProperty("correlationId")] + public string CorrelationId { get; set; } + + [JsonProperty("actionOnUnmanage")] + public ActionOnUnmanage ActionOnUnmanage { get; set; } + + [JsonProperty("deploymentScope")] + public string DeploymentScope { get; set; } + + [JsonProperty("denySettings")] + public DenySettings DenySettings { get; set; } + + [JsonProperty("parametersLink")] + public ParametersLink ParametersLink { get; set; } + + [JsonProperty("templateLink")] + public TemplateLink TemplateLink { get; set; } + + [JsonProperty("bypassStackOutOfSyncError")] + public bool? BypassStackOutOfSyncError { get; set; } + } + + public class DeploymentExtension + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("version")] + public string Version { get; set; } + + [JsonProperty("configId")] + public string ConfigId { get; set; } + + [JsonProperty("config")] + public IDictionary Config { get; set; } + } + + public class DeploymentStackWhatIfChanges + { + [JsonProperty("resourceChanges")] + public IList ResourceChanges { get; set; } + + [JsonProperty("deploymentScopeChange")] + public DeploymentStackChangeBase DeploymentScopeChange { get; set; } + + [JsonProperty("denySettingsChange")] + public DeploymentStackChangeDeltaRecord DenySettingsChange { get; set; } + } + + public class DeploymentStackChangeBase + { + [JsonProperty("changeType")] + public string ChangeType { get; set; } + + [JsonProperty("before")] + public object Before { get; set; } + + [JsonProperty("after")] + public object After { get; set; } + } + + public class DeploymentStackResourceChange + { + [JsonProperty("id")] + public string Id { get; set; } + + [JsonProperty("type")] + public string Type { get; set; } + + [JsonProperty("changeType")] + public string ChangeType { get; set; } + + [JsonProperty("changeCertainty")] + public string ChangeCertainty { get; set; } + + [JsonProperty("apiVersion")] + public string ApiVersion { get; set; } + + [JsonProperty("managementStatusChange")] + public DeploymentStackChangeBase ManagementStatusChange { get; set; } + + [JsonProperty("denyStatusChange")] + public DeploymentStackChangeBase DenyStatusChange { get; set; } + + [JsonProperty("resourceConfigurationChanges")] + public ResourceConfigurationChanges ResourceConfigurationChanges { get; set; } + + [JsonProperty("extension")] + public DeploymentStackExtensionInfo Extension { get; set; } + + [JsonProperty("identifiers")] + public IDictionary Identifiers { get; set; } + } + + public class ResourceConfigurationChanges + { + [JsonProperty("before")] + public object Before { get; set; } + + [JsonProperty("after")] + public object After { get; set; } + + [JsonProperty("delta")] + public IList Delta { get; set; } + } + + public class DeploymentStackChangeDeltaRecord + { + [JsonProperty("before")] + public object Before { get; set; } + + [JsonProperty("after")] + public object After { get; set; } + + [JsonProperty("delta")] + public IList Delta { get; set; } + } + + public class DeploymentStackPropertyChange + { + [JsonProperty("path")] + public string Path { get; set; } + + [JsonProperty("changeType")] + public string ChangeType { get; set; } + + [JsonProperty("before")] + public object Before { get; set; } + + [JsonProperty("after")] + public object After { get; set; } + + [JsonProperty("children")] + public IList Children { get; set; } + } + + public class DeploymentStackExtensionInfo + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("version")] + public string Version { get; set; } + + [JsonProperty("configId")] + public string ConfigId { get; set; } + + [JsonProperty("config")] + public IDictionary Config { get; set; } + } + + public class DeploymentStackExtensionConfigItem + { + [JsonProperty("value")] + public object Value { get; set; } + + [JsonProperty("keyVaultReference")] + public DeploymentStackKeyVaultReference KeyVaultReference { get; set; } + } + + public class DeploymentStackKeyVaultReference + { + [JsonProperty("secretName")] + public string SecretName { get; set; } + + [JsonProperty("secretVersion")] + public string SecretVersion { get; set; } + + [JsonProperty("keyVault")] + public DeploymentStackKeyVaultInfo KeyVault { get; set; } + } + + public class DeploymentStackKeyVaultInfo + { + [JsonProperty("id")] + public string Id { get; set; } + } + + public class DeploymentStackDiagnostic + { + [JsonProperty("level")] + public string Level { get; set; } + + [JsonProperty("code")] + public string Code { get; set; } + + [JsonProperty("message")] + public string Message { get; set; } + + [JsonProperty("target")] + public string Target { get; set; } + } + + public class ActionOnUnmanage + { + [JsonProperty("resources")] + public string Resources { get; set; } + + [JsonProperty("resourceGroups")] + public string ResourceGroups { get; set; } + + [JsonProperty("managementGroups")] + public string ManagementGroups { get; set; } + + [JsonProperty("resourcesWithoutDeleteSupport")] + public string ResourcesWithoutDeleteSupport { get; set; } + } + + public class DenySettings + { + [JsonProperty("mode")] + public string Mode { get; set; } + + [JsonProperty("applyToChildScopes")] + public bool? ApplyToChildScopes { get; set; } + + [JsonProperty("excludedPrincipals")] + public IList ExcludedPrincipals { get; set; } + + [JsonProperty("excludedActions")] + public IList ExcludedActions { get; set; } + } + + public class ParametersLink + { + [JsonProperty("uri")] + public string Uri { get; set; } + } + + public class TemplateLink + { + [JsonProperty("uri")] + public string Uri { get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksClient.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksClient.cs index 1feb954ac14c..0f68f4194721 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksClient.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksClient.cs @@ -39,9 +39,9 @@ public partial class DeploymentStacksClient : Microsoft.Rest.ServiceClient - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// - public string SubscriptionId { get; set;} + public System.Guid SubscriptionId { get; set;} /// /// The preferred language for the response. @@ -66,6 +66,18 @@ public partial class DeploymentStacksClient : Microsoft.Rest.ServiceClient public virtual IDeploymentStacksOperations DeploymentStacks { get; private set; } /// + /// Gets the IDeploymentStacksWhatIfResultsAtManagementGroupOperations + /// + public virtual IDeploymentStacksWhatIfResultsAtManagementGroupOperations DeploymentStacksWhatIfResultsAtManagementGroup { get; private set; } + /// + /// Gets the IDeploymentStacksWhatIfResultsAtSubscriptionOperations + /// + public virtual IDeploymentStacksWhatIfResultsAtSubscriptionOperations DeploymentStacksWhatIfResultsAtSubscription { get; private set; } + /// + /// Gets the IDeploymentStacksWhatIfResultsAtResourceGroupOperations + /// + public virtual IDeploymentStacksWhatIfResultsAtResourceGroupOperations DeploymentStacksWhatIfResultsAtResourceGroup { get; private set; } + /// /// Initializes a new instance of the DeploymentStacksClient class. /// /// @@ -304,8 +316,11 @@ public DeploymentStacksClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCr private void Initialize() { this.DeploymentStacks = new DeploymentStacksOperations(this); + this.DeploymentStacksWhatIfResultsAtManagementGroup = new DeploymentStacksWhatIfResultsAtManagementGroupOperations(this); + this.DeploymentStacksWhatIfResultsAtSubscription = new DeploymentStacksWhatIfResultsAtSubscriptionOperations(this); + this.DeploymentStacksWhatIfResultsAtResourceGroup = new DeploymentStacksWhatIfResultsAtResourceGroupOperations(this); this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2024-03-01"; + this.ApiVersion = "2025-07-01"; this.AcceptLanguage = "en-US"; this.LongRunningOperationRetryTimeout = 30; this.GenerateClientRequestId = true; diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperations.cs index 22490af4f888..1679321c0d25 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperations.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperations.cs @@ -39,10 +39,10 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) public DeploymentStacksClient Client { get; private set; } /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -65,43 +65,32 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task>> ListAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ListAtManagementGroupWithHttpMessagesAsync(string managementGroupId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceGroupName == null) + + if (managementGroupId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); } - if (resourceGroupName != null) + if (managementGroupId != null) { - if (resourceGroupName.Length > 90) + if (managementGroupId.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); } - if (resourceGroupName.Length < 1) + if (managementGroupId.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -109,18 +98,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (this.Client.ApiVersion != null) @@ -187,11 +175,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -253,8 +241,14 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Gets the Deployment stack with the given name. /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// /// /// Headers that will be added to request. /// @@ -276,28 +270,51 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task>> ListAtSubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> GetAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); } - if (this.Client.SubscriptionId != null) + if (managementGroupId != null) { - if (this.Client.SubscriptionId.Length < 1) + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } } - if (this.Client.ApiVersion == null) + if (deploymentStackName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); + } + if (deploymentStackName != null) + { + if (deploymentStackName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStackName", 90); + } + if (deploymentStackName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStackName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStackName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); + } } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -305,16 +322,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (this.Client.ApiVersion != null) @@ -381,11 +401,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -409,7 +429,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -423,7 +443,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -447,10 +467,79 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. /// /// /// Headers that will be added to request. @@ -473,12 +562,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task>> ListAtManagementGroupWithHttpMessagesAsync(string managementGroupId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ExportTemplateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (managementGroupId == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); @@ -493,16 +587,26 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); - } } - if (this.Client.ApiVersion == null) + if (deploymentStackName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); + } + if (deploymentStackName != null) + { + if (deploymentStackName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStackName", 90); + } + if (deploymentStackName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStackName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStackName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); + } } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -511,16 +615,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (this.Client.ApiVersion != null) @@ -534,7 +640,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -587,11 +693,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -615,7 +721,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -629,7 +735,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -653,16 +759,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// /// - /// Deployment stack supplied to the operation. + /// The content of the action request /// /// /// Headers that will be added to request. @@ -670,22 +777,16 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Gets a Deployment stack with a given name at Resource Group scope. + /// Lists Deployment stacks at the specified scope. /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// Name of the deployment stack. - /// /// /// Headers that will be added to request. /// @@ -707,62 +808,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> GetAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ListAtSubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) - { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - } - if (deploymentStackName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); - } - if (deploymentStackName != null) - { - if (deploymentStackName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStackName", 90); - } - if (deploymentStackName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStackName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStackName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); - } - } if (this.Client.ApiVersion == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -770,20 +827,16 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscription", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (this.Client.ApiVersion != null) @@ -850,11 +903,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -878,7 +931,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -892,7 +945,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -916,65 +969,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation - /// completes, status code 200 returned without content. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// Name of the deployment stack. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> DeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a Deployment stack at Subscription scope. - /// - /// - /// Name of the deployment stack. - /// - /// - /// Deployment stack supplied to the operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a Deployment stack with a given name at Subscription scope. + /// Gets the Deployment stack with the given name. /// /// /// Name of the deployment stack. @@ -1006,17 +1001,12 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + + if (deploymentStackName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); @@ -1036,11 +1026,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1058,7 +1043,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -1126,11 +1111,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1192,24 +1177,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. + /// + /// Resource create parameters. /// /// /// Headers that will be added to request. @@ -1217,24 +1191,36 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> DeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. /// /// /// Headers that will be added to request. @@ -1242,19 +1228,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> DeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Gets a Deployment stack with a given name at Management Group scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// @@ -1279,31 +1263,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> GetAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ExportTemplateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (managementGroupId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); - } - if (managementGroupId != null) + if (this.Client.ApiVersion == null) { - if (managementGroupId.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); - } - if (managementGroupId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + + if (deploymentStackName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); @@ -1323,11 +1294,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1335,18 +1301,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtSubscription", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -1361,7 +1326,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -1414,11 +1379,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1442,7 +1407,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -1456,7 +1421,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -1480,27 +1445,14 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. + /// + /// The content of the action request /// /// /// Headers that will be added to request. @@ -1508,23 +1460,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> DeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Exports the template used to create the Deployment stack at Resource Group - /// scope. + /// Lists Deployment stacks at the specified scope. /// /// /// The name of the resource group. The name is case insensitive. /// - /// - /// Name of the deployment stack. - /// /// /// Headers that will be added to request. /// @@ -1546,23 +1494,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> ExportTemplateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ListAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + + if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -1578,30 +1521,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } - if (deploymentStackName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); - } - if (deploymentStackName != null) - { - if (deploymentStackName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStackName", 90); - } - if (deploymentStackName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStackName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStackName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1610,19 +1529,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (this.Client.ApiVersion != null) @@ -1636,7 +1553,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -1689,11 +1606,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1717,7 +1634,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -1731,7 +1648,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -1755,9 +1672,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Exports the template used to create the Deployment stack at Subscription - /// scope. + /// Gets the Deployment stack with the given name. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// @@ -1782,21 +1701,31 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> ExportTemplateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> GetAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) + if (this.Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (this.Client.SubscriptionId != null) + if (resourceGroupName != null) { - if (this.Client.SubscriptionId.Length < 1) + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (deploymentStackName == null) @@ -1818,11 +1747,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1830,17 +1754,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -1855,7 +1781,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -1908,11 +1834,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1936,7 +1862,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -1950,7 +1876,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -1974,25 +1900,90 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Exports the template used to create the Deployment stack at Management - /// Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// + /// + /// Resource create parameters. + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// + public async System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Exports the template used to create the Deployment stack at the specified + /// scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// /// Thrown when unable to deserialize the response /// /// @@ -2004,29 +1995,31 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> ExportTemplateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ExportTemplateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (managementGroupId == null) + if (this.Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (managementGroupId != null) + + + if (resourceGroupName == null) { - if (managementGroupId.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); - } - if (managementGroupId.Length < 1) + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) + if (resourceGroupName.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (deploymentStackName == null) @@ -2048,11 +2041,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2060,18 +2048,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplateAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); - _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -2139,11 +2128,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -2205,8 +2194,8 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The name of the resource group. The name is case insensitive. @@ -2215,7 +2204,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// The content of the action request /// /// /// Headers that will be added to request. @@ -2231,65 +2220,16 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. - /// - /// - /// Name of the deployment stack. - /// - /// - /// Deployment stack to validate. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> ValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Management Group id. - /// - /// - /// Name of the deployment stack. - /// - /// - /// Deployment stack to validate. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> ValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, customHeaders, cancellationToken).ConfigureAwait(false); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a Deployment stack at Resource Group scope. - /// - /// - /// The name of the resource group. The name is case insensitive. + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// /// - /// Deployment stack supplied to the operation. + /// Resource create parameters. /// /// /// Headers that will be added to request. @@ -2312,7 +2252,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { @@ -2326,30 +2266,24 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { deploymentStack.Validate(); } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceGroupName == null) + + if (managementGroupId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); } - if (resourceGroupName != null) + if (managementGroupId != null) { - if (resourceGroupName.Length > 90) + if (managementGroupId.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); } - if (resourceGroupName.Length < 1) + if (managementGroupId.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } } if (deploymentStackName == null) @@ -2371,11 +2305,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2383,20 +2312,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -2470,11 +2398,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -2498,7 +2426,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2542,6 +2470,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -2554,11 +2495,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -2572,6 +2513,10 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -2594,36 +2539,30 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginDeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginDeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceGroupName == null) + + if (managementGroupId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); } - if (resourceGroupName != null) + if (managementGroupId != null) { - if (resourceGroupName.Length > 90) + if (managementGroupId.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); } - if (resourceGroupName.Length < 1) + if (managementGroupId.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } } if (deploymentStackName == null) @@ -2649,10 +2588,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; @@ -2661,26 +2596,30 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("unmanageActionResources", unmanageActionResources); tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } if (unmanageActionResources != null) { _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); @@ -2693,13 +2632,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); } - if (bypassStackOutOfSyncError != null) + if (unmanageActionResourcesWithoutDeleteSupport != null) { - _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); } - if (this.Client.ApiVersion != null) + if (bypassStackOutOfSyncError != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -2761,11 +2700,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -2789,7 +2728,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -2799,7 +2738,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -2822,13 +2761,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// - /// Deployment stack supplied to the operation. + /// The content of the action request /// /// /// Headers that will be added to request. @@ -2851,7 +2794,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { @@ -2865,15 +2808,24 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { deploymentStack.Validate(); } - if (this.Client.SubscriptionId == null) + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); } - if (this.Client.SubscriptionId != null) + if (managementGroupId != null) { - if (this.Client.SubscriptionId.Length < 1) + if (managementGroupId.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); } } if (deploymentStackName == null) @@ -2895,11 +2847,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2907,18 +2854,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtManagementGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -2933,7 +2881,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -2990,13 +2938,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -3020,7 +2968,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3034,7 +2982,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -3047,12 +2995,12 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } } // Deserialize Response - if ((int)_statusCode == 201) + if ((int)_statusCode == 400) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -3064,6 +3012,19 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); @@ -3076,24 +3037,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. + /// + /// Resource create parameters. /// /// /// Headers that will be added to request. @@ -3104,6 +3054,9 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -3113,23 +3066,26 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginDeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (this.Client.SubscriptionId == null) + if (deploymentStack == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStack"); } - if (this.Client.SubscriptionId != null) + if (deploymentStack != null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + deploymentStack.Validate(); } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (deploymentStackName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); @@ -3149,15 +3105,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - - - - - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3166,39 +3113,20 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("deploymentStackName", deploymentStackName); - tracingParameters.Add("unmanageActionResources", unmanageActionResources); - tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); - tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); - tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); + tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtSubscription", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (unmanageActionResources != null) - { - _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); - } - if (unmanageActionResourceGroups != null) - { - _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); - } - if (unmanageActionManagementGroups != null) - { - _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); - } - if (bypassStackOutOfSyncError != null) - { - _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); - } if (this.Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); @@ -3210,7 +3138,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -3239,6 +3167,12 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } // Serialize Request string _requestContent = null; + if(deploymentStack != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(deploymentStack, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -3261,13 +3195,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -3291,7 +3225,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3299,9 +3233,45 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -3324,16 +3294,28 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. /// /// /// Headers that will be added to request. @@ -3344,9 +3326,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -3356,39 +3335,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginDeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (deploymentStack == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStack"); - } - if (deploymentStack != null) - { - deploymentStack.Validate(); - } - if (managementGroupId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); - } - if (managementGroupId != null) + if (this.Client.ApiVersion == null) { - if (managementGroupId.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); - } - if (managementGroupId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + + if (deploymentStackName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); @@ -3408,10 +3366,10 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; @@ -3420,19 +3378,22 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); + tracingParameters.Add("unmanageActionResources", unmanageActionResources); + tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); + tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); + tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); - tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtSubscription", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -3440,6 +3401,26 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } + if (unmanageActionResources != null) + { + _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); + } + if (unmanageActionResourceGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); + } + if (unmanageActionManagementGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); + } + if (unmanageActionResourcesWithoutDeleteSupport != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); + } + if (bypassStackOutOfSyncError != null) + { + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -3447,7 +3428,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -3476,12 +3457,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } // Serialize Request string _requestContent = null; - if(deploymentStack != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(deploymentStack, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -3504,13 +3479,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -3534,7 +3509,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3542,41 +3517,18 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) + try { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - // Deserialize Response - if ((int)_statusCode == 201) + catch (Newtonsoft.Json.JsonException ex) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) + _httpRequest.Dispose(); + if (_httpResponse != null) { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + _httpResponse.Dispose(); } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { @@ -3590,27 +3542,14 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. + /// + /// The content of the action request /// /// /// Headers that will be added to request. @@ -3621,6 +3560,9 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -3630,31 +3572,26 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginDeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (managementGroupId == null) + if (deploymentStack == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStack"); } - if (managementGroupId != null) + if (deploymentStack != null) { - if (managementGroupId.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); - } - if (managementGroupId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); - } + deploymentStack.Validate(); } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (deploymentStackName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStackName"); @@ -3674,15 +3611,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - - - - - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3690,41 +3618,21 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("managementGroupId", managementGroupId); tracingParameters.Add("deploymentStackName", deploymentStackName); - tracingParameters.Add("unmanageActionResources", unmanageActionResources); - tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); - tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); - tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); + tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtSubscription", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); - _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (unmanageActionResources != null) - { - _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); - } - if (unmanageActionResourceGroups != null) - { - _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); - } - if (unmanageActionManagementGroups != null) - { - _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); - } - if (bypassStackOutOfSyncError != null) - { - _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); - } if (this.Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); @@ -3736,7 +3644,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -3763,8 +3671,14 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request - string _requestContent = null; + // Serialize Request + string _requestContent = null; + if(deploymentStack != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(deploymentStack, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (this.Client.Credentials != null) { @@ -3787,13 +3701,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -3817,7 +3731,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -3825,9 +3739,45 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 400) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -3850,8 +3800,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The name of the resource group. The name is case insensitive. @@ -3860,7 +3809,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// Resource create parameters. /// /// /// Headers that will be added to request. @@ -3883,7 +3832,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { @@ -3897,17 +3846,12 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { deploymentStack.Validate(); } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (this.Client.SubscriptionId != null) + if (this.Client.ApiVersion == null) { - if (this.Client.SubscriptionId.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + + if (resourceGroupName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); @@ -3942,11 +3886,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3960,13 +3899,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); @@ -3982,7 +3921,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -4039,13 +3978,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -4069,7 +4008,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -4083,7 +4022,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -4096,12 +4035,12 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } } // Deserialize Response - if ((int)_statusCode == 400) + if ((int)_statusCode == 201) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } catch (Newtonsoft.Json.JsonException ex) { @@ -4115,7 +4054,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -4138,14 +4077,31 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack to validate. + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. /// /// /// Headers that will be added to request. @@ -4156,9 +4112,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -4168,29 +4121,31 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginDeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (deploymentStack == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStack"); - } - if (deploymentStack != null) + if (this.Client.ApiVersion == null) { - deploymentStack.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (this.Client.SubscriptionId == null) + + + if (resourceGroupName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (this.Client.SubscriptionId != null) + if (resourceGroupName != null) { - if (this.Client.SubscriptionId.Length < 1) + if (resourceGroupName.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (deploymentStackName == null) @@ -4212,10 +4167,10 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; @@ -4224,18 +4179,24 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("deploymentStackName", deploymentStackName); + tracingParameters.Add("unmanageActionResources", unmanageActionResources); + tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); + tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); + tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); - tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -4243,6 +4204,26 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); } + if (unmanageActionResources != null) + { + _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); + } + if (unmanageActionResourceGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); + } + if (unmanageActionManagementGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); + } + if (unmanageActionResourcesWithoutDeleteSupport != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); + } + if (bypassStackOutOfSyncError != null) + { + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -4250,7 +4231,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) @@ -4279,12 +4260,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } // Serialize Request string _requestContent = null; - if(deploymentStack != null) - { - _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(deploymentStack, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (this.Client.Credentials != null) { @@ -4307,13 +4282,13 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -4337,7 +4312,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -4345,45 +4320,9 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 400) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -4406,17 +4345,17 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// The content of the action request /// /// /// Headers that will be added to request. @@ -4439,7 +4378,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { @@ -4453,23 +4392,25 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { deploymentStack.Validate(); } - if (managementGroupId == null) + if (this.Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (managementGroupId != null) + + + if (resourceGroupName == null) { - if (managementGroupId.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); - } - if (managementGroupId.Length < 1) + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); } - if (!System.Text.RegularExpressions.Regex.IsMatch(managementGroupId, "^[-\\w\\._\\(\\)]+$")) + if (resourceGroupName.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "managementGroupId", "^[-\\w\\._\\(\\)]+$"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); } } if (deploymentStackName == null) @@ -4491,11 +4432,6 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStackName", "^[-\\w\\._\\(\\)]+$"); } } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4503,19 +4439,20 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) { _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("deploymentStackName", deploymentStackName); tracingParameters.Add("deploymentStack", deploymentStack); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtManagementGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginValidateStackAtResourceGroup", tracingParameters); } // Construct URL var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); - _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{deploymentStackName}", System.Uri.EscapeDataString(deploymentStackName)); System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); @@ -4589,11 +4526,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 400) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -4617,7 +4554,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) throw ex; } // Create Result - var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; @@ -4663,7 +4600,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { @@ -4686,7 +4623,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -4712,7 +4649,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task>> ListAtResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ListAtManagementGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (nextPageLink == null) @@ -4730,7 +4667,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtManagementGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -4797,11 +4734,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -4863,7 +4800,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -4974,11 +4911,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -5040,7 +4977,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) } /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -5066,7 +5003,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task>> ListAtManagementGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task>> ListAtResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (nextPageLink == null) @@ -5084,7 +5021,7 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtManagementGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -5151,11 +5088,11 @@ internal DeploymentStacksOperations (DeploymentStacksClient client) if ((int)_statusCode != 200) { - var ex = new DeploymentStacksErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - DeploymentStacksError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperationsExtensions.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperationsExtensions.cs index c98b52d1fff4..7a637f81800f 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperationsExtensions.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksOperationsExtensions.cs @@ -13,73 +13,13 @@ namespace Microsoft.Azure.Management.Resources public static partial class DeploymentStacksOperationsExtensions { /// - /// Lists all the Deployment stacks within the specified Resource Group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static Microsoft.Rest.Azure.IPage ListAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName) - { - return ((IDeploymentStacksOperations)operations).ListAtResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Lists all the Deployment stacks within the specified Resource Group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task> ListAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListAtResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// - /// Lists all the Deployment stacks within the specified Subscription. - /// - /// - /// The operations group for this extension method. - /// - public static Microsoft.Rest.Azure.IPage ListAtSubscription(this IDeploymentStacksOperations operations) - { - return ((IDeploymentStacksOperations)operations).ListAtSubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Lists all the Deployment stacks within the specified Subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task> ListAtSubscriptionAsync(this IDeploymentStacksOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListAtSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// public static Microsoft.Rest.Azure.IPage ListAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId) { @@ -87,13 +27,13 @@ public static Microsoft.Rest.Azure.IPage ListAtManagementGroup( } /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// /// /// The cancellation token. @@ -106,30 +46,30 @@ public static Microsoft.Rest.Azure.IPage ListAtManagementGroup( } } /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - public static DeploymentStack CreateOrUpdateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack GetAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).GetAtManagementGroupAsync(managementGroupId, deploymentStackName).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -137,38 +77,38 @@ public static DeploymentStack CreateOrUpdateAtResourceGroup(this IDeploymentStac /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task GetAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a Deployment stack with a given name at Resource Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName) + public static DeploymentStack CreateOrUpdateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).GetAtResourceGroupAsync(resourceGroupName, deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Gets a Deployment stack with a given name at Resource Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -176,22 +116,22 @@ public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperation /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task CreateOrUpdateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.GetAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -205,24 +145,28 @@ public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperation /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. /// - public static DeploymentStacksDeleteAtResourceGroupHeaders DeleteAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static DeploymentStacksDeleteAtManagementGroupHeaders DeleteAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).DeleteAtResourceGroupAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).DeleteAtManagementGroupAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -236,6 +180,10 @@ public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperation /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -243,228 +191,195 @@ public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperation /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task DeleteAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.DeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } } /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - public static DeploymentStack CreateOrUpdateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStackTemplateDefinition ExportTemplateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ExportTemplateAtManagementGroupAsync(managementGroupId, deploymentStackName).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ExportTemplateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportTemplateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a Deployment stack with a given name at Subscription scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - public static DeploymentStack GetAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName) + public static DeploymentStackValidateResult ValidateStackAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).GetAtSubscriptionAsync(deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ValidateStackAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Gets a Deployment stack with a given name at Subscription scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ValidateStackAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.GetAtSubscriptionWithHttpMessagesAsync(deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Name of the deployment stack. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// - public static DeploymentStacksDeleteAtSubscriptionHeaders DeleteAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static Microsoft.Rest.Azure.IPage ListAtSubscription(this IDeploymentStacksOperations operations) { - return ((IDeploymentStacksOperations)operations).DeleteAtSubscriptionAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ListAtSubscriptionAsync().GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Name of the deployment stack. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task> ListAtSubscriptionAsync(this IDeploymentStacksOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.DeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAtSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - return _result.Headers; + return _result.Body; } } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - public static DeploymentStack CreateOrUpdateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack GetAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).GetAtSubscriptionAsync(deploymentStackName).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task GetAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAtSubscriptionWithHttpMessagesAsync(deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets a Deployment stack with a given name at Management Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - public static DeploymentStack GetAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName) + public static DeploymentStack CreateOrUpdateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).GetAtManagementGroupAsync(managementGroupId, deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Gets a Deployment stack with a given name at Management Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task CreateOrUpdateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.GetAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// @@ -477,25 +392,26 @@ public static DeploymentStack GetAtManagementGroup(this IDeploymentStacksOperati /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. /// - public static DeploymentStacksDeleteAtManagementGroupHeaders DeleteAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static DeploymentStacksDeleteAtSubscriptionHeaders DeleteAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).DeleteAtManagementGroupAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).DeleteAtSubscriptionAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// @@ -508,6 +424,10 @@ public static DeploymentStack GetAtManagementGroup(this IDeploymentStacksOperati /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -515,57 +435,51 @@ public static DeploymentStack GetAtManagementGroup(this IDeploymentStacksOperati /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task DeleteAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.DeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } } /// - /// Exports the template used to create the Deployment stack at Resource Group + /// Exports the template used to create the Deployment stack at the specified /// scope. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. - /// /// /// Name of the deployment stack. /// - public static DeploymentStackTemplateDefinition ExportTemplateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName) + public static DeploymentStackTemplateDefinition ExportTemplateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).ExportTemplateAtResourceGroupAsync(resourceGroupName, deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ExportTemplateAtSubscriptionAsync(deploymentStackName).GetAwaiter().GetResult(); } /// - /// Exports the template used to create the Deployment stack at Resource Group + /// Exports the template used to create the Deployment stack at the specified /// scope. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. The name is case insensitive. - /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ExportTemplateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ExportTemplateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ExportTemplateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportTemplateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Exports the template used to create the Deployment stack at Subscription - /// scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. @@ -573,14 +487,14 @@ public static DeploymentStackTemplateDefinition ExportTemplateAtResourceGroup(th /// /// Name of the deployment stack. /// - public static DeploymentStackTemplateDefinition ExportTemplateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName) + public static DeploymentStackValidateResult ValidateStackAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).ExportTemplateAtSubscriptionAsync(deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ValidateStackAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Exports the template used to create the Deployment stack at Subscription - /// scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. @@ -591,57 +505,48 @@ public static DeploymentStackTemplateDefinition ExportTemplateAtSubscription(thi /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ExportTemplateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ValidateStackAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ExportTemplateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Exports the template used to create the Deployment stack at Management - /// Group scope. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// - /// - /// Name of the deployment stack. + /// + /// The name of the resource group. The name is case insensitive. /// - public static DeploymentStackTemplateDefinition ExportTemplateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName) + public static Microsoft.Rest.Azure.IPage ListAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName) { - return ((IDeploymentStacksOperations)operations).ExportTemplateAtManagementGroupAsync(managementGroupId, deploymentStackName).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ListAtResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } /// - /// Exports the template used to create the Deployment stack at Management - /// Group scope. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// - /// - /// Name of the deployment stack. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ExportTemplateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task> ListAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ExportTemplateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAtResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. @@ -652,14 +557,13 @@ public static DeploymentStackTemplateDefinition ExportTemplateAtManagementGroup( /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult ValidateStackAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack GetAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).ValidateStackAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).GetAtResourceGroupAsync(resourceGroupName, deploymentStackName).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Gets the Deployment stack with the given name. /// /// /// The operations group for this extension method. @@ -673,91 +577,130 @@ public static DeploymentStackValidateResult ValidateStackAtResourceGroup(this ID /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ValidateStackAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task GetAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ValidateStackAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult ValidateStackAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack CreateOrUpdateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).ValidateStackAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).CreateOrUpdateAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ValidateStackAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task CreateOrUpdateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult ValidateStackAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + public static DeploymentStacksDeleteAtResourceGroupHeaders DeleteAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).ValidateStackAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).DeleteAtResourceGroupAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ValidateStackAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task DeleteAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { - return _result.Body; + return _result.Headers; } } /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// /// The operations group for this extension method. @@ -768,13 +711,14 @@ public static DeploymentStackValidateResult ValidateStackAtManagementGroup(this /// /// Name of the deployment stack. /// - public static DeploymentStack BeginCreateOrUpdateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStackTemplateDefinition ExportTemplateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName) { - return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ExportTemplateAtResourceGroupAsync(resourceGroupName, deploymentStackName).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// /// The operations group for this extension method. @@ -788,16 +732,16 @@ public static DeploymentStack BeginCreateOrUpdateAtResourceGroup(this IDeploymen /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ExportTemplateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExportTemplateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation - /// completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. @@ -808,27 +752,14 @@ public static DeploymentStack BeginCreateOrUpdateAtResourceGroup(this IDeploymen /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// - public static DeploymentStacksDeleteAtResourceGroupHeaders BeginDeleteAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static DeploymentStackValidateResult ValidateStackAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).BeginDeleteAtResourceGroupAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ValidateStackAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation - /// completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. @@ -839,69 +770,65 @@ public static DeploymentStack BeginCreateOrUpdateAtResourceGroup(this IDeploymen /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ValidateStackAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginDeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateStackAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { - return _result.Headers; + return _result.Body; } } /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - public static DeploymentStack BeginCreateOrUpdateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// @@ -914,22 +841,29 @@ public static DeploymentStack BeginCreateOrUpdateAtSubscription(this IDeployment /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. /// - public static DeploymentStacksDeleteAtSubscriptionHeaders BeginDeleteAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static DeploymentStacksDeleteAtManagementGroupHeaders BeginDeleteAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).BeginDeleteAtSubscriptionAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginDeleteAtManagementGroupAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Subscription scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// @@ -942,6 +876,10 @@ public static DeploymentStack BeginCreateOrUpdateAtSubscription(this IDeployment /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -949,38 +887,40 @@ public static DeploymentStack BeginCreateOrUpdateAtSubscription(this IDeployment /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginDeleteAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginDeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginDeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStackValidateResult BeginValidateStackAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginValidateStackAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -988,22 +928,52 @@ public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploym /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginValidateStackAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. + /// + /// Name of the deployment stack. + /// + public static DeploymentStack BeginCreateOrUpdateAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + { + return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. /// /// /// Name of the deployment stack. @@ -1017,25 +987,26 @@ public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploym /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. /// - public static DeploymentStacksDeleteAtManagementGroupHeaders BeginDeleteAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + public static DeploymentStacksDeleteAtSubscriptionHeaders BeginDeleteAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).BeginDeleteAtManagementGroupAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginDeleteAtSubscriptionAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// @@ -1048,6 +1019,10 @@ public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploym /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -1055,16 +1030,50 @@ public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploym /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginDeleteAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginDeleteAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginDeleteAtSubscriptionWithHttpMessagesAsync(deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack. + /// + public static DeploymentStackValidateResult BeginValidateStackAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + { + return ((IDeploymentStacksOperations)operations).BeginValidateStackAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + } + + /// + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginValidateStackAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. @@ -1075,14 +1084,13 @@ public static DeploymentStack BeginCreateOrUpdateAtManagementGroup(this IDeploym /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult BeginValidateStackAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStack BeginCreateOrUpdateAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).BeginValidateStackAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginCreateOrUpdateAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// /// The operations group for this extension method. @@ -1096,75 +1104,115 @@ public static DeploymentStackValidateResult BeginValidateStackAtResourceGroup(th /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginValidateStackAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginValidateStackAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult BeginValidateStackAtSubscription(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack) + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + public static DeploymentStacksDeleteAtResourceGroupHeaders BeginDeleteAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) { - return ((IDeploymentStacksOperations)operations).BeginValidateStackAtSubscriptionAsync(deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginDeleteAtResourceGroupAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// /// The operations group for this extension method. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginValidateStackAtSubscriptionAsync(this IDeploymentStacksOperations operations, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginDeleteAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginValidateStackAtSubscriptionWithHttpMessagesAsync(deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginDeleteAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)) { - return _result.Body; + return _result.Headers; } } /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - public static DeploymentStackValidateResult BeginValidateStackAtManagementGroup(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack) + public static DeploymentStackValidateResult BeginValidateStackAtResourceGroup(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack) { - return ((IDeploymentStacksOperations)operations).BeginValidateStackAtManagementGroupAsync(managementGroupId, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).BeginValidateStackAtResourceGroupAsync(resourceGroupName, deploymentStackName, deploymentStack).GetAwaiter().GetResult(); } /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The operations group for this extension method. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -1172,15 +1220,15 @@ public static DeploymentStackValidateResult BeginValidateStackAtManagementGroup( /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginValidateStackAtManagementGroupAsync(this IDeploymentStacksOperations operations, string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginValidateStackAtResourceGroupAsync(this IDeploymentStacksOperations operations, string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginValidateStackAtManagementGroupWithHttpMessagesAsync(managementGroupId, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginValidateStackAtResourceGroupWithHttpMessagesAsync(resourceGroupName, deploymentStackName, deploymentStack, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1188,13 +1236,13 @@ public static DeploymentStackValidateResult BeginValidateStackAtManagementGroup( /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtResourceGroupNext(this IDeploymentStacksOperations operations, string nextPageLink) + public static Microsoft.Rest.Azure.IPage ListAtManagementGroupNext(this IDeploymentStacksOperations operations, string nextPageLink) { - return ((IDeploymentStacksOperations)operations).ListAtResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ListAtManagementGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1205,15 +1253,15 @@ public static Microsoft.Rest.Azure.IPage ListAtResourceGroupNex /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task> ListAtResourceGroupNextAsync(this IDeploymentStacksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task> ListAtManagementGroupNextAsync(this IDeploymentStacksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ListAtResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAtManagementGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1227,7 +1275,7 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext } /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1246,7 +1294,7 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext } } /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1254,13 +1302,13 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtManagementGroupNext(this IDeploymentStacksOperations operations, string nextPageLink) + public static Microsoft.Rest.Azure.IPage ListAtResourceGroupNext(this IDeploymentStacksOperations operations, string nextPageLink) { - return ((IDeploymentStacksOperations)operations).ListAtManagementGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + return ((IDeploymentStacksOperations)operations).ListAtResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The operations group for this extension method. @@ -1271,9 +1319,9 @@ public static Microsoft.Rest.Azure.IPage ListAtManagementGroupN /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task> ListAtManagementGroupNextAsync(this IDeploymentStacksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task> ListAtResourceGroupNextAsync(this IDeploymentStacksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ListAtManagementGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListAtResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperations.cs new file mode 100644 index 000000000000..71ee6073ba4b --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperations.cs @@ -0,0 +1,1463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtManagementGroupOperations operations. + /// + internal partial class DeploymentStacksWhatIfResultsAtManagementGroupOperations : Microsoft.Rest.IServiceOperations, IDeploymentStacksWhatIfResultsAtManagementGroupOperations + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtManagementGroupOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeploymentStacksWhatIfResultsAtManagementGroupOperations (DeploymentStacksClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DeploymentStacksClient + /// + public DeploymentStacksClient Client { get; private set; } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string managementGroupId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + } + if (managementGroupId != null) + { + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + } + if (managementGroupId != null) + { + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, resource, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + } + if (managementGroupId != null) + { + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + + + + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + tracingParameters.Add("unmanageActionResources", unmanageActionResources); + tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); + tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); + tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (unmanageActionResources != null) + { + _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); + } + if (unmanageActionResourceGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); + } + if (unmanageActionManagementGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); + } + if (unmanageActionResourcesWithoutDeleteSupport != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); + } + if (bypassStackOutOfSyncError != null) + { + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginWhatIfWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resource"); + } + if (resource != null) + { + resource.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + } + if (managementGroupId != null) + { + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + tracingParameters.Add("resource", resource); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(resource != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(resource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (managementGroupId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "managementGroupId"); + } + if (managementGroupId != null) + { + if (managementGroupId.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "managementGroupId", 90); + } + if (managementGroupId.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "managementGroupId", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("managementGroupId", managementGroupId); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginWhatIf", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}/whatIf").ToString(); + _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperationsExtensions.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperationsExtensions.cs new file mode 100644 index 000000000000..e90e6fb6b7bf --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtManagementGroupOperationsExtensions.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for DeploymentStacksWhatIfResultsAtManagementGroupOperations + /// + public static partial class DeploymentStacksWhatIfResultsAtManagementGroupOperationsExtensions + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + public static Microsoft.Rest.Azure.IPage List(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).ListAsync(managementGroupId).GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(managementGroupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult Get(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).GetAsync(managementGroupId, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult CreateOrUpdate(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).CreateOrUpdateAsync(managementGroupId, deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + public static void Delete(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + { + ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).DeleteAsync(managementGroupId, deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult WhatIf(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).WhatIfAsync(managementGroupId, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task WhatIfAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.WhatIfWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginCreateOrUpdate(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).BeginCreateOrUpdateAsync(managementGroupId, deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginWhatIf(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).BeginWhatIfAsync(managementGroupId, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginWhatIfAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string managementGroupId, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginWhatIfWithHttpMessagesAsync(managementGroupId, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string nextPageLink) + { + return ((IDeploymentStacksWhatIfResultsAtManagementGroupOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IDeploymentStacksWhatIfResultsAtManagementGroupOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperations.cs new file mode 100644 index 000000000000..f1c9995c5b67 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperations.cs @@ -0,0 +1,1473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtResourceGroupOperations operations. + /// + internal partial class DeploymentStacksWhatIfResultsAtResourceGroupOperations : Microsoft.Rest.IServiceOperations, IDeploymentStacksWhatIfResultsAtResourceGroupOperations + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtResourceGroupOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeploymentStacksWhatIfResultsAtResourceGroupOperations (DeploymentStacksClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DeploymentStacksClient + /// + public DeploymentStacksClient Client { get; private set; } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacksWhatIfResults").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, resource, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + + + + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + tracingParameters.Add("unmanageActionResources", unmanageActionResources); + tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); + tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); + tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (unmanageActionResources != null) + { + _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); + } + if (unmanageActionResourceGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); + } + if (unmanageActionManagementGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); + } + if (unmanageActionResourcesWithoutDeleteSupport != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); + } + if (bypassStackOutOfSyncError != null) + { + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginWhatIfWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resource"); + } + if (resource != null) + { + resource.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + tracingParameters.Add("resource", resource); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(resource != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(resource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginWhatIf", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}/whatIf").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperationsExtensions.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperationsExtensions.cs new file mode 100644 index 000000000000..d6071caca56e --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtResourceGroupOperationsExtensions.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for DeploymentStacksWhatIfResultsAtResourceGroupOperations + /// + public static partial class DeploymentStacksWhatIfResultsAtResourceGroupOperationsExtensions + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static Microsoft.Rest.Azure.IPage List(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult Get(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).GetAsync(resourceGroupName, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult CreateOrUpdate(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).CreateOrUpdateAsync(resourceGroupName, deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + public static void Delete(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + { + ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).DeleteAsync(resourceGroupName, deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult WhatIf(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).WhatIfAsync(resourceGroupName, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task WhatIfAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.WhatIfWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginCreateOrUpdate(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).BeginCreateOrUpdateAsync(resourceGroupName, deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginWhatIf(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).BeginWhatIfAsync(resourceGroupName, deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginWhatIfAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string resourceGroupName, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginWhatIfWithHttpMessagesAsync(resourceGroupName, deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string nextPageLink) + { + return ((IDeploymentStacksWhatIfResultsAtResourceGroupOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IDeploymentStacksWhatIfResultsAtResourceGroupOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperations.cs new file mode 100644 index 000000000000..2ff5e9e8f3c9 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperations.cs @@ -0,0 +1,1367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtSubscriptionOperations operations. + /// + internal partial class DeploymentStacksWhatIfResultsAtSubscriptionOperations : Microsoft.Rest.IServiceOperations, IDeploymentStacksWhatIfResultsAtSubscriptionOperations + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtSubscriptionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeploymentStacksWhatIfResultsAtSubscriptionOperations (DeploymentStacksClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the DeploymentStacksClient + /// + public DeploymentStacksClient Client { get; private set; } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deploymentStacksWhatIfResultName, resource, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + + + + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + tracingParameters.Add("unmanageActionResources", unmanageActionResources); + tracingParameters.Add("unmanageActionResourceGroups", unmanageActionResourceGroups); + tracingParameters.Add("unmanageActionManagementGroups", unmanageActionManagementGroups); + tracingParameters.Add("unmanageActionResourcesWithoutDeleteSupport", unmanageActionResourcesWithoutDeleteSupport); + tracingParameters.Add("bypassStackOutOfSyncError", bypassStackOutOfSyncError); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (unmanageActionResources != null) + { + _queryParameters.Add(string.Format("unmanageAction.Resources={0}", System.Uri.EscapeDataString(unmanageActionResources))); + } + if (unmanageActionResourceGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourceGroups={0}", System.Uri.EscapeDataString(unmanageActionResourceGroups))); + } + if (unmanageActionManagementGroups != null) + { + _queryParameters.Add(string.Format("unmanageAction.ManagementGroups={0}", System.Uri.EscapeDataString(unmanageActionManagementGroups))); + } + if (unmanageActionResourcesWithoutDeleteSupport != null) + { + _queryParameters.Add(string.Format("unmanageAction.ResourcesWithoutDeleteSupport={0}", System.Uri.EscapeDataString(unmanageActionResourcesWithoutDeleteSupport))); + } + if (bypassStackOutOfSyncError != null) + { + _queryParameters.Add(string.Format("bypassStackOutOfSyncError={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(bypassStackOutOfSyncError, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginWhatIfWithHttpMessagesAsync(deploymentStacksWhatIfResultName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resource == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resource"); + } + if (resource != null) + { + resource.Validate(); + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + tracingParameters.Add("resource", resource); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(resource != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(resource, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (deploymentStacksWhatIfResultName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentStacksWhatIfResultName"); + } + if (deploymentStacksWhatIfResultName != null) + { + if (deploymentStacksWhatIfResultName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentStacksWhatIfResultName", 90); + } + if (deploymentStacksWhatIfResultName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentStacksWhatIfResultName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentStacksWhatIfResultName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentStacksWhatIfResultName", "^[-\\w\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("deploymentStacksWhatIfResultName", deploymentStacksWhatIfResultName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginWhatIf", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacksWhatIfResults/{deploymentStacksWhatIfResultName}/whatIf").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{deploymentStacksWhatIfResultName}", System.Uri.EscapeDataString(deploymentStacksWhatIfResultName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperationsExtensions.cs b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperationsExtensions.cs new file mode 100644 index 000000000000..16e7829fee01 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/DeploymentStacksWhatIfResultsAtSubscriptionOperationsExtensions.cs @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for DeploymentStacksWhatIfResultsAtSubscriptionOperations + /// + public static partial class DeploymentStacksWhatIfResultsAtSubscriptionOperationsExtensions + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult Get(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).GetAsync(deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult CreateOrUpdate(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).CreateOrUpdateAsync(deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + public static void Delete(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?)) + { + ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).DeleteAsync(deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deploymentStacksWhatIfResultName, unmanageActionResources, unmanageActionResourceGroups, unmanageActionManagementGroups, unmanageActionResourcesWithoutDeleteSupport, bypassStackOutOfSyncError, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult WhatIf(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).WhatIfAsync(deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task WhatIfAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.WhatIfWithHttpMessagesAsync(deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginCreateOrUpdate(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).BeginCreateOrUpdateAsync(deploymentStacksWhatIfResultName, resource).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deploymentStacksWhatIfResultName, resource, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + public static DeploymentStacksWhatIfResult BeginWhatIf(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).BeginWhatIfAsync(deploymentStacksWhatIfResultName).GetAwaiter().GetResult(); + } + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginWhatIfAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string deploymentStacksWhatIfResultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginWhatIfWithHttpMessagesAsync(deploymentStacksWhatIfResultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string nextPageLink) + { + return ((IDeploymentStacksWhatIfResultsAtSubscriptionOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IDeploymentStacksWhatIfResultsAtSubscriptionOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksClient.cs b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksClient.cs index 397c42351b8b..32742884fc59 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksClient.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksClient.cs @@ -43,9 +43,9 @@ public partial interface IDeploymentStacksClient : System.IDisposable /// - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// - string SubscriptionId { get; set;} + System.Guid SubscriptionId { get; set;} /// @@ -74,5 +74,20 @@ public partial interface IDeploymentStacksClient : System.IDisposable /// IDeploymentStacksOperations DeploymentStacks { get; } + /// + /// Gets the IDeploymentStacksWhatIfResultsAtManagementGroupOperations + /// + IDeploymentStacksWhatIfResultsAtManagementGroupOperations DeploymentStacksWhatIfResultsAtManagementGroup { get; } + + /// + /// Gets the IDeploymentStacksWhatIfResultsAtSubscriptionOperations + /// + IDeploymentStacksWhatIfResultsAtSubscriptionOperations DeploymentStacksWhatIfResultsAtSubscription { get; } + + /// + /// Gets the IDeploymentStacksWhatIfResultsAtResourceGroupOperations + /// + IDeploymentStacksWhatIfResultsAtResourceGroupOperations DeploymentStacksWhatIfResultsAtResourceGroup { get; } + } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksOperations.cs index a964b79f4c95..2de3dd4ec6b3 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksOperations.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksOperations.cs @@ -14,56 +14,13 @@ namespace Microsoft.Azure.Management.Resources public partial interface IDeploymentStacksOperations { /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// - /// Lists all the Deployment stacks within the specified Resource Group. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - System.Threading.Tasks.Task>> ListAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// Lists all the Deployment stacks within the specified Subscription. - /// - /// - /// Lists all the Deployment stacks within the specified Subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - System.Threading.Tasks.Task>> ListAtSubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - - /// - /// Lists all the Deployment stacks within the specified Management Group. - /// - /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -80,20 +37,17 @@ public partial interface IDeploymentStacksOperations System.Threading.Tasks.Task>> ListAtManagementGroupWithHttpMessagesAsync(string managementGroupId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Gets the Deployment stack with the given name. /// /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Gets the Deployment stack with the given name. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. - /// /// /// The headers that will be added to request. /// @@ -106,20 +60,23 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> GetAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Gets a Deployment stack with a given name at Resource Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Gets a Deployment stack with a given name at Resource Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// + /// + /// Resource create parameters. + /// /// /// The headers that will be added to request. /// @@ -132,18 +89,18 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> GetAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. @@ -157,6 +114,10 @@ public partial interface IDeploymentStacksOperations /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -170,20 +131,22 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> DeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> DeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. - /// /// /// The headers that will be added to request. /// @@ -196,17 +159,25 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ExportTemplateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Gets a Deployment stack with a given name at Subscription scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Gets a Deployment stack with a given name at Subscription scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// + /// + /// The content of the action request + /// /// /// The headers that will be added to request. /// @@ -219,32 +190,14 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> GetAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Lists Deployment stacks at the specified scope. /// /// - /// Deletes a Deployment stack by name at Subscription scope. When operation - /// completes, status code 200 returned without content. + /// Lists Deployment stacks at the specified scope. /// - /// - /// Name of the deployment stack. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// /// /// The headers that will be added to request. /// @@ -254,23 +207,20 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> DeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListAtSubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Gets the Deployment stack with the given name. /// /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Gets the Deployment stack with the given name. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. - /// /// /// The headers that will be added to request. /// @@ -283,20 +233,20 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> CreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> GetAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Gets a Deployment stack with a given name at Management Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Gets a Deployment stack with a given name at Management Group scope. + /// Creates or updates a Deployment stack at the specified scope. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// + /// + /// Resource create parameters. + /// /// /// The headers that will be added to request. /// @@ -309,19 +259,16 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> GetAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// - /// - /// Management Group id. - /// /// /// Name of the deployment stack. /// @@ -334,6 +281,10 @@ public partial interface IDeploymentStacksOperations /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -347,19 +298,16 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> DeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> DeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Exports the template used to create the Deployment stack at Resource Group + /// Exports the template used to create the Deployment stack at the specified /// scope. /// /// - /// Exports the template used to create the Deployment stack at Resource Group + /// Exports the template used to create the Deployment stack at the specified /// scope. /// - /// - /// The name of the resource group. The name is case insensitive. - /// /// /// Name of the deployment stack. /// @@ -375,19 +323,22 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ExportTemplateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ExportTemplateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Exports the template used to create the Deployment stack at Subscription - /// scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Exports the template used to create the Deployment stack at Subscription - /// scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// Name of the deployment stack. /// + /// + /// The content of the action request + /// /// /// The headers that will be added to request. /// @@ -400,21 +351,16 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ExportTemplateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Exports the template used to create the Deployment stack at Management - /// Group scope. + /// Lists Deployment stacks at the specified scope. /// /// - /// Exports the template used to create the Deployment stack at Management - /// Group scope. + /// Lists Deployment stacks at the specified scope. /// - /// - /// Management Group id. - /// - /// - /// Name of the deployment stack. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -428,15 +374,13 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ExportTemplateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task>> ListAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Gets the Deployment stack with the given name. /// /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Gets the Deployment stack with the given name. /// /// /// The name of the resource group. The name is case insensitive. @@ -444,9 +388,6 @@ public partial interface IDeploymentStacksOperations /// /// Name of the deployment stack. /// - /// - /// Deployment stack to validate. - /// /// /// The headers that will be added to request. /// @@ -459,21 +400,22 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> GetAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// Resource create parameters. /// /// /// The headers that will be added to request. @@ -487,24 +429,38 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// - /// - /// Deployment stack to validate. + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. /// /// /// The headers that will be added to request. @@ -515,16 +471,15 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// - System.Threading.Tasks.Task> ValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> DeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// - /// Creates or updates a Deployment stack at Resource Group scope. + /// Exports the template used to create the Deployment stack at the specified + /// scope. /// /// /// The name of the resource group. The name is case insensitive. @@ -532,9 +487,6 @@ public partial interface IDeploymentStacksOperations /// /// Name of the deployment stack. /// - /// - /// Deployment stack supplied to the operation. - /// /// /// The headers that will be added to request. /// @@ -547,15 +499,15 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ExportTemplateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation - /// completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Deletes a Deployment stack by name at Resource Group scope. When operation - /// completes, status code 200 returned without content. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// /// The name of the resource group. The name is case insensitive. @@ -563,18 +515,8 @@ public partial interface IDeploymentStacksOperations /// /// Name of the deployment stack. /// - /// - /// Flag to indicate delete rather than detach for unmanaged resources. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged resource groups. - /// - /// - /// Flag to indicate delete rather than detach for unmanaged management groups. - /// - /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. + /// + /// The content of the action request /// /// /// The headers that will be added to request. @@ -585,19 +527,25 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> BeginDeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> ValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Creates or updates a Deployment stack at Subscription scope. + /// Creates or updates a Deployment stack at the specified scope. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// - /// Deployment stack supplied to the operation. + /// Resource create parameters. /// /// /// The headers that will be added to request. @@ -611,16 +559,19 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Subscription scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// /// - /// Deletes a Deployment stack by name at Subscription scope. When operation + /// Deletes a Deployment stack by name at the specified scope. When operation /// completes, status code 200 returned without content. /// + /// + /// The name of the management group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// @@ -633,6 +584,10 @@ public partial interface IDeploymentStacksOperations /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -646,22 +601,24 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> BeginDeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginDeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Creates or updates a Deployment stack at Management Group scope. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Management Group id. + /// The name of the management group. The name is case insensitive. /// /// /// Name of the deployment stack. /// /// - /// Deployment stack supplied to the operation. + /// The content of the action request /// /// /// The headers that will be added to request. @@ -675,19 +632,42 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginCreateOrUpdateAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Deletes a Deployment stack by name at Management Group scope. When - /// operation completes, status code 200 returned without content. + /// Creates or updates a Deployment stack at the specified scope. /// - /// - /// Management Group id. + /// + /// Name of the deployment stack. + /// + /// + /// Resource create parameters. /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// /// /// Name of the deployment stack. /// @@ -700,6 +680,10 @@ public partial interface IDeploymentStacksOperations /// /// Flag to indicate delete rather than detach for unmanaged management groups. /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// /// /// Flag to bypass service errors that indicate the stack resource list is not /// correctly synchronized. @@ -713,24 +697,21 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when the operation returned an invalid status code /// - System.Threading.Tasks.Task> BeginDeleteAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginDeleteAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// /// - /// Runs preflight validation on the Resource Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. /// - /// - /// The name of the resource group. The name is case insensitive. - /// /// /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// The content of the action request /// /// /// The headers that will be added to request. @@ -744,21 +725,22 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// /// - /// Runs preflight validation on the Subscription scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Creates or updates a Deployment stack at the specified scope. /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// Resource create parameters. /// /// /// The headers that will be added to request. @@ -772,24 +754,66 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginValidateStackAtSubscriptionWithHttpMessagesAsync(string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// /// - /// Runs preflight validation on the Management Group scoped Deployment stack - /// template to verify its acceptance to Azure Resource Manager. + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. /// - /// - /// Management Group id. + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> BeginDeleteAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. + /// + /// + /// Runs preflight validation on the Deployment stack template at the specified + /// scope to verify its acceptance to Azure Resource Manager. + /// + /// + /// The name of the resource group. The name is case insensitive. /// /// /// Name of the deployment stack. /// /// - /// Deployment stack to validate. + /// The content of the action request /// /// /// The headers that will be added to request. @@ -803,13 +827,13 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginValidateStackAtManagementGroupWithHttpMessagesAsync(string managementGroupId, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginValidateStackAtResourceGroupWithHttpMessagesAsync(string resourceGroupName, string deploymentStackName, DeploymentStack deploymentStack, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// - /// Lists all the Deployment stacks within the specified Resource Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -826,13 +850,13 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task>> ListAtResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task>> ListAtManagementGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Lists Deployment stacks at the specified scope. /// /// - /// Lists all the Deployment stacks within the specified Subscription. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -852,10 +876,10 @@ public partial interface IDeploymentStacksOperations System.Threading.Tasks.Task>> ListAtSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// - /// Lists all the Deployment stacks within the specified Management Group. + /// Lists Deployment stacks at the specified scope. /// /// /// The NextLink from the previous successful call to List operation. @@ -872,7 +896,7 @@ public partial interface IDeploymentStacksOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task>> ListAtManagementGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task>> ListAtResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtManagementGroupOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtManagementGroupOperations.cs new file mode 100644 index 000000000000..c4f27b6fc6ab --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtManagementGroupOperations.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtManagementGroupOperations operations. + /// + public partial interface IDeploymentStacksWhatIfResultsAtManagementGroupOperations + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string managementGroupId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the management group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string managementGroupId, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtResourceGroupOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtResourceGroupOperations.cs new file mode 100644 index 000000000000..44b1a269e17d --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtResourceGroupOperations.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtResourceGroupOperations operations. + /// + public partial interface IDeploymentStacksWhatIfResultsAtResourceGroupOperations + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string resourceGroupName, string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtSubscriptionOperations.cs b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtSubscriptionOperations.cs new file mode 100644 index 000000000000..ffc726a9f7c1 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/IDeploymentStacksWhatIfResultsAtSubscriptionOperations.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// DeploymentStacksWhatIfResultsAtSubscriptionOperations operations. + /// + public partial interface IDeploymentStacksWhatIfResultsAtSubscriptionOperations + { + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// Gets the Deployment stack with the given name. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Deletes a Deployment stack by name at the specified scope. When operation + /// completes, status code 200 returned without content. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resources. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged resource groups. + /// + /// + /// Flag to indicate delete rather than detach for unmanaged management groups. + /// + /// + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// + /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, string unmanageActionResources = default(string), string unmanageActionResourceGroups = default(string), string unmanageActionManagementGroups = default(string), string unmanageActionResourcesWithoutDeleteSupport = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> WhatIfWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Creates or updates a Deployment stack at the specified scope. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// Resource create parameters. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, DeploymentStacksWhatIfResult resource, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Returns property-level changes that will be made by the deployment if + /// executed. + /// + /// + /// Name of the deployment stack what-if result. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginWhatIfWithHttpMessagesAsync(string deploymentStacksWhatIfResultName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// Lists Deployment stacks at the specified scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ActionOnUnmanage.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ActionOnUnmanage.cs index be1e533088ec..53137a1ba1ce 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ActionOnUnmanage.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ActionOnUnmanage.cs @@ -39,12 +39,17 @@ public ActionOnUnmanage() /// delete the resource from Azure. Detach will leave the resource in it's /// current state. /// Possible values include: 'delete', 'detach' - public ActionOnUnmanage(string resources, string resourceGroups = default(string), string managementGroups = default(string)) + + /// Some resources do not support deletion. This flag will denote how the + /// stack should handle those resources. + /// Possible values include: 'detach', 'fail' + public ActionOnUnmanage(string resources, string resourceGroups = default(string), string managementGroups = default(string), string resourcesWithoutDeleteSupport = default(string)) { this.Resources = resources; this.ResourceGroups = resourceGroups; this.ManagementGroups = managementGroups; + this.ResourcesWithoutDeleteSupport = resourcesWithoutDeleteSupport; CustomInit(); } @@ -77,6 +82,13 @@ public ActionOnUnmanage() /// [Newtonsoft.Json.JsonProperty(PropertyName = "managementGroups")] public string ManagementGroups {get; set; } + + /// + /// Gets or sets some resources do not support deletion. This flag will denote + /// how the stack should handle those resources. Possible values include: 'detach', 'fail' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourcesWithoutDeleteSupport")] + public string ResourcesWithoutDeleteSupport {get; set; } /// /// Validate the object. /// @@ -92,6 +104,7 @@ public virtual void Validate() + } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DenyStatusMode.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DenyStatusMode.cs index 6bcce5b933d9..11d90e43ebd3 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DenyStatusMode.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DenyStatusMode.cs @@ -41,5 +41,9 @@ public static class DenyStatusMode /// No denyAssignments have been applied. /// public const string None = "none"; + /// + /// The denyAssignment status is unknown. + /// + public const string Unknown = "unknown"; } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtension.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtension.cs new file mode 100644 index 000000000000..28a272a834f4 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtension.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Details about the usage of a deployment extension. + /// + public partial class DeploymentExtension + { + /// + /// Initializes a new instance of the DeploymentExtension class. + /// + public DeploymentExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentExtension class. + /// + + /// The extension name. + /// + + /// The extension version. + /// + + /// The configuration ID of the extension usage. It uniquely identifies a + /// target the extension deploys to. + /// + + /// The configuration used for deployment. The keys of this object should align + /// with the extension config schema. + /// + public DeploymentExtension(string name, string version, string configId = default(string), System.Collections.Generic.IDictionary config = default(System.Collections.Generic.IDictionary)) + + { + this.Name = name; + this.Version = version; + this.ConfigId = configId; + this.Config = config; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the extension name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the extension version. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } + + /// + /// Gets or sets the configuration ID of the extension usage. It uniquely + /// identifies a target the extension deploys to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "configId")] + public string ConfigId {get; set; } + + /// + /// Gets or sets the configuration used for deployment. The keys of this object + /// should align with the extension config schema. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "config")] + public System.Collections.Generic.IDictionary Config {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + if (this.Version == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Version"); + } + + + + if (this.Config != null) + { + foreach (var valueElement in this.Config.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtensionConfigItem.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtensionConfigItem.cs new file mode 100644 index 000000000000..61edeef8ec9d --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExtensionConfigItem.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The value or how to get a value for an extension config property. + /// + public partial class DeploymentExtensionConfigItem + { + /// + /// Initializes a new instance of the DeploymentExtensionConfigItem class. + /// + public DeploymentExtensionConfigItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentExtensionConfigItem class. + /// + + /// The type of the value. + /// + + /// The value of the config item. The type is determined by the extension + /// config schema. + /// + + /// The key vault reference of the config item. + /// + public DeploymentExtensionConfigItem(string type = default(string), object value = default(object), KeyVaultParameterReference keyVaultReference = default(KeyVaultParameterReference)) + + { + this.Type = type; + this.Value = value; + this.KeyVaultReference = keyVaultReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of the value. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets or sets the value of the config item. The type is determined by the + /// extension config schema. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public object Value {get; set; } + + /// + /// Gets or sets the key vault reference of the config item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultReference")] + public KeyVaultParameterReference KeyVaultReference {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.KeyVaultReference != null) + { + this.KeyVaultReference.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInput.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInput.cs new file mode 100644 index 000000000000..36d8ddb01ff6 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInput.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Deployment external input for parameterization. + /// + public partial class DeploymentExternalInput + { + /// + /// Initializes a new instance of the DeploymentExternalInput class. + /// + public DeploymentExternalInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentExternalInput class. + /// + + /// External input value. + /// + public DeploymentExternalInput(object value) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets external input value. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public object Value {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Value == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); + } + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInputDefinition.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInputDefinition.cs new file mode 100644 index 000000000000..c0097099e26c --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentExternalInputDefinition.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Deployment external input definition for parameterization. + /// + public partial class DeploymentExternalInputDefinition + { + /// + /// Initializes a new instance of the DeploymentExternalInputDefinition class. + /// + public DeploymentExternalInputDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentExternalInputDefinition class. + /// + + /// The kind of external input. + /// + + /// Configuration for the external input. + /// + public DeploymentExternalInputDefinition(string kind, object config = default(object)) + + { + this.Kind = kind; + this.Config = config; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the kind of external input. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; set; } + + /// + /// Gets or sets configuration for the external input. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "config")] + public object Config {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Kind == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Kind"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentParameter.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentParameter.cs index caac0c646dda..8f60ca31bbf6 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentParameter.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentParameter.cs @@ -32,12 +32,16 @@ public DeploymentParameter() /// Azure Key Vault parameter reference. /// - public DeploymentParameter(object value = default(object), string type = default(string), KeyVaultParameterReference reference = default(KeyVaultParameterReference)) + + /// Input expression to the parameter. + /// + public DeploymentParameter(object value = default(object), string type = default(string), KeyVaultParameterReference reference = default(KeyVaultParameterReference), string expression = default(string)) { this.Value = value; this.Type = type; this.Reference = reference; + this.Expression = expression; CustomInit(); } @@ -64,6 +68,12 @@ public DeploymentParameter() /// [Newtonsoft.Json.JsonProperty(PropertyName = "reference")] public KeyVaultParameterReference Reference {get; set; } + + /// + /// Gets or sets input expression to the parameter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expression")] + public string Expression {get; set; } /// /// Validate the object. /// @@ -78,6 +88,7 @@ public virtual void Validate() { this.Reference.Validate(); } + } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStack.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStack.cs index e2fd03927cb5..4793f93dc721 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStack.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStack.cs @@ -11,7 +11,7 @@ namespace Microsoft.Azure.Management.Resources.Models /// Deployment stack object. /// [Microsoft.Rest.Serialization.JsonTransformation] - public partial class DeploymentStack : AzureResourceBase + public partial class DeploymentStack : ProxyResource { /// /// Initializes a new instance of the DeploymentStack class. @@ -25,29 +25,35 @@ public DeploymentStack() /// Initializes a new instance of the DeploymentStack class. /// - /// String Id used to locate any resource on Azure. + /// Fully qualified resource ID for the resource. E.g. + /// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" /// - /// Name of this resource. + /// The name of the resource /// - /// Type of this resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// /// Azure Resource Manager metadata containing createdBy and modifiedBy /// information. /// - /// The location of the Deployment stack. It cannot be changed after creation. - /// It must be one of the supported Azure locations. + /// The geo-location where the resource lives. Required for subscription and + /// management group scoped stacks. The location is inherited from the resource + /// group for resource group scoped stacks. /// - /// Deployment stack resource tags. + /// Resource tags. /// /// Defines how resources deployed by the stack are locked. /// + /// The validation level of the deployment stack + /// Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + /// The error detail. /// @@ -72,6 +78,17 @@ public DeploymentStack() /// property, but not both. /// + /// The deployment extension configs. Keys of this object are extension aliases + /// as defined in the deployment template. + /// + + /// External input values, used by external tooling for parameter evaluation. + /// + + /// External input definitions, used by external tooling to define expected + /// external input values. + /// + /// Defines the behavior of resources that are no longer managed after the /// Deployment stack is updated or deleted. /// @@ -79,10 +96,6 @@ public DeploymentStack() /// The debug setting of the deployment. /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// - /// The scope at which the initial deployment should be created. If a scope is /// not specified, it will default to the scope of the deployment stack. Valid /// scopes are: management group (format: @@ -98,12 +111,16 @@ public DeploymentStack() /// State of the deployment stack. /// Possible values include: 'creating', 'validating', 'waiting', 'deploying', /// 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', - /// 'failed', 'canceled', 'deleting' + /// 'failed', 'canceled', 'deleting', 'initializing', 'running' /// The correlation id of the last Deployment stack upsert or delete operation. /// It is in GUID format and is used for tracing. /// + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// An array of resources that were detached during the most recent Deployment /// stack update. Detached means that the resource was removed from the /// template, but no relevant deletion operations were specified. So, the @@ -122,6 +139,10 @@ public DeploymentStack() /// An array of resources currently managed by the deployment stack. /// + /// The extensions used during deployment. Contains extension data for all + /// extensible resources managed by the stack. + /// + /// The resourceId of the deployment resource created by the deployment stack. /// @@ -130,29 +151,34 @@ public DeploymentStack() /// The duration of the last successful Deployment stack update. /// - public DeploymentStack(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), DenySettings denySettings = default(DenySettings), ErrorDetail error = default(ErrorDetail), object template = default(object), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksParametersLink parametersLink = default(DeploymentStacksParametersLink), ActionOnUnmanage actionOnUnmanage = default(ActionOnUnmanage), DeploymentStacksDebugSetting debugSetting = default(DeploymentStacksDebugSetting), bool? bypassStackOutOfSyncError = default(bool?), string deploymentScope = default(string), string description = default(string), string provisioningState = default(string), string correlationId = default(string), System.Collections.Generic.IList detachedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deletedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList failedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), string deploymentId = default(string), object outputs = default(object), string duration = default(string)) + public DeploymentStack(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), DenySettings denySettings = default(DenySettings), string validationLevel = default(string), ErrorDetail error = default(ErrorDetail), System.Collections.Generic.IDictionary template = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksParametersLink parametersLink = default(DeploymentStacksParametersLink), System.Collections.Generic.IDictionary> extensionConfigs = default(System.Collections.Generic.IDictionary>), System.Collections.Generic.IDictionary externalInputs = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary externalInputDefinitions = default(System.Collections.Generic.IDictionary), ActionOnUnmanage actionOnUnmanage = default(ActionOnUnmanage), DeploymentStacksDebugSetting debugSetting = default(DeploymentStacksDebugSetting), string deploymentScope = default(string), string description = default(string), string provisioningState = default(string), string correlationId = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.IList detachedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deletedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList failedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deploymentExtensions = default(System.Collections.Generic.IList), string deploymentId = default(string), System.Collections.Generic.IDictionary outputs = default(System.Collections.Generic.IDictionary), string duration = default(string)) : base(id, name, type, systemData) { this.Location = location; this.Tags = tags; this.DenySettings = denySettings; + this.ValidationLevel = validationLevel; this.Error = error; this.Template = template; this.TemplateLink = templateLink; this.Parameters = parameters; this.ParametersLink = parametersLink; + this.ExtensionConfigs = extensionConfigs; + this.ExternalInputs = externalInputs; + this.ExternalInputDefinitions = externalInputDefinitions; this.ActionOnUnmanage = actionOnUnmanage; this.DebugSetting = debugSetting; - this.BypassStackOutOfSyncError = bypassStackOutOfSyncError; this.DeploymentScope = deploymentScope; this.Description = description; this.ProvisioningState = provisioningState; this.CorrelationId = correlationId; + this.BypassStackOutOfSyncError = bypassStackOutOfSyncError; this.DetachedResources = detachedResources; this.DeletedResources = deletedResources; this.FailedResources = failedResources; this.Resources = resources; + this.DeploymentExtensions = deploymentExtensions; this.DeploymentId = deploymentId; this.Outputs = outputs; this.Duration = duration; @@ -166,14 +192,15 @@ public DeploymentStack() /// - /// Gets or sets the location of the Deployment stack. It cannot be changed - /// after creation. It must be one of the supported Azure locations. + /// Gets or sets the geo-location where the resource lives. Required for + /// subscription and management group scoped stacks. The location is inherited + /// from the resource group for resource group scoped stacks. /// [Newtonsoft.Json.JsonProperty(PropertyName = "location")] public string Location {get; set; } /// - /// Gets or sets deployment stack resource tags. + /// Gets or sets resource tags. /// [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] public System.Collections.Generic.IDictionary Tags {get; set; } @@ -184,6 +211,12 @@ public DeploymentStack() [Newtonsoft.Json.JsonProperty(PropertyName = "properties.denySettings")] public DenySettings DenySettings {get; set; } + /// + /// Gets or sets the validation level of the deployment stack Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.validationLevel")] + public string ValidationLevel {get; set; } + /// /// Gets or sets the error detail. /// @@ -197,7 +230,7 @@ public DeploymentStack() /// either the templateLink property or the template property, but not both. /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.template")] - public object Template {get; set; } + public System.Collections.Generic.IDictionary Template {get; set; } /// /// Gets or sets the URI of the template. Use either the templateLink property @@ -224,6 +257,27 @@ public DeploymentStack() [Newtonsoft.Json.JsonProperty(PropertyName = "properties.parametersLink")] public DeploymentStacksParametersLink ParametersLink {get; set; } + /// + /// Gets or sets the deployment extension configs. Keys of this object are + /// extension aliases as defined in the deployment template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.extensionConfigs")] + public System.Collections.Generic.IDictionary> ExtensionConfigs {get; set; } + + /// + /// Gets or sets external input values, used by external tooling for parameter + /// evaluation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalInputs")] + public System.Collections.Generic.IDictionary ExternalInputs {get; set; } + + /// + /// Gets or sets external input definitions, used by external tooling to define + /// expected external input values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.externalInputDefinitions")] + public System.Collections.Generic.IDictionary ExternalInputDefinitions {get; set; } + /// /// Gets or sets defines the behavior of resources that are no longer managed /// after the Deployment stack is updated or deleted. @@ -237,13 +291,6 @@ public DeploymentStack() [Newtonsoft.Json.JsonProperty(PropertyName = "properties.debugSetting")] public DeploymentStacksDebugSetting DebugSetting {get; set; } - /// - /// Gets or sets flag to bypass service errors that indicate the stack resource - /// list is not correctly synchronized. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.bypassStackOutOfSyncError")] - public bool? BypassStackOutOfSyncError {get; set; } - /// /// Gets or sets the scope at which the initial deployment should be created. /// If a scope is not specified, it will default to the scope of the deployment @@ -263,7 +310,7 @@ public DeploymentStack() public string Description {get; set; } /// - /// Gets state of the deployment stack. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', 'failed', 'canceled', 'deleting' + /// Gets state of the deployment stack. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', 'failed', 'canceled', 'deleting', 'initializing', 'running' /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState {get; private set; } @@ -275,6 +322,13 @@ public DeploymentStack() [Newtonsoft.Json.JsonProperty(PropertyName = "properties.correlationId")] public string CorrelationId {get; private set; } + /// + /// Gets or sets flag to bypass service errors that indicate the stack resource + /// list is not correctly synchronized. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.bypassStackOutOfSyncError")] + public bool? BypassStackOutOfSyncError {get; set; } + /// /// Gets an array of resources that were detached during the most recent /// Deployment stack update. Detached means that the resource was removed from @@ -305,6 +359,13 @@ public DeploymentStack() [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resources")] public System.Collections.Generic.IList Resources {get; private set; } + /// + /// Gets the extensions used during deployment. Contains extension data for all + /// extensible resources managed by the stack. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deploymentExtensions")] + public System.Collections.Generic.IList DeploymentExtensions {get; private set; } + /// /// Gets the resourceId of the deployment resource created by the deployment /// stack. @@ -317,7 +378,7 @@ public DeploymentStack() /// stack. /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.outputs")] - public object Outputs {get; private set; } + public System.Collections.Generic.IDictionary Outputs {get; private set; } /// /// Gets the duration of the last successful Deployment stack update. @@ -341,6 +402,7 @@ public virtual void Validate() + if (this.Parameters != null) { foreach (var valueElement in this.Parameters.Values) @@ -355,6 +417,42 @@ public virtual void Validate() { this.ParametersLink.Validate(); } + if (this.ExtensionConfigs != null) + { + foreach (var valueElement in this.ExtensionConfigs.Values) + { + if (valueElement != null) + { + foreach (var valueElement1 in valueElement.Values) + { + if (valueElement1 != null) + { + valueElement1.Validate(); + } + } + } + } + } + if (this.ExternalInputs != null) + { + foreach (var valueElement in this.ExternalInputs.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ExternalInputDefinitions != null) + { + foreach (var valueElement in this.ExternalInputDefinitions.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } if (this.ActionOnUnmanage != null) { this.ActionOnUnmanage.Validate(); @@ -370,10 +468,56 @@ public virtual void Validate() } - - - - + if (this.DetachedResources != null) + { + foreach (var element in this.DetachedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DeletedResources != null) + { + foreach (var element in this.DeletedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.FailedResources != null) + { + foreach (var element in this.FailedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.Resources != null) + { + foreach (var element in this.Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DeploymentExtensions != null) + { + foreach (var element in this.DeploymentExtensions) + { + if (element != null) + { + element.Validate(); + } + } + } diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProperties.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProperties.cs index 075a0b20b58b..79d36058a4fd 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProperties.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProperties.cs @@ -10,7 +10,7 @@ namespace Microsoft.Azure.Management.Resources.Models /// /// Deployment stack properties. /// - public partial class DeploymentStackProperties : DeploymentStacksError + public partial class DeploymentStackProperties { /// /// Initializes a new instance of the DeploymentStackProperties class. @@ -48,6 +48,17 @@ public DeploymentStackProperties() /// property, but not both. /// + /// The deployment extension configs. Keys of this object are extension aliases + /// as defined in the deployment template. + /// + + /// External input values, used by external tooling for parameter evaluation. + /// + + /// External input definitions, used by external tooling to define expected + /// external input values. + /// + /// Defines the behavior of resources that are no longer managed after the /// Deployment stack is updated or deleted. /// @@ -55,10 +66,6 @@ public DeploymentStackProperties() /// The debug setting of the deployment. /// - /// Flag to bypass service errors that indicate the stack resource list is not - /// correctly synchronized. - /// - /// The scope at which the initial deployment should be created. If a scope is /// not specified, it will default to the scope of the deployment stack. Valid /// scopes are: management group (format: @@ -77,12 +84,19 @@ public DeploymentStackProperties() /// State of the deployment stack. /// Possible values include: 'creating', 'validating', 'waiting', 'deploying', /// 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', - /// 'failed', 'canceled', 'deleting' + /// 'failed', 'canceled', 'deleting', 'initializing', 'running' /// The correlation id of the last Deployment stack upsert or delete operation. /// It is in GUID format and is used for tracing. /// + /// The validation level of the deployment stack + /// Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + + /// Flag to bypass service errors that indicate the stack resource list is not + /// correctly synchronized. + /// + /// An array of resources that were detached during the most recent Deployment /// stack update. Detached means that the resource was removed from the /// template, but no relevant deletion operations were specified. So, the @@ -101,6 +115,10 @@ public DeploymentStackProperties() /// An array of resources currently managed by the deployment stack. /// + /// The extensions used during deployment. Contains extension data for all + /// extensible resources managed by the stack. + /// + /// The resourceId of the deployment resource created by the deployment stack. /// @@ -109,26 +127,31 @@ public DeploymentStackProperties() /// The duration of the last successful Deployment stack update. /// - public DeploymentStackProperties(ActionOnUnmanage actionOnUnmanage, DenySettings denySettings, ErrorDetail error = default(ErrorDetail), object template = default(object), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksParametersLink parametersLink = default(DeploymentStacksParametersLink), DeploymentStacksDebugSetting debugSetting = default(DeploymentStacksDebugSetting), bool? bypassStackOutOfSyncError = default(bool?), string deploymentScope = default(string), string description = default(string), string provisioningState = default(string), string correlationId = default(string), System.Collections.Generic.IList detachedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deletedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList failedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), string deploymentId = default(string), object outputs = default(object), string duration = default(string)) + public DeploymentStackProperties(ActionOnUnmanage actionOnUnmanage, DenySettings denySettings, ErrorDetail error = default(ErrorDetail), System.Collections.Generic.IDictionary template = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksParametersLink parametersLink = default(DeploymentStacksParametersLink), System.Collections.Generic.IDictionary> extensionConfigs = default(System.Collections.Generic.IDictionary>), System.Collections.Generic.IDictionary externalInputs = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary externalInputDefinitions = default(System.Collections.Generic.IDictionary), DeploymentStacksDebugSetting debugSetting = default(DeploymentStacksDebugSetting), string deploymentScope = default(string), string description = default(string), string provisioningState = default(string), string correlationId = default(string), string validationLevel = default(string), bool? bypassStackOutOfSyncError = default(bool?), System.Collections.Generic.IList detachedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deletedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList failedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deploymentExtensions = default(System.Collections.Generic.IList), string deploymentId = default(string), System.Collections.Generic.IDictionary outputs = default(System.Collections.Generic.IDictionary), string duration = default(string)) - : base(error) { + this.Error = error; this.Template = template; this.TemplateLink = templateLink; this.Parameters = parameters; this.ParametersLink = parametersLink; + this.ExtensionConfigs = extensionConfigs; + this.ExternalInputs = externalInputs; + this.ExternalInputDefinitions = externalInputDefinitions; this.ActionOnUnmanage = actionOnUnmanage; this.DebugSetting = debugSetting; - this.BypassStackOutOfSyncError = bypassStackOutOfSyncError; this.DeploymentScope = deploymentScope; this.Description = description; this.DenySettings = denySettings; this.ProvisioningState = provisioningState; this.CorrelationId = correlationId; + this.ValidationLevel = validationLevel; + this.BypassStackOutOfSyncError = bypassStackOutOfSyncError; this.DetachedResources = detachedResources; this.DeletedResources = deletedResources; this.FailedResources = failedResources; this.Resources = resources; + this.DeploymentExtensions = deploymentExtensions; this.DeploymentId = deploymentId; this.Outputs = outputs; this.Duration = duration; @@ -141,6 +164,12 @@ public DeploymentStackProperties() partial void CustomInit(); + /// + /// Gets or sets the error detail. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorDetail Error {get; set; } + /// /// Gets or sets the template content. You use this element when you want to /// pass the template syntax directly in the request rather than link to an @@ -148,7 +177,7 @@ public DeploymentStackProperties() /// either the templateLink property or the template property, but not both. /// [Newtonsoft.Json.JsonProperty(PropertyName = "template")] - public object Template {get; set; } + public System.Collections.Generic.IDictionary Template {get; set; } /// /// Gets or sets the URI of the template. Use either the templateLink property @@ -175,6 +204,27 @@ public DeploymentStackProperties() [Newtonsoft.Json.JsonProperty(PropertyName = "parametersLink")] public DeploymentStacksParametersLink ParametersLink {get; set; } + /// + /// Gets or sets the deployment extension configs. Keys of this object are + /// extension aliases as defined in the deployment template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extensionConfigs")] + public System.Collections.Generic.IDictionary> ExtensionConfigs {get; set; } + + /// + /// Gets or sets external input values, used by external tooling for parameter + /// evaluation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalInputs")] + public System.Collections.Generic.IDictionary ExternalInputs {get; set; } + + /// + /// Gets or sets external input definitions, used by external tooling to define + /// expected external input values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalInputDefinitions")] + public System.Collections.Generic.IDictionary ExternalInputDefinitions {get; set; } + /// /// Gets or sets defines the behavior of resources that are no longer managed /// after the Deployment stack is updated or deleted. @@ -188,13 +238,6 @@ public DeploymentStackProperties() [Newtonsoft.Json.JsonProperty(PropertyName = "debugSetting")] public DeploymentStacksDebugSetting DebugSetting {get; set; } - /// - /// Gets or sets flag to bypass service errors that indicate the stack resource - /// list is not correctly synchronized. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "bypassStackOutOfSyncError")] - public bool? BypassStackOutOfSyncError {get; set; } - /// /// Gets or sets the scope at which the initial deployment should be created. /// If a scope is not specified, it will default to the scope of the deployment @@ -220,7 +263,7 @@ public DeploymentStackProperties() public DenySettings DenySettings {get; set; } /// - /// Gets state of the deployment stack. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', 'failed', 'canceled', 'deleting' + /// Gets state of the deployment stack. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', 'failed', 'canceled', 'deleting', 'initializing', 'running' /// [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState {get; private set; } @@ -232,6 +275,19 @@ public DeploymentStackProperties() [Newtonsoft.Json.JsonProperty(PropertyName = "correlationId")] public string CorrelationId {get; private set; } + /// + /// Gets or sets the validation level of the deployment stack Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "validationLevel")] + public string ValidationLevel {get; set; } + + /// + /// Gets or sets flag to bypass service errors that indicate the stack resource + /// list is not correctly synchronized. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "bypassStackOutOfSyncError")] + public bool? BypassStackOutOfSyncError {get; set; } + /// /// Gets an array of resources that were detached during the most recent /// Deployment stack update. Detached means that the resource was removed from @@ -262,6 +318,13 @@ public DeploymentStackProperties() [Newtonsoft.Json.JsonProperty(PropertyName = "resources")] public System.Collections.Generic.IList Resources {get; private set; } + /// + /// Gets the extensions used during deployment. Contains extension data for all + /// extensible resources managed by the stack. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentExtensions")] + public System.Collections.Generic.IList DeploymentExtensions {get; private set; } + /// /// Gets the resourceId of the deployment resource created by the deployment /// stack. @@ -274,7 +337,7 @@ public DeploymentStackProperties() /// stack. /// [Newtonsoft.Json.JsonProperty(PropertyName = "outputs")] - public object Outputs {get; private set; } + public System.Collections.Generic.IDictionary Outputs {get; private set; } /// /// Gets the duration of the last successful Deployment stack update. @@ -299,6 +362,7 @@ public virtual void Validate() } + if (this.Parameters != null) { foreach (var valueElement in this.Parameters.Values) @@ -313,6 +377,42 @@ public virtual void Validate() { this.ParametersLink.Validate(); } + if (this.ExtensionConfigs != null) + { + foreach (var valueElement in this.ExtensionConfigs.Values) + { + if (valueElement != null) + { + foreach (var valueElement1 in valueElement.Values) + { + if (valueElement1 != null) + { + valueElement1.Validate(); + } + } + } + } + } + if (this.ExternalInputs != null) + { + foreach (var valueElement in this.ExternalInputs.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ExternalInputDefinitions != null) + { + foreach (var valueElement in this.ExternalInputDefinitions.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } if (this.ActionOnUnmanage != null) { this.ActionOnUnmanage.Validate(); @@ -333,9 +433,56 @@ public virtual void Validate() - - - + if (this.DetachedResources != null) + { + foreach (var element in this.DetachedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DeletedResources != null) + { + foreach (var element in this.DeletedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.FailedResources != null) + { + foreach (var element in this.FailedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.Resources != null) + { + foreach (var element in this.Resources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DeploymentExtensions != null) + { + foreach (var element in this.DeploymentExtensions) + { + if (element != null) + { + element.Validate(); + } + } + } diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProvisioningState.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProvisioningState.cs index d4c978001346..5c78979ae249 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProvisioningState.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackProvisioningState.cs @@ -13,16 +13,57 @@ namespace Microsoft.Azure.Management.Resources.Models public static class DeploymentStackProvisioningState { + /// + /// The deployment stack is currently being created + /// public const string Creating = "creating"; + /// + /// The deployment stack is currently being validated + /// public const string Validating = "validating"; + /// + /// The deployment stack is currently waiting + /// public const string Waiting = "waiting"; + /// + /// The deployment stack is currently deploying + /// public const string Deploying = "deploying"; + /// + /// The deployment stack is being cancelled + /// public const string Canceling = "canceling"; + /// + /// The deployment stack is updating deny assignments + /// public const string UpdatingDenyAssignments = "updatingDenyAssignments"; + /// + /// The deployment stack is deleting resources + /// public const string DeletingResources = "deletingResources"; + /// + /// The deployment stack completed successfully + /// public const string Succeeded = "succeeded"; + /// + /// The deployment stack has failed + /// public const string Failed = "failed"; + /// + /// The deployment stack has been cancelled + /// public const string Canceled = "canceled"; + /// + /// The deployment stack is being deleted + /// public const string Deleting = "deleting"; + /// + /// The deployment stack is currently being initialized + /// + public const string Initializing = "initializing"; + /// + /// The deployment stack is currently performing an operation + /// + public const string Running = "running"; } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackTemplateDefinition.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackTemplateDefinition.cs index 2c4e0bc0f8c5..514790a8cf1e 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackTemplateDefinition.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackTemplateDefinition.cs @@ -33,7 +33,7 @@ public DeploymentStackTemplateDefinition() /// The URI of the template. Use either the templateLink property or the /// template property, but not both. /// - public DeploymentStackTemplateDefinition(object template = default(object), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink)) + public DeploymentStackTemplateDefinition(System.Collections.Generic.IDictionary template = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink)) { this.Template = template; @@ -54,7 +54,7 @@ public DeploymentStackTemplateDefinition() /// property or the template property, but not both. /// [Newtonsoft.Json.JsonProperty(PropertyName = "template")] - public object Template {get; set; } + public System.Collections.Generic.IDictionary Template {get; set; } /// /// Gets or sets the URI of the template. Use either the templateLink property diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackValidateProperties.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackValidateProperties.cs index 82cb07cc30c0..e5e5f09e675f 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackValidateProperties.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStackValidateProperties.cs @@ -49,7 +49,13 @@ public DeploymentStackValidateProperties() /// The array of resources that were validated. /// - public DeploymentStackValidateProperties(ActionOnUnmanage actionOnUnmanage = default(ActionOnUnmanage), string correlationId = default(string), DenySettings denySettings = default(DenySettings), string deploymentScope = default(string), string description = default(string), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IList validatedResources = default(System.Collections.Generic.IList)) + + /// The deployment extensions. + /// + + /// The validation level of the deployment stack + /// Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + public DeploymentStackValidateProperties(ActionOnUnmanage actionOnUnmanage = default(ActionOnUnmanage), string correlationId = default(string), DenySettings denySettings = default(DenySettings), string deploymentScope = default(string), string description = default(string), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IList validatedResources = default(System.Collections.Generic.IList), System.Collections.Generic.IList deploymentExtensions = default(System.Collections.Generic.IList), string validationLevel = default(string)) { this.ActionOnUnmanage = actionOnUnmanage; @@ -60,6 +66,8 @@ public DeploymentStackValidateProperties() this.Parameters = parameters; this.TemplateLink = templateLink; this.ValidatedResources = validatedResources; + this.DeploymentExtensions = deploymentExtensions; + this.ValidationLevel = validationLevel; CustomInit(); } @@ -118,6 +126,18 @@ public DeploymentStackValidateProperties() /// [Newtonsoft.Json.JsonProperty(PropertyName = "validatedResources")] public System.Collections.Generic.IList ValidatedResources {get; set; } + + /// + /// Gets or sets the deployment extensions. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentExtensions")] + public System.Collections.Generic.IList DeploymentExtensions {get; set; } + + /// + /// Gets or sets the validation level of the deployment stack Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "validationLevel")] + public string ValidationLevel {get; set; } /// /// Validate the object. /// @@ -148,6 +168,26 @@ public virtual void Validate() } } + if (this.ValidatedResources != null) + { + foreach (var element in this.ValidatedResources) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DeploymentExtensions != null) + { + foreach (var element in this.DeploymentExtensions) + { + if (element != null) + { + element.Validate(); + } + } + } } } diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtManagementGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtManagementGroupHeaders.cs new file mode 100644 index 000000000000..cbc70cd4400c --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtManagementGroupHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksCreateOrUpdateAtManagementGroupHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtManagementGroupHeaders class. + /// + public DeploymentStacksCreateOrUpdateAtManagementGroupHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtManagementGroupHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksCreateOrUpdateAtManagementGroupHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtResourceGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtResourceGroupHeaders.cs new file mode 100644 index 000000000000..49f830f1de0f --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtResourceGroupHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksCreateOrUpdateAtResourceGroupHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtResourceGroupHeaders class. + /// + public DeploymentStacksCreateOrUpdateAtResourceGroupHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtResourceGroupHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksCreateOrUpdateAtResourceGroupHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtSubscriptionHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtSubscriptionHeaders.cs new file mode 100644 index 000000000000..707a715b837a --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksCreateOrUpdateAtSubscriptionHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksCreateOrUpdateAtSubscriptionHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtSubscriptionHeaders class. + /// + public DeploymentStacksCreateOrUpdateAtSubscriptionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksCreateOrUpdateAtSubscriptionHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksCreateOrUpdateAtSubscriptionHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtManagementGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtManagementGroupHeaders.cs index 9c637c760504..db633f26da80 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtManagementGroupHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtManagementGroupHeaders.cs @@ -23,10 +23,14 @@ public DeploymentStacksDeleteAtManagementGroupHeaders() /// /// - public DeploymentStacksDeleteAtManagementGroupHeaders(string location = default(string)) + + /// + /// + public DeploymentStacksDeleteAtManagementGroupHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -41,5 +45,11 @@ public DeploymentStacksDeleteAtManagementGroupHeaders() /// [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtResourceGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtResourceGroupHeaders.cs index 4a6eb239a187..f3155d16fa4e 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtResourceGroupHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtResourceGroupHeaders.cs @@ -23,10 +23,14 @@ public DeploymentStacksDeleteAtResourceGroupHeaders() /// /// - public DeploymentStacksDeleteAtResourceGroupHeaders(string location = default(string)) + + /// + /// + public DeploymentStacksDeleteAtResourceGroupHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -41,5 +45,11 @@ public DeploymentStacksDeleteAtResourceGroupHeaders() /// [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtSubscriptionHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtSubscriptionHeaders.cs index 3dc9b3d55691..30bcf4a58d2a 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtSubscriptionHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteAtSubscriptionHeaders.cs @@ -23,10 +23,14 @@ public DeploymentStacksDeleteAtSubscriptionHeaders() /// /// - public DeploymentStacksDeleteAtSubscriptionHeaders(string location = default(string)) + + /// + /// + public DeploymentStacksDeleteAtSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -41,5 +45,11 @@ public DeploymentStacksDeleteAtSubscriptionHeaders() /// [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteDetachEnum.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteDetachEnum.cs index c05ad76c944a..68db8b0d940d 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteDetachEnum.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDeleteDetachEnum.cs @@ -13,7 +13,13 @@ namespace Microsoft.Azure.Management.Resources.Models public static class DeploymentStacksDeleteDetachEnum { + /// + /// Delete the specified resources from Azure + /// public const string Delete = "delete"; + /// + /// Keep the specified resources in Azure + /// public const string Detach = "detach"; } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnostic.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnostic.cs new file mode 100644 index 000000000000..27b68e584095 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnostic.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The error additional info + /// + public partial class DeploymentStacksDiagnostic + { + /// + /// Initializes a new instance of the DeploymentStacksDiagnostic class. + /// + public DeploymentStacksDiagnostic() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksDiagnostic class. + /// + + /// Denotes the additional response level. + /// Possible values include: 'info', 'warning', 'error' + + /// The error code. + /// + + /// The error message. + /// + + /// The error target. + /// + + /// Additional error information. + /// + public DeploymentStacksDiagnostic(string level, string code, string message, string target = default(string), System.Collections.Generic.IList additionalInfo = default(System.Collections.Generic.IList)) + + { + this.Level = level; + this.Code = code; + this.Message = message; + this.Target = target; + this.AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets denotes the additional response level. Possible values include: 'info', 'warning', 'error' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "level")] + public string Level {get; set; } + + /// + /// Gets or sets the error code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets the error message. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets the error target. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; set; } + + /// + /// Gets or sets additional error information. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "additionalInfo")] + public System.Collections.Generic.IList AdditionalInfo {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Level == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Level"); + } + if (this.Code == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Code"); + } + if (this.Message == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Message"); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnosticLevel.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnosticLevel.cs new file mode 100644 index 000000000000..646f1412565b --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksDiagnosticLevel.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksDiagnosticLevel. + /// + + + public static class DeploymentStacksDiagnosticLevel + { + /// + /// Informational message. + /// + public const string Info = "info"; + /// + /// Warning message. + /// + public const string Warning = "warning"; + /// + /// Error message. + /// + public const string Error = "error"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksManagementStatus.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksManagementStatus.cs new file mode 100644 index 000000000000..99abc7a16cc9 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksManagementStatus.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksManagementStatus. + /// + + + public static class DeploymentStacksManagementStatus + { + /// + /// The resource is managed by the deployment stack. + /// + public const string Managed = "managed"; + /// + /// The resource is not managed by the deployment stack. + /// + public const string Unmanaged = "unmanaged"; + /// + /// The management state of the resource could not be determined. + /// + public const string Unknown = "unknown"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksResourcesWithoutDeleteSupportEnum.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksResourcesWithoutDeleteSupportEnum.cs new file mode 100644 index 000000000000..8f91231384c1 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksResourcesWithoutDeleteSupportEnum.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksResourcesWithoutDeleteSupportEnum. + /// + + + public static class DeploymentStacksResourcesWithoutDeleteSupportEnum + { + /// + /// Detach the specified resources from the deployment stack and continue + /// + public const string Detach = "detach"; + /// + /// Fail the deployment stack if resources cannot be deleted + /// + public const string Fail = "fail"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtManagementGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtManagementGroupHeaders.cs index f6958199e5c8..2f3f7c6f47ed 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtManagementGroupHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtManagementGroupHeaders.cs @@ -26,7 +26,7 @@ public DeploymentStacksValidateStackAtManagementGroupHeaders() /// /// - public DeploymentStacksValidateStackAtManagementGroupHeaders(string location = default(string), string retryAfter = default(string)) + public DeploymentStacksValidateStackAtManagementGroupHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; @@ -50,6 +50,6 @@ public DeploymentStacksValidateStackAtManagementGroupHeaders() /// Gets or sets /// [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter {get; set; } + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtResourceGroupHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtResourceGroupHeaders.cs index df8c8ef614fd..e1396b259f80 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtResourceGroupHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtResourceGroupHeaders.cs @@ -26,7 +26,7 @@ public DeploymentStacksValidateStackAtResourceGroupHeaders() /// /// - public DeploymentStacksValidateStackAtResourceGroupHeaders(string location = default(string), string retryAfter = default(string)) + public DeploymentStacksValidateStackAtResourceGroupHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; @@ -50,6 +50,6 @@ public DeploymentStacksValidateStackAtResourceGroupHeaders() /// Gets or sets /// [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter {get; set; } + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtSubscriptionHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtSubscriptionHeaders.cs index 454fc0584de1..0d4b2e157459 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtSubscriptionHeaders.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksValidateStackAtSubscriptionHeaders.cs @@ -26,7 +26,7 @@ public DeploymentStacksValidateStackAtSubscriptionHeaders() /// /// - public DeploymentStacksValidateStackAtSubscriptionHeaders(string location = default(string), string retryAfter = default(string)) + public DeploymentStacksValidateStackAtSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?)) { this.Location = location; @@ -50,6 +50,6 @@ public DeploymentStacksValidateStackAtSubscriptionHeaders() /// Gets or sets /// [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter {get; set; } + public int? RetryAfter {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChange.cs new file mode 100644 index 000000000000..a7ee11ea502e --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChange.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Changes predicted to the deployment stack as a result of the what-if + /// operation. + /// + public partial class DeploymentStacksWhatIfChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChange class. + /// + public DeploymentStacksWhatIfChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChange class. + /// + + /// List of resource changes predicted by What-If operation. + /// + + /// Predicted changes to the deployment stack deny settings. + /// + + /// Predicted changes to the deployment scope for the deployment stack. + /// + public DeploymentStacksWhatIfChange(System.Collections.Generic.IList resourceChanges, DeploymentStacksWhatIfChangeDenySettingsChange denySettingsChange, DeploymentStacksWhatIfChangeDeploymentScopeChange deploymentScopeChange = default(DeploymentStacksWhatIfChangeDeploymentScopeChange)) + + { + this.ResourceChanges = resourceChanges; + this.DenySettingsChange = denySettingsChange; + this.DeploymentScopeChange = deploymentScopeChange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets list of resource changes predicted by What-If operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceChanges")] + public System.Collections.Generic.IList ResourceChanges {get; set; } + + /// + /// Gets or sets predicted changes to the deployment stack deny settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "denySettingsChange")] + public DeploymentStacksWhatIfChangeDenySettingsChange DenySettingsChange {get; set; } + + /// + /// Gets or sets predicted changes to the deployment scope for the deployment + /// stack. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentScopeChange")] + public DeploymentStacksWhatIfChangeDeploymentScopeChange DeploymentScopeChange {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ResourceChanges == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ResourceChanges"); + } + if (this.DenySettingsChange == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DenySettingsChange"); + } + if (this.ResourceChanges != null) + { + foreach (var element in this.ResourceChanges) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.DenySettingsChange != null) + { + this.DenySettingsChange.Validate(); + } + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeCertainty.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeCertainty.cs new file mode 100644 index 000000000000..ee798d3cea47 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeCertainty.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksWhatIfChangeCertainty. + /// + + + public static class DeploymentStacksWhatIfChangeCertainty + { + /// + /// The change is definite. + /// + public const string Definite = "definite"; + /// + /// The change may or may not happen, based on deployment-time conditions. + /// + public const string Potential = "potential"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDenySettingsChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDenySettingsChange.cs new file mode 100644 index 000000000000..3af8dea0d85f --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDenySettingsChange.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Predicted changes to the deployment stack deny settings. + /// + public partial class DeploymentStacksWhatIfChangeDenySettingsChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChangeDenySettingsChange class. + /// + public DeploymentStacksWhatIfChangeDenySettingsChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChangeDenySettingsChange class. + /// + + /// The predicted value before the deployment is executed. + /// + + /// The predicted value after the deployment is executed. + /// + + /// The predicted changes to the properties." + /// + public DeploymentStacksWhatIfChangeDenySettingsChange(DenySettings before = default(DenySettings), DenySettings after = default(DenySettings), System.Collections.Generic.IList delta = default(System.Collections.Generic.IList)) + + { + this.Before = before; + this.After = after; + this.Delta = delta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public DenySettings Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public DenySettings After {get; set; } + + /// + /// Gets or sets the predicted changes to the properties." + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "delta")] + public System.Collections.Generic.IList Delta {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Before != null) + { + this.Before.Validate(); + } + if (this.After != null) + { + this.After.Validate(); + } + if (this.Delta != null) + { + foreach (var element in this.Delta) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDeploymentScopeChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDeploymentScopeChange.cs new file mode 100644 index 000000000000..60088dd5ce23 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeDeploymentScopeChange.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Predicted changes to the deployment scope for the deployment stack. + /// + public partial class DeploymentStacksWhatIfChangeDeploymentScopeChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChangeDeploymentScopeChange class. + /// + public DeploymentStacksWhatIfChangeDeploymentScopeChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfChangeDeploymentScopeChange class. + /// + + /// The predicted value before the deployment is executed. + /// + + /// The predicted value after the deployment is executed. + /// + public DeploymentStacksWhatIfChangeDeploymentScopeChange(string before = default(string), string after = default(string)) + + { + this.Before = before; + this.After = after; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public string Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public string After {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeType.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeType.cs new file mode 100644 index 000000000000..43c86b2c3b9c --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfChangeType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksWhatIfChangeType. + /// + + + public static class DeploymentStacksWhatIfChangeType + { + /// + /// The resource does not exist in the current state but is present in the + /// desired state. The resource will be created when the deployment is + /// executed. + /// + public const string Create = "create"; + /// + /// The resource exists in the current state and is missing from the desired + /// state. The resource will be deleted from Azure after the deployment is + /// executed. + /// + public const string Delete = "delete"; + /// + /// The resource exists in the current state and is missing from the desired + /// state. The resource will be removed from the deployment stack, but will + /// remain in Azure, after the deployment is executed. + /// + public const string Detach = "detach"; + /// + /// The resource exists in the current state and the desired state and will be + /// redeployed when the deployment is executed. The properties of the resource + /// will change. + /// + public const string Modify = "modify"; + /// + /// The resource exists in the current state and the desired state and will be + /// redeployed when the deployment is executed. The properties of the resource + /// will not change. + /// + public const string NoChange = "noChange"; + /// + /// The resource is not supported by What-If. + /// + public const string Unsupported = "unsupported"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChange.cs new file mode 100644 index 000000000000..ba313d42f3bd --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChange.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The predicted change to the resource property. + /// + public partial class DeploymentStacksWhatIfPropertyChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfPropertyChange class. + /// + public DeploymentStacksWhatIfPropertyChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfPropertyChange class. + /// + + /// The predicted value before the deployment is executed. + /// + + /// The predicted value after the deployment is executed. + /// + + /// Type of change that will be made to the resource when the deployment is + /// executed. + /// + + /// Type of change that will be made to the resource when the deployment is + /// executed. + /// Possible values include: 'array', 'create', 'delete', 'modify', 'noEffect' + + /// Nested property changes. + /// + public DeploymentStacksWhatIfPropertyChange(string path, string changeType, object before = default(object), object after = default(object), System.Collections.Generic.IList children = default(System.Collections.Generic.IList)) + + { + this.Before = before; + this.After = after; + this.Path = path; + this.ChangeType = changeType; + this.Children = children; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public object Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public object After {get; set; } + + /// + /// Gets or sets type of change that will be made to the resource when the + /// deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "path")] + public string Path {get; set; } + + /// + /// Gets or sets type of change that will be made to the resource when the + /// deployment is executed. Possible values include: 'array', 'create', 'delete', 'modify', 'noEffect' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeType")] + public string ChangeType {get; set; } + + /// + /// Gets or sets nested property changes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "children")] + public System.Collections.Generic.IList Children {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Path == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Path"); + } + if (this.ChangeType == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ChangeType"); + } + + + + + if (this.Children != null) + { + foreach (var element in this.Children) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChangeType.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChangeType.cs new file mode 100644 index 000000000000..ae3acb1e6c71 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfPropertyChangeType.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + + /// + /// Defines values for DeploymentStacksWhatIfPropertyChangeType. + /// + + + public static class DeploymentStacksWhatIfPropertyChangeType + { + /// + /// The property is an array and contains nested changes. + /// + public const string Array = "array"; + /// + /// The property does not exist in the current state but is present in the + /// desired state. The property will be created when the deployment is + /// executed. + /// + public const string Create = "create"; + /// + /// The property exists in the current state and is missing from the desired + /// state. It will be deleted when the deployment is executed. + /// + public const string Delete = "delete"; + /// + /// The property exists in both current and desired state and is different. The + /// value of the property will change when the deployment is executed. + /// + public const string Modify = "modify"; + /// + /// The property will not be set or updated. + /// + public const string NoEffect = "noEffect"; + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChange.cs new file mode 100644 index 000000000000..effb9482a039 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChange.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Information about a single resource change predicted by What-If operation. + /// + public partial class DeploymentStacksWhatIfResourceChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChange class. + /// + public DeploymentStacksWhatIfResourceChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChange class. + /// + + /// The ARM Resource ID of a resource managed by the deployment stack. + /// + + /// The extension the resource was deployed with. + /// + + /// The resource type. + /// + + /// The extensible resource identifiers. + /// + + /// The API version the resource was deployed with + /// + + /// The resource id of the Deployment responsible for this change. + /// + + /// The symbolic name of the resource being changed. + /// + + /// Type of change that will be made to the resource when the deployment is + /// executed. + /// Possible values include: 'create', 'delete', 'detach', 'modify', + /// 'noChange', 'unsupported' + + /// The confidence level of the predicted change. + /// Possible values include: 'definite', 'potential' + + /// The predicted changes to the deployment stack management status of the + /// resource. + /// + + /// The predicted changes to the deployment stack deny status of the resource. + /// + + /// The explanation about why the resource is unsupported by What-If. + /// + + /// The predicted changes to the resource configuration. + /// + public DeploymentStacksWhatIfResourceChange(string changeType, string changeCertainty, string id = default(string), DeploymentExtension extension = default(DeploymentExtension), string type = default(string), System.Collections.Generic.IDictionary identifiers = default(System.Collections.Generic.IDictionary), string apiVersion = default(string), string deploymentId = default(string), string symbolicName = default(string), DeploymentStacksWhatIfResourceChangeManagementStatusChange managementStatusChange = default(DeploymentStacksWhatIfResourceChangeManagementStatusChange), DeploymentStacksWhatIfResourceChangeDenyStatusChange denyStatusChange = default(DeploymentStacksWhatIfResourceChangeDenyStatusChange), string unsupportedReason = default(string), DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges resourceConfigurationChanges = default(DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges)) + + { + this.Id = id; + this.Extension = extension; + this.Type = type; + this.Identifiers = identifiers; + this.ApiVersion = apiVersion; + this.DeploymentId = deploymentId; + this.SymbolicName = symbolicName; + this.ChangeType = changeType; + this.ChangeCertainty = changeCertainty; + this.ManagementStatusChange = managementStatusChange; + this.DenyStatusChange = denyStatusChange; + this.UnsupportedReason = unsupportedReason; + this.ResourceConfigurationChanges = resourceConfigurationChanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ARM Resource ID of a resource managed by the deployment stack. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets the extension the resource was deployed with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extension")] + public DeploymentExtension Extension {get; private set; } + + /// + /// Gets the resource type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets the extensible resource identifiers. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identifiers")] + public System.Collections.Generic.IDictionary Identifiers {get; private set; } + + /// + /// Gets the API version the resource was deployed with + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "apiVersion")] + public string ApiVersion {get; private set; } + + /// + /// Gets or sets the resource id of the Deployment responsible for this change. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentId")] + public string DeploymentId {get; set; } + + /// + /// Gets or sets the symbolic name of the resource being changed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "symbolicName")] + public string SymbolicName {get; set; } + + /// + /// Gets or sets type of change that will be made to the resource when the + /// deployment is executed. Possible values include: 'create', 'delete', 'detach', 'modify', 'noChange', 'unsupported' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeType")] + public string ChangeType {get; set; } + + /// + /// Gets or sets the confidence level of the predicted change. Possible values include: 'definite', 'potential' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeCertainty")] + public string ChangeCertainty {get; set; } + + /// + /// Gets or sets the predicted changes to the deployment stack management + /// status of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "managementStatusChange")] + public DeploymentStacksWhatIfResourceChangeManagementStatusChange ManagementStatusChange {get; set; } + + /// + /// Gets or sets the predicted changes to the deployment stack deny status of + /// the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "denyStatusChange")] + public DeploymentStacksWhatIfResourceChangeDenyStatusChange DenyStatusChange {get; set; } + + /// + /// Gets or sets the explanation about why the resource is unsupported by + /// What-If. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "unsupportedReason")] + public string UnsupportedReason {get; set; } + + /// + /// Gets or sets the predicted changes to the resource configuration. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceConfigurationChanges")] + public DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges ResourceConfigurationChanges {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ChangeType == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ChangeType"); + } + if (this.ChangeCertainty == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ChangeCertainty"); + } + + if (this.Extension != null) + { + this.Extension.Validate(); + } + + + + + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeDenyStatusChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeDenyStatusChange.cs new file mode 100644 index 000000000000..1fb644f1711c --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeDenyStatusChange.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The predicted changes to the deployment stack deny status of the resource. + /// + public partial class DeploymentStacksWhatIfResourceChangeDenyStatusChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeDenyStatusChange class. + /// + public DeploymentStacksWhatIfResourceChangeDenyStatusChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeDenyStatusChange class. + /// + + /// The predicted value before the deployment is executed. + /// Possible values include: 'denyDelete', 'notSupported', 'inapplicable', + /// 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' + + /// The predicted value after the deployment is executed. + /// Possible values include: 'denyDelete', 'notSupported', 'inapplicable', + /// 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' + public DeploymentStacksWhatIfResourceChangeDenyStatusChange(string before = default(string), string after = default(string)) + + { + this.Before = before; + this.After = after; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. Possible values include: 'denyDelete', 'notSupported', 'inapplicable', 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public string Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. Possible values include: 'denyDelete', 'notSupported', 'inapplicable', 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public string After {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeManagementStatusChange.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeManagementStatusChange.cs new file mode 100644 index 000000000000..a31a09bf4858 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeManagementStatusChange.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The predicted changes to the deployment stack management status of the + /// resource. + /// + public partial class DeploymentStacksWhatIfResourceChangeManagementStatusChange + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeManagementStatusChange class. + /// + public DeploymentStacksWhatIfResourceChangeManagementStatusChange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeManagementStatusChange class. + /// + + /// The predicted value before the deployment is executed. + /// Possible values include: 'managed', 'unmanaged', 'unknown' + + /// The predicted value after the deployment is executed. + /// Possible values include: 'managed', 'unmanaged', 'unknown' + public DeploymentStacksWhatIfResourceChangeManagementStatusChange(string before = default(string), string after = default(string)) + + { + this.Before = before; + this.After = after; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. Possible values include: 'managed', 'unmanaged', 'unknown' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public string Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. Possible values include: 'managed', 'unmanaged', 'unknown' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public string After {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges.cs new file mode 100644 index 000000000000..271b58c829df --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// The predicted changes to the resource configuration. + /// + public partial class DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges class. + /// + public DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges class. + /// + + /// The predicted value before the deployment is executed. + /// + + /// The predicted value after the deployment is executed. + /// + + /// The predicted changes to the properties." + /// + public DeploymentStacksWhatIfResourceChangeResourceConfigurationChanges(System.Collections.Generic.IDictionary before = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary after = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList delta = default(System.Collections.Generic.IList)) + + { + this.Before = before; + this.After = after; + this.Delta = delta; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the predicted value before the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "before")] + public System.Collections.Generic.IDictionary Before {get; set; } + + /// + /// Gets or sets the predicted value after the deployment is executed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "after")] + public System.Collections.Generic.IDictionary After {get; set; } + + /// + /// Gets or sets the predicted changes to the properties." + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "delta")] + public System.Collections.Generic.IList Delta {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResult.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResult.cs new file mode 100644 index 000000000000..8f747baf5eee --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResult.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// Deployment stack object. + /// + public partial class DeploymentStacksWhatIfResult : ProxyResource + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResult class. + /// + public DeploymentStacksWhatIfResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResult class. + /// + + /// Fully qualified resource ID for the resource. E.g. + /// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + /// + + /// The name of the resource + /// + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + + /// Azure Resource Manager metadata containing createdBy and modifiedBy + /// information. + /// + + /// The resource-specific properties for this resource. + /// + + /// The geo-location where the resource lives. Required for subscription and + /// management group scoped stacks. The location is inherited from the resource + /// group for resource group scoped stacks. + /// + + /// Resource tags. + /// + public DeploymentStacksWhatIfResult(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), DeploymentStacksWhatIfResultProperties properties = default(DeploymentStacksWhatIfResultProperties), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + + : base(id, name, type, systemData) + { + this.Properties = properties; + this.Location = location; + this.Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource-specific properties for this resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public DeploymentStacksWhatIfResultProperties Properties {get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. Required for + /// subscription and management group scoped stacks. The location is inherited + /// from the resource group for resource group scoped stacks. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets resource tags. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Properties != null) + { + this.Properties.Validate(); + } + + + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultProperties.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultProperties.cs new file mode 100644 index 000000000000..39036d98ea12 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultProperties.cs @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + /// + /// DeploymentStack WhatIfResult Properties + /// + public partial class DeploymentStacksWhatIfResultProperties + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultProperties class. + /// + public DeploymentStacksWhatIfResultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultProperties class. + /// + + /// The error detail. + /// + + /// The template content. You use this element when you want to pass the + /// template syntax directly in the request rather than link to an existing + /// template. It can be a JObject or well-formed JSON string. Use either the + /// templateLink property or the template property, but not both. + /// + + /// The URI of the template. Use either the templateLink property or the + /// template property, but not both. + /// + + /// Name and value pairs that define the deployment parameters for the + /// template. Use this element when providing the parameter values directly in + /// the request, rather than linking to an existing parameter file. Use either + /// the parametersLink property or the parameters property, but not both. + /// + + /// The URI of parameters file. Use this element to link to an existing + /// parameters file. Use either the parametersLink property or the parameters + /// property, but not both. + /// + + /// The deployment extension configs. Keys of this object are extension aliases + /// as defined in the deployment template. + /// + + /// External input values, used by external tooling for parameter evaluation. + /// + + /// External input definitions, used by external tooling to define expected + /// external input values. + /// + + /// Defines the behavior of resources that are no longer managed after the + /// Deployment stack is updated or deleted. + /// + + /// The debug setting of the deployment. + /// + + /// The scope at which the initial deployment should be created. If a scope is + /// not specified, it will default to the scope of the deployment stack. Valid + /// scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'), + /// subscription (format: '/subscriptions/{subscriptionId}'), resource group + /// (format: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'). + /// + + /// Deployment stack description. Max length of 4096 characters. + /// + + /// Defines how resources deployed by the stack are locked. + /// + + /// State of the deployment stack. + /// Possible values include: 'creating', 'validating', 'waiting', 'deploying', + /// 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', + /// 'failed', 'canceled', 'deleting', 'initializing', 'running' + + /// The correlation id of the last Deployment stack upsert or delete operation. + /// It is in GUID format and is used for tracing. + /// + + /// The validation level of the deployment stack + /// Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + + /// The deployment stack id to use as the basis for comparison. + /// + + /// The timestamp for when the deployment stack was last modified. This can be + /// used to determine if the what-if data is still current. + /// + + /// The interval to persist the deployment stack what-if result in ISO 8601 + /// format. + /// + + /// All of the changes predicted by the deployment stack what-if operation. + /// + + /// List of resource diagnostics detected by What-If operation. + /// + public DeploymentStacksWhatIfResultProperties(ActionOnUnmanage actionOnUnmanage, DenySettings denySettings, string deploymentStackResourceId, System.TimeSpan retentionInterval, ErrorDetail error = default(ErrorDetail), System.Collections.Generic.IDictionary template = default(System.Collections.Generic.IDictionary), DeploymentStacksTemplateLink templateLink = default(DeploymentStacksTemplateLink), System.Collections.Generic.IDictionary parameters = default(System.Collections.Generic.IDictionary), DeploymentStacksParametersLink parametersLink = default(DeploymentStacksParametersLink), System.Collections.Generic.IDictionary> extensionConfigs = default(System.Collections.Generic.IDictionary>), System.Collections.Generic.IDictionary externalInputs = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IDictionary externalInputDefinitions = default(System.Collections.Generic.IDictionary), DeploymentStacksDebugSetting debugSetting = default(DeploymentStacksDebugSetting), string deploymentScope = default(string), string description = default(string), string provisioningState = default(string), string correlationId = default(string), string validationLevel = default(string), System.DateTime? deploymentStackLastModified = default(System.DateTime?), DeploymentStacksWhatIfChange changes = default(DeploymentStacksWhatIfChange), System.Collections.Generic.IList diagnostics = default(System.Collections.Generic.IList)) + + { + this.Error = error; + this.Template = template; + this.TemplateLink = templateLink; + this.Parameters = parameters; + this.ParametersLink = parametersLink; + this.ExtensionConfigs = extensionConfigs; + this.ExternalInputs = externalInputs; + this.ExternalInputDefinitions = externalInputDefinitions; + this.ActionOnUnmanage = actionOnUnmanage; + this.DebugSetting = debugSetting; + this.DeploymentScope = deploymentScope; + this.Description = description; + this.DenySettings = denySettings; + this.ProvisioningState = provisioningState; + this.CorrelationId = correlationId; + this.ValidationLevel = validationLevel; + this.DeploymentStackResourceId = deploymentStackResourceId; + this.DeploymentStackLastModified = deploymentStackLastModified; + this.RetentionInterval = retentionInterval; + this.Changes = changes; + this.Diagnostics = diagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the error detail. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorDetail Error {get; set; } + + /// + /// Gets or sets the template content. You use this element when you want to + /// pass the template syntax directly in the request rather than link to an + /// existing template. It can be a JObject or well-formed JSON string. Use + /// either the templateLink property or the template property, but not both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + public System.Collections.Generic.IDictionary Template {get; set; } + + /// + /// Gets or sets the URI of the template. Use either the templateLink property + /// or the template property, but not both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "templateLink")] + public DeploymentStacksTemplateLink TemplateLink {get; set; } + + /// + /// Gets or sets name and value pairs that define the deployment parameters for + /// the template. Use this element when providing the parameter values directly + /// in the request, rather than linking to an existing parameter file. Use + /// either the parametersLink property or the parameters property, but not + /// both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + public System.Collections.Generic.IDictionary Parameters {get; set; } + + /// + /// Gets or sets the URI of parameters file. Use this element to link to an + /// existing parameters file. Use either the parametersLink property or the + /// parameters property, but not both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "parametersLink")] + public DeploymentStacksParametersLink ParametersLink {get; set; } + + /// + /// Gets or sets the deployment extension configs. Keys of this object are + /// extension aliases as defined in the deployment template. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extensionConfigs")] + public System.Collections.Generic.IDictionary> ExtensionConfigs {get; set; } + + /// + /// Gets or sets external input values, used by external tooling for parameter + /// evaluation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalInputs")] + public System.Collections.Generic.IDictionary ExternalInputs {get; set; } + + /// + /// Gets or sets external input definitions, used by external tooling to define + /// expected external input values. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "externalInputDefinitions")] + public System.Collections.Generic.IDictionary ExternalInputDefinitions {get; set; } + + /// + /// Gets or sets defines the behavior of resources that are no longer managed + /// after the Deployment stack is updated or deleted. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actionOnUnmanage")] + public ActionOnUnmanage ActionOnUnmanage {get; set; } + + /// + /// Gets or sets the debug setting of the deployment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "debugSetting")] + public DeploymentStacksDebugSetting DebugSetting {get; set; } + + /// + /// Gets or sets the scope at which the initial deployment should be created. + /// If a scope is not specified, it will default to the scope of the deployment + /// stack. Valid scopes are: management group (format: + /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'), + /// subscription (format: '/subscriptions/{subscriptionId}'), resource group + /// (format: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentScope")] + public string DeploymentScope {get; set; } + + /// + /// Gets or sets deployment stack description. Max length of 4096 characters. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets defines how resources deployed by the stack are locked. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "denySettings")] + public DenySettings DenySettings {get; set; } + + /// + /// Gets state of the deployment stack. Possible values include: 'creating', 'validating', 'waiting', 'deploying', 'canceling', 'updatingDenyAssignments', 'deletingResources', 'succeeded', 'failed', 'canceled', 'deleting', 'initializing', 'running' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + + /// + /// Gets the correlation id of the last Deployment stack upsert or delete + /// operation. It is in GUID format and is used for tracing. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "correlationId")] + public string CorrelationId {get; private set; } + + /// + /// Gets or sets the validation level of the deployment stack Possible values include: 'Template', 'Provider', 'ProviderNoRbac' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "validationLevel")] + public string ValidationLevel {get; set; } + + /// + /// Gets or sets the deployment stack id to use as the basis for comparison. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStackResourceId")] + public string DeploymentStackResourceId {get; set; } + + /// + /// Gets the timestamp for when the deployment stack was last modified. This + /// can be used to determine if the what-if data is still current. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentStackLastModified")] + public System.DateTime? DeploymentStackLastModified {get; private set; } + + /// + /// Gets or sets the interval to persist the deployment stack what-if result in + /// ISO 8601 format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "retentionInterval")] + public System.TimeSpan RetentionInterval {get; set; } + + /// + /// Gets all of the changes predicted by the deployment stack what-if + /// operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changes")] + public DeploymentStacksWhatIfChange Changes {get; private set; } + + /// + /// Gets list of resource diagnostics detected by What-If operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diagnostics")] + public System.Collections.Generic.IList Diagnostics {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ActionOnUnmanage == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ActionOnUnmanage"); + } + if (this.DenySettings == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DenySettings"); + } + if (this.DeploymentStackResourceId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DeploymentStackResourceId"); + } + + + + if (this.Parameters != null) + { + foreach (var valueElement in this.Parameters.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ParametersLink != null) + { + this.ParametersLink.Validate(); + } + if (this.ExtensionConfigs != null) + { + foreach (var valueElement in this.ExtensionConfigs.Values) + { + if (valueElement != null) + { + foreach (var valueElement1 in valueElement.Values) + { + if (valueElement1 != null) + { + valueElement1.Validate(); + } + } + } + } + } + if (this.ExternalInputs != null) + { + foreach (var valueElement in this.ExternalInputs.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ExternalInputDefinitions != null) + { + foreach (var valueElement in this.ExternalInputDefinitions.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + if (this.ActionOnUnmanage != null) + { + this.ActionOnUnmanage.Validate(); + } + + + if (this.Description != null) + { + if (this.Description.Length > 4096) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Description", 4096); + } + } + if (this.DenySettings != null) + { + this.DenySettings.Validate(); + } + + + + + if (this.Changes != null) + { + this.Changes.Validate(); + } + if (this.Diagnostics != null) + { + foreach (var element in this.Diagnostics) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..976cc94eb06e --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders class. + /// + public DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtManagementGroupCreateOrUpdateHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders.cs new file mode 100644 index 000000000000..43ba10925bf2 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders class. + /// + public DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtManagementGroupWhatIfHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..4a1a9ee5178c --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders class. + /// + public DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtResourceGroupCreateOrUpdateHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders.cs new file mode 100644 index 000000000000..da96252a7df0 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders class. + /// + public DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtResourceGroupWhatIfHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..826db1f01c87 --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders class. + /// + public DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtSubscriptionCreateOrUpdateHeaders(string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + + { + this.AzureAsyncOperation = azureAsyncOperation; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders.cs new file mode 100644 index 000000000000..86b27ac8b5cd --- /dev/null +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Resources.Models +{ + using System.Linq; + + public partial class DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders + { + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders class. + /// + public DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders class. + /// + + /// + /// + + /// + /// + public DeploymentStacksWhatIfResultsAtSubscriptionWhatIfHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ErrorResponse.cs index b320f7c2f1d4..fe709415d2dd 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ErrorResponse.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -10,12 +10,12 @@ namespace Microsoft.Azure.Management.Resources.Models /// /// Common error response for all Azure Resource Manager APIs to return error /// details for failed operations. (This also follows the OData error response - /// format.) + /// format.). /// /// /// Common error response for all Azure Resource Manager APIs to return error /// details for failed operations. (This also follows the OData error response - /// format.) + /// format.). /// public partial class ErrorResponse { @@ -31,28 +31,12 @@ public ErrorResponse() /// Initializes a new instance of the ErrorResponse class. /// - /// The error code. + /// The error object. /// - - /// The error message. - /// - - /// The error target. - /// - - /// The error details. - /// - - /// The error additional info. - /// - public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), System.Collections.Generic.IList details = default(System.Collections.Generic.IList), System.Collections.Generic.IList additionalInfo = default(System.Collections.Generic.IList)) + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { - this.Code = code; - this.Message = message; - this.Target = target; - this.Details = details; - this.AdditionalInfo = additionalInfo; + this.Error = error; CustomInit(); } @@ -63,33 +47,9 @@ public ErrorResponse() /// - /// Gets the error code. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "code")] - public string Code {get; private set; } - - /// - /// Gets the error message. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "message")] - public string Message {get; private set; } - - /// - /// Gets the error target. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "target")] - public string Target {get; private set; } - - /// - /// Gets the error details. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "details")] - public System.Collections.Generic.IList Details {get; private set; } - - /// - /// Gets the error additional info. + /// Gets or sets the error object. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "additionalInfo")] - public System.Collections.Generic.IList AdditionalInfo {get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorDetail Error {get; set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ManagedResourceReference.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ManagedResourceReference.cs index 9af40feaa3d7..992fe2927336 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ManagedResourceReference.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ManagedResourceReference.cs @@ -24,7 +24,19 @@ public ManagedResourceReference() /// Initializes a new instance of the ManagedResourceReference class. /// - /// The resourceId of a resource managed by the deployment stack. + /// The ARM Resource ID of a resource managed by the deployment stack. + /// + + /// The extension the resource was deployed with. + /// + + /// The resource type. + /// + + /// The extensible resource identifiers. + /// + + /// The API version the resource was deployed with /// /// Current management state of the resource in the deployment stack. @@ -32,10 +44,10 @@ public ManagedResourceReference() /// denyAssignment settings applied to the resource. /// Possible values include: 'denyDelete', 'notSupported', 'inapplicable', - /// 'denyWriteAndDelete', 'removedBySystem', 'none' - public ManagedResourceReference(string id = default(string), string status = default(string), string denyStatus = default(string)) + /// 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' + public ManagedResourceReference(string id = default(string), DeploymentExtension extension = default(DeploymentExtension), string type = default(string), System.Collections.Generic.IDictionary identifiers = default(System.Collections.Generic.IDictionary), string apiVersion = default(string), string status = default(string), string denyStatus = default(string)) - : base(id) + : base(id, extension, type, identifiers, apiVersion) { this.Status = status; this.DenyStatus = denyStatus; @@ -56,9 +68,21 @@ public ManagedResourceReference() public string Status {get; set; } /// - /// Gets or sets denyAssignment settings applied to the resource. Possible values include: 'denyDelete', 'notSupported', 'inapplicable', 'denyWriteAndDelete', 'removedBySystem', 'none' + /// Gets or sets denyAssignment settings applied to the resource. Possible values include: 'denyDelete', 'notSupported', 'inapplicable', 'denyWriteAndDelete', 'removedBySystem', 'none', 'unknown' /// [Newtonsoft.Json.JsonProperty(PropertyName = "denyStatus")] public string DenyStatus {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + + + } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ProxyResource.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ProxyResource.cs index d237e8cbb60f..a053df44903d 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ProxyResource.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ProxyResource.cs @@ -8,9 +8,14 @@ namespace Microsoft.Azure.Management.Resources.Models using System.Linq; /// - /// An Azure proxy resource. + /// The resource model definition for a Azure Resource Manager proxy resource. + /// It will not have tags and a location /// - public partial class ProxyResource : Microsoft.Rest.Azure.IResource + /// + /// The resource model definition for a Azure Resource Manager proxy resource. + /// It will not have tags and a location + /// + public partial class ProxyResource : Resource { /// /// Initializes a new instance of the ProxyResource class. @@ -24,20 +29,24 @@ public ProxyResource() /// Initializes a new instance of the ProxyResource class. /// - /// Azure resource Id. + /// Fully qualified resource ID for the resource. E.g. + /// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" /// - /// Azure resource name. + /// The name of the resource /// - /// Azure resource type. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// - public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + /// Azure Resource Manager metadata containing createdBy and modifiedBy + /// information. + /// + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + + : base(id, name, type, systemData) { - this.Id = id; - this.Name = name; - this.Type = type; CustomInit(); } @@ -46,23 +55,5 @@ public ProxyResource() /// partial void CustomInit(); - - /// - /// Gets azure resource Id. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id {get; private set; } - - /// - /// Gets azure resource name. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name {get; private set; } - - /// - /// Gets azure resource type. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] - public string Type {get; private set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/Resource.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/Resource.cs index 9c8b0bf803d7..5c73a43c9c48 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/Resource.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/Resource.cs @@ -8,8 +8,13 @@ namespace Microsoft.Azure.Management.Resources.Models using System.Linq; /// - /// Specified resource. + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : Microsoft.Rest.Azure.IResource { /// @@ -24,32 +29,27 @@ public Resource() /// Initializes a new instance of the Resource class. /// - /// Resource ID + /// Fully qualified resource ID for the resource. E.g. + /// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" /// - /// Resource name + /// The name of the resource /// - /// Resource type + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// - /// Resource location + /// Azure Resource Manager metadata containing createdBy and modifiedBy + /// information. /// - - /// Resource extended location. - /// - - /// Resource tags - /// - public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ExtendedLocation extendedLocation = default(ExtendedLocation), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { this.Id = id; this.Name = name; this.Type = type; - this.Location = location; - this.ExtendedLocation = extendedLocation; - this.Tags = tags; + this.SystemData = systemData; CustomInit(); } @@ -60,39 +60,30 @@ public Resource() /// - /// Gets resource ID + /// Gets fully qualified resource ID for the resource. E.g. + /// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" /// [Newtonsoft.Json.JsonProperty(PropertyName = "id")] public string Id {get; private set; } /// - /// Gets resource name + /// Gets the name of the resource /// [Newtonsoft.Json.JsonProperty(PropertyName = "name")] public string Name {get; private set; } /// - /// Gets resource type + /// Gets the type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [Newtonsoft.Json.JsonProperty(PropertyName = "type")] public string Type {get; private set; } /// - /// Gets or sets resource location - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "location")] - public string Location {get; set; } - - /// - /// Gets or sets resource extended location. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "extendedLocation")] - public ExtendedLocation ExtendedLocation {get; set; } - - /// - /// Gets or sets resource tags + /// Gets azure Resource Manager metadata containing createdBy and modifiedBy + /// information. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] - public System.Collections.Generic.IDictionary Tags {get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "systemData")] + public SystemData SystemData {get; private set; } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReference.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReference.cs index 77161f27c3bd..2d8d0590fd27 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReference.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReference.cs @@ -24,12 +24,28 @@ public ResourceReference() /// Initializes a new instance of the ResourceReference class. /// - /// The resourceId of a resource managed by the deployment stack. + /// The ARM Resource ID of a resource managed by the deployment stack. /// - public ResourceReference(string id = default(string)) + + /// The extension the resource was deployed with. + /// + + /// The resource type. + /// + + /// The extensible resource identifiers. + /// + + /// The API version the resource was deployed with + /// + public ResourceReference(string id = default(string), DeploymentExtension extension = default(DeploymentExtension), string type = default(string), System.Collections.Generic.IDictionary identifiers = default(System.Collections.Generic.IDictionary), string apiVersion = default(string)) { this.Id = id; + this.Extension = extension; + this.Type = type; + this.Identifiers = identifiers; + this.ApiVersion = apiVersion; CustomInit(); } @@ -40,9 +56,50 @@ public ResourceReference() /// - /// Gets the resourceId of a resource managed by the deployment stack. + /// Gets the ARM Resource ID of a resource managed by the deployment stack. /// [Newtonsoft.Json.JsonProperty(PropertyName = "id")] public string Id {get; private set; } + + /// + /// Gets the extension the resource was deployed with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extension")] + public DeploymentExtension Extension {get; private set; } + + /// + /// Gets the resource type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets the extensible resource identifiers. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identifiers")] + public System.Collections.Generic.IDictionary Identifiers {get; private set; } + + /// + /// Gets the API version the resource was deployed with + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "apiVersion")] + public string ApiVersion {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Extension != null) + { + this.Extension.Validate(); + } + + + + } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReferenceExtended.cs b/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReferenceExtended.cs index c4e5e80c0ed4..4d4ab3ef0568 100644 --- a/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReferenceExtended.cs +++ b/src/Resources/Resources.Management.Sdk/Generated/Models/ResourceReferenceExtended.cs @@ -25,15 +25,31 @@ public ResourceReferenceExtended() /// Initializes a new instance of the ResourceReferenceExtended class. /// - /// The resourceId of a resource managed by the deployment stack. + /// The ARM Resource ID of a resource managed by the deployment stack. + /// + + /// The extension the resource was deployed with. + /// + + /// The resource type. + /// + + /// The extensible resource identifiers. + /// + + /// The API version the resource was deployed with /// /// The error detail. /// - public ResourceReferenceExtended(string id = default(string), ErrorDetail error = default(ErrorDetail)) + public ResourceReferenceExtended(string id = default(string), DeploymentExtension extension = default(DeploymentExtension), string type = default(string), System.Collections.Generic.IDictionary identifiers = default(System.Collections.Generic.IDictionary), string apiVersion = default(string), ErrorDetail error = default(ErrorDetail)) { this.Id = id; + this.Extension = extension; + this.Type = type; + this.Identifiers = identifiers; + this.ApiVersion = apiVersion; this.Error = error; CustomInit(); } @@ -45,15 +61,57 @@ public ResourceReferenceExtended() /// - /// Gets the resourceId of a resource managed by the deployment stack. + /// Gets the ARM Resource ID of a resource managed by the deployment stack. /// [Newtonsoft.Json.JsonProperty(PropertyName = "id")] public string Id {get; private set; } + /// + /// Gets the extension the resource was deployed with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extension")] + public DeploymentExtension Extension {get; private set; } + + /// + /// Gets the resource type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets the extensible resource identifiers. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identifiers")] + public System.Collections.Generic.IDictionary Identifiers {get; private set; } + + /// + /// Gets the API version the resource was deployed with + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "apiVersion")] + public string ApiVersion {get; private set; } + /// /// Gets or sets the error detail. /// [Newtonsoft.Json.JsonProperty(PropertyName = "error")] public ErrorDetail Error {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Extension != null) + { + this.Extension.Validate(); + } + + + + + } } } \ No newline at end of file diff --git a/src/Resources/Resources.Management.Sdk/README.md b/src/Resources/Resources.Management.Sdk/README.md index 6b874b09ae74..4b0acaa0b7ba 100644 --- a/src/Resources/Resources.Management.Sdk/README.md +++ b/src/Resources/Resources.Management.Sdk/README.md @@ -11,7 +11,7 @@ autorest --use:@autorest/powershell@4.x --tag=package-subscriptions-2021-01 autorest --use:@autorest/powershell@4.x --tag=package-features-2021-07 autorest --use:@autorest/powershell@4.x --tag=package-deploymentscripts-2020-10 autorest --use:@autorest/powershell@4.x --tag=package-resources-2024-11 -autorest --use:@autorest/powershell@4.x --tag=package-deploymentstacks-2024-03 +autorest --use:@autorest/powershell@4.x --tag=package-deploymentstacks-2025-07 autorest --use:@autorest/powershell@4.x --tag=package-templatespecs-2021-05 ``` @@ -31,7 +31,7 @@ license-header: MICROSOFT_MIT_NO_VERSION ## Configuration ```yaml -commit: 5e5d8196f6ba69545a9c4882ab4769d108b513c9 +commit: 652ad4cb131256f10a90ea2df207b38cf35d6671 ``` ### Tag: package-deploymentscripts-2023-08 @@ -157,6 +157,21 @@ These settings apply only when `--tag=package-deploymentstacks-2024-03` is speci input-file: - https://github.com/Azure/azure-rest-api-specs/tree/$(commit)/specification/resources/resource-manager/Microsoft.Resources/stable/2024-03-01/deploymentStacks.json +# Temporary override to make subscription id GUID a string. +directive: + - from: deploymentStacks.json + where: $ + transform: $ = $.replace(/common-types\/resource-management\/v5\/types.json#\/parameters\/SubscriptionIdParameter/g, 'common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter'); +``` + +### Tag: package-deploymentstacks-2025-07 + +These settings apply only when `--tag=package-deploymentstacks-2025-07` is specified on the command line. + +``` yaml $(tag) == 'package-deploymentstacks-2025-07' +input-file: +- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/resources/resource-manager/Microsoft.Resources/deploymentStacks/stable/2025-07-01/deploymentStacks.json + # Temporary override to make subscription id GUID a string. directive: - from: deploymentStacks.json diff --git a/src/Resources/Resources/Az.Resources.psd1 b/src/Resources/Resources/Az.Resources.psd1 index e85365fbdb43..272ecac0961d 100644 --- a/src/Resources/Resources/Az.Resources.psd1 +++ b/src/Resources/Resources/Az.Resources.psd1 @@ -152,7 +152,8 @@ CmdletsToExport = 'Export-AzResourceGroup', 'Export-AzTemplateSpec', 'Get-AzManagedApplicationDefinition', 'Get-AzManagementGroup', 'Get-AzManagementGroupDeployment', 'Get-AzManagementGroupDeploymentOperation', - 'Get-AzManagementGroupDeploymentStack', + 'Get-AzManagementGroupDeploymentStack', + 'Get-AzManagementGroupDeploymentStackWhatIf', 'Get-AzManagementGroupDeploymentWhatIfResult', 'Get-AzManagementGroupEntity', 'Get-AzManagementGroupHierarchySetting', @@ -167,14 +168,15 @@ CmdletsToExport = 'Export-AzResourceGroup', 'Export-AzTemplateSpec', 'Get-AzResourceGroupDeploymentWhatIfResult', 'Get-AzResourceLock', 'Get-AzResourceManagementPrivateLink', 'Get-AzResourceProvider', 'Get-AzRoleAssignment', 'Get-AzRoleDefinition', - 'Get-AzSubscriptionDeploymentStack', 'Get-AzTag', - 'Get-AzTemplateSpec', 'Get-AzTenantBackfillStatus', + 'Get-AzSubscriptionDeploymentStack', 'Get-AzSubscriptionDeploymentStackWhatIf', + 'Get-AzTag', 'Get-AzTemplateSpec', 'Get-AzTenantBackfillStatus', 'Get-AzTenantDeployment', 'Get-AzTenantDeploymentOperation', 'Get-AzTenantDeploymentWhatIfResult', 'Invoke-AzResourceAction', 'Move-AzResource', 'New-AzDeployment', 'New-AzManagedApplication', 'New-AzManagedApplicationDefinition', 'New-AzManagementGroup', 'New-AzManagementGroupDeployment', - 'New-AzManagementGroupDeploymentStack', + 'New-AzManagementGroupDeploymentStack', + 'Get-AzResourceGroupDeploymentStackWhatIf', 'New-AzManagementGroupHierarchySetting', 'New-AzManagementGroupSubscription', 'New-AzPrivateLinkAssociation', 'New-AzResource', 'New-AzResourceGroup',