diff --git a/ChangeLog.md b/ChangeLog.md index d82586d442ff..b0382a384358 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,7 @@ -## 2016.02.02 version 1.2.0 +## 2016.02.02 version 1.2.0 * Azure RemoteApp: Organizational Unit in Azure RemoteApp RDFE cmdlets now accepts Unicode characters. +* Azure Stack Admin: New module for the management of azure stack administrative resources such as plan, offer, subscription, resource provider and gallery items +* Azure Stack Storage Admin: New module for the management of azure stack storage administrative resources such as configuration, infrastructure and health ## 2016.01.12 version 1.1.0 * Azure SQL Database: Threat Detection policies: diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 29857e458615..c9c354811108 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -298,6 +298,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4946,6 +5091,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ResourceManager/AzureStackAdmin/AzureRM.AzureStackAdmin.psd1 b/src/ResourceManager/AzureStackAdmin/AzureRM.AzureStackAdmin.psd1 new file mode 100644 index 000000000000..e26e79b5e86e --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/AzureRM.AzureStackAdmin.psd1 @@ -0,0 +1,86 @@ +# +# Module manifest for module 'AzureRM.AzureStackAdmin' +# +# Generated by: Microsoft Corporation +# +# Updated on: 10/27/2015 +# + +@{ + +# Script module or binary module file associated with this manifest +ModuleToProcess = 'Microsoft.AzureStack.Commands.dll' + +# Version number of this module. +ModuleVersion = '0.9.1' + +# ID used to uniquely identify this module +GUID = '0e691e0a-ce16-40f2-af84-86fb0d82fb29' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = 'Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Microsoft Azure Stack Administration Module' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '3.0' + +# Name of the Windows PowerShell host required by this module +PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +PowerShellHostVersion = '' + +# Minimum version of the .NET Framework required by this module +DotNetFrameworkVersion = '4.5' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion = '4.0' + +# Processor architecture (None, X86, Amd64, IA64) required by this module +ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.3'}) + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() + +# Type files (.ps1xml) to be loaded when importing this module +TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +# FormatsToProcess = @('AzureStackAdmin.format.ps1xml') + +# Modules to import as nested modules of the module specified in ModuleToProcess +NestedModules = @() + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = '*' + +# List of all modules packaged with this module +ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in ModuleToProcess +PrivateData = '' +} + diff --git a/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln b/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln new file mode 100644 index 000000000000..02e822dc775a --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/AzureStackAdmin.sln @@ -0,0 +1,39 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManager.Common", "..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj", "{3819D8A7-C62C-4C47-8DDD-0332D9CE1252}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureStackAdmin", "Commands.AzureStackAdmin\Commands.AzureStackAdmin.csproj", "{0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Release|Any CPU.Build.0 = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs new file mode 100644 index 000000000000..a140d5b1a842 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/AdminApiCmdlet.cs @@ -0,0 +1,200 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using System.Net; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.Azure.Commands.ResourceManager.Common; + using Microsoft.Azure.Common.Authentication; + using Microsoft.Azure.Common.Authentication.Models; + using Microsoft.Azure; + using Microsoft.AzureStack.Management; + + /// + /// Base Admin API cmdlet class + /// + public abstract class AdminApiCmdlet : AzureRMCmdlet + { + /// + /// The default API version. + /// + private const string DefaultApiVersion = "1.0"; + + /// + /// Gets or sets the admin base URI + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + [ValidateAbsoluteUri] + public Uri AdminUri { get; set; } + + /// + /// Gets or sets the authentication token + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string Token { get; set; } + + /// + /// Gets or sets the API version. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string ApiVersion { get; set; } + + /// + /// Gets or sets a value indicating whether to disable certificate validation. + /// + [Parameter] + public SwitchParameter DisableCertificateValidation { get; set; } + + /// + /// Gets the current default context. overriding it here since DefaultContext could be null for Windows Auth/ADFS environments + /// + protected override AzureContext DefaultContext + { + get + { + if (DefaultProfile == null) + { + return null; + } + + return DefaultProfile.Context; + } + } + + /// + /// Execute this cmdlet. + /// + /// + /// Descendant classes must override this methods instead of Cmdlet.ProcessRecord, so + /// we can have a unique place where log all errors. + /// + protected override void ProcessRecord() + { + var originalValidateCallback = ServicePointManager.ServerCertificateValidationCallback; + object result; + + this.ValidateParameters(); + + try + { + // Note: (bryanr) Adding the tracing interceptor requires using a message pump and action queue. See relevant thread in PowerShell Discussions. + ////CloudContext.Configuration.Tracing.AddTracingInterceptor(this); + + // TODO (bryanr) - Evaluate if this should be removed entirely + if (this.DisableCertificateValidation) + { + this.WriteWarning(Resources.WarningDisableCertificateValidation); + ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true; + } + + // Initialize parameters bound from the pipeline + this.ApiVersion = this.ApiVersion ?? DefaultApiVersion; + + // Execute the API call(s) for the current cmdlet + result = this.ExecuteCore(); + } + finally + { + if (this.DisableCertificateValidation) + { + ServicePointManager.ServerCertificateValidationCallback = originalValidateCallback; + } + + ////CloudContext.Configuration.Tracing.RemoveTracingInterceptor(this); + } + + // Write the object to the pipeline only after the certificate validation callback has been restored. + // This will prevent other cmdlets in the pipeline from inheriting this security vulnerability. + if (result != null) + { + this.WriteObject(result, enumerateCollection: true); + } + } + + private void ValidateParameters() + { + // if Token is empty, make sure that we have a valid azure profile + if (string.IsNullOrEmpty(this.Token)) + { + if (this.DefaultContext == null) + { + throw new ApplicationException(Resources.InvalidProfile); + } + } + else + { + // if token is specified, AdminUri is required as well + if (this.AdminUri == null) + { + throw new ApplicationException(Resources.TokenAndAdminUriRequired); + } + } + } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected abstract object ExecuteCore(); + + /// + /// Gets the Azure Stack management client. + /// + /// The subscription identifier. + protected AzureStackClient GetAzureStackClient(string subscriptionId = null) + { + if (string.IsNullOrEmpty(this.Token)) + { + return GetAzureStackClientThruAzureSession(); + } + + if (string.IsNullOrEmpty(subscriptionId)) + { + return new AzureStackClient( + baseUri: this.AdminUri, + credentials: new TokenCloudCredentials(token: this.Token), + apiVersion: this.ApiVersion); + } + else + { + return new AzureStackClient( + baseUri: this.AdminUri, + credentials: new TokenCloudCredentials(subscriptionId: subscriptionId, token: this.Token), + apiVersion: this.ApiVersion); + } + } + + /// + /// Gets the Azures Stack management client. + /// + /// The subscription identifier. + protected AzureStackClient GetAzureStackClient(Guid subscriptionId) + { + return this.GetAzureStackClient(subscriptionId.ToString()); + } + + private AzureStackClient GetAzureStackClientThruAzureSession() + { + var armUri = this.DefaultContext.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager); + var credentials = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(this.DefaultContext); + + return AzureSession.ClientFactory.CreateCustomClient(armUri, credentials, this.ApiVersion); + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ArgumentValidator.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ArgumentValidator.cs new file mode 100644 index 000000000000..b9fad6b16e31 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ArgumentValidator.cs @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Microsoft.WindowsAzure.Commands.Common.Properties; + + /// + /// Argument Validation Methods + /// + public static class ArgumentValidator + { + /// + /// Checks if argument is null. + /// + /// Name of the property. + /// The value. + public static void ValidateNotNull(string paramName, object value) + { + if (value == null) + { + throw new ArgumentNullException(paramName); + } + } + + /// + /// Checks if argument is empty. + /// + /// Name of the property. + /// The value. + public static void ValidateNotEmpty(string paramName, string value) + { + if (value == null) + { + throw new ArgumentNullException(paramName); + } + + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException(Resources.ExpectedNotEmptyValue, paramName: paramName); + } + } + + /// + /// Checks if argument is null or empty collection. + /// + /// Type of items in the collection + /// Name of the property. + /// The collection. + public static void ValidateNotEmpty(string paramName, IEnumerable collection) + { + if (collection == null) + { + throw new ArgumentNullException(paramName); + } + + if (!collection.Any()) + { + throw new ArgumentException(Resources.ExpectedNotEmptyCollection, paramName: paramName); + } + } + + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj new file mode 100644 index 000000000000..686628bdf993 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Commands.AzureStackAdmin.csproj @@ -0,0 +1,184 @@ + + + + + Debug + AnyCPU + {0B02390C-8AA9-4D99-8AA8-2A9D2D39682F} + Library + Properties + Microsoft.AzureStack.Commands + Microsoft.AzureStack.Commands + v4.5 + 512 + ..\..\..\ + true + /assemblyCompareMode:StrongNameIgnoringVersion + + + true + full + false + ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRm.AzureStackAdmin\ + TRACE;DEBUG + prompt + 4 + true + true + false + + + ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRm.AzureStackAdmin\ + TRACE;SIGN + true + pdbonly + AnyCPU + bin\Release\Microsoft.AzureStack.Commands.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + MinimumRecommendedRules.ruleset + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules + true + true + MSSharedLibKey.snk + true + false + + + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + + + + + + + ..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll + + + ..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + + + + + + + + + ..\..\..\packages\Microsoft.AzureStack.Management.0.9.1-preview\lib\net45\Microsoft.AzureStack.Management.dll + + + ..\..\..\packages\Hyak.Common.1.0.3\lib\net40\Hyak.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + + + False + ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} + Commands.ResourceManager.Common + + + + + + + + + AzureRM.AzureStackAdmin.psd1 + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + Always + + + Designer + + + + + PublicResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/CommonPSConst.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/CommonPSConst.cs new file mode 100644 index 000000000000..ba6e66d21cd3 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/CommonPSConst.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + /// + /// Common constants for all PowerShell modules + /// + public static class CommonPSConst + { + /// + /// Parameter set names + /// + public static class ParameterSet + { + /// + /// Parameter set for property base parameters. + /// + public const string ByProperty = "ByProperty"; + + /// + /// Parameter set for full object base parameters. + /// + public const string ByObject = "ByObject"; + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/MSSharedLibKey.snk b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/MSSharedLibKey.snk new file mode 100644 index 000000000000..695f1b38774e Binary files /dev/null and b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/MSSharedLibKey.snk differ diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.psd1 b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.psd1 new file mode 100644 index 000000000000..7bd34f5212b2 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.psd1 @@ -0,0 +1,88 @@ +# +# Module manifest for module 'Microsoft.AzureStack.Commands.Admin' +# +# Generated by: Microsoft Corporation +# +# Generated on: 04/01/2015 +# + +@{ + +# Version number of this module. +ModuleVersion = '0.9.1' + +# ID used to uniquely identify this module +GUID = 'F237EAAA-BD3A-4965-AD4A-BF38598BFEF7' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = 'Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '3.0' + +# Name of the Windows PowerShell host required by this module +PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +PowerShellHostVersion = '' + +# Minimum version of the .NET Framework required by this module +DotNetFrameworkVersion = '4.5' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion='4.0' + +# Processor architecture (None, X86, Amd64, IA64) required by this module +ProcessorArchitecture = 'None' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module +ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in ModuleToProcess +NestedModules = @( + '.\Microsoft.AzureStack.Commands.dll' +) + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = @() + +# List of all modules packaged with this module +ModuleList = @() + +# List of all files packaged with this module +FileList = @() + +# Private data to pass to the module specified in ModuleToProcess +PrivateData = '' + +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.xml b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.xml new file mode 100644 index 000000000000..88d7f77aa009 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.AzureStack.Commands.dll-help.xml @@ -0,0 +1,7126 @@ + + + + + Add-AzureRMGalleryItem + + Adds a new Gallery Item to the Gallery Service. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Add + AzureRMGalleryItem + + + + + + + + Add-AzureRMGalleryItem + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to uploading the Gallery Item + + Guid + + + Path + + Path to the azpkg file + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to uploading the Gallery Item + + Guid + + Guid + + + + + + Path + + Path to the azpkg file + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add-AzureRMResourceProviderRegistration + + Enables you to add a custom Resource Provider to Resource Manager. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Add + AzureRMResourceProviderRegistration + + + + + + + + Add-AzureRMResourceProviderRegistration + + ArmLocation + + + + String + + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + DisplayName + + Display Name for the Resource Provider + + String + + + Location + + The Location to which you'd like to register the Resource Provider. It should be a value that already exists in the system. + + String + + + ManifestEndpoint + + The endpoint of the Manifest for the Resource Provider that needs to be registered with Azure Stack + + Uri + + + UserName + + UserName for the Manifest endpoint + + String + + + Password + + Password for the Manifest endpoint + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Add-AzureRMResourceProviderRegistration + + ProviderRegistration + + Provider Registration Object + + ProviderRegistrationModel + + + ArmLocation + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ArmLocation + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + DisplayName + + Display Name for the Resource Provider + + String + + String + + + + + + Location + + The Location to which you'd like to register the Resource Provider. It should be a value that already exists in the system. + + String + + String + + + + + + ManifestEndpoint + + The endpoint of the Manifest for the Resource Provider that needs to be registered with Azure Stack + + Uri + + Uri + + + + + + UserName + + UserName for the Manifest endpoint + + String + + String + + + + + + Password + + Password for the Manifest endpoint + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + ProviderRegistration + + Provider Registration Object + + ProviderRegistrationModel + + ProviderRegistrationModel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMGalleryItem + + fetches a Gallery Item from the Gallery Service. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureRMGalleryItem + + + + + + + + Get-AzureRMGalleryItem + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMManagedLocation + + Gets all the regions registered in the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureRMManagedLocation + + + + + + + + Get-AzureRMManagedLocation + + Name + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMManagedSubscription + + Gets a list of all Tenant Subscriptions in the system managed by the admin user. + + + + + Get + AzureRMManagedSubscription + + + + + + + + Get-AzureRMManagedSubscription + + TargetSubscriptionId + + + + Guid + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + TargetSubscriptionId + + + + Guid + + Guid + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMOffer + + Gets the list of all Offers in the system. When the Offer Id or Name is mentioned, it fetches the specific Offer. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureRMOffer + + + + + + + + Get-AzureRMOffer + + Provider + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRMOffer + + OfferId + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRMOffer + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + Managed + + + + SwitchParameter + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Provider + + + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + OfferId + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + Managed + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMPlan + + Gets the list of all Plans in the system. When the Plan Name is mentioned, it fetches the specific Plan. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureRMPlan + + + + + + + + Get-AzureRMPlan + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRMPlan + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + Managed + + + + SwitchParameter + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRMPlan + + Name + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + Managed + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMResourceProviderRegistration + + Gets all the Resource Provider registered to the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments. + + + + + Get + AzureRMResourceProviderRegistration + + + + + + + + Get-AzureRMResourceProviderRegistration + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRMTenantSubscription + + Gets a list of Subscriptions that a user has access to.. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureRMTenantSubscription + + + + + + + + Get-AzureRMTenantSubscription + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureStackToken + + Gets a token for a specified user. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Get + AzureStackToken + + + + + + + + Get-AzureStackToken + + Authority + + + + String + + + Resource + + + + String + + + ClientId + + + + String + + + Credential + + + + PSCredential + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureStackToken + + Authority + + + + String + + + Resource + + + + String + + + AadTenantId + + + + String + + + ClientId + + + + String + + + Credential + + + + PSCredential + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Authority + + + + String + + String + + + + + + Resource + + + + String + + String + + + + + + ClientId + + + + String + + String + + + + + + Credential + + + + PSCredential + + PSCredential + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + AadTenantId + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureRMManagedLocation + + Adds a region to the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + New + AzureRMManagedLocation + + + + + + + + New-AzureRMManagedLocation + + Name + + + + String + + + DisplayName + + + + String + + + Latitude + + + + Double + + + Longitude + + + + Double + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + DisplayName + + + + String + + String + + + + + + Latitude + + + + Double + + Double + + + + + + Longitude + + + + Double + + Double + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureRMManagedSubscription + + Adds a new Subscription for the current user. This is applicable only to users with access to the Subscriptions.Admin namespace. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + New + AzureRMManagedSubscription + + + + + + + + New-AzureRMManagedSubscription + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + Owner + + + + String + + + OfferId + + + + String + + + DisplayName + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + Owner + + + + String + + String + + + + + + OfferId + + + + String + + String + + + + + + DisplayName + + + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureRMOffer + + Creates a new Offer. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + New + AzureRMOffer + + + + + + + + New-AzureRMOffer + + Name + + + + String + + + DisplayName + + + + String + + + State + + + + AccessibilityState + + + BasePlans + + + + AdminPlanModel[] + + + ArmLocation + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + DisplayName + + + + String + + String + + + + + + State + + + + AccessibilityState + + AccessibilityState + + + + + + BasePlans + + + + AdminPlanModel[] + + AdminPlanModel[] + + + + + + ArmLocation + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureRMPlan + + Creates a new Plan. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + New + AzureRMPlan + + + + + + + + New-AzureRMPlan + + Name + + + + String + + + DisplayName + + + + String + + + State + + + + AccessibilityState + + + ArmLocation + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + DisplayName + + + + String + + String + + + + + + State + + + + AccessibilityState + + AccessibilityState + + + + + + ArmLocation + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureRMTenantSubscription + + Creates a new Tenant Subscription. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + New + AzureRMTenantSubscription + + + + + + + + New-AzureRMTenantSubscription + + Owner + + + + String + + + OfferId + + + + String + + + DisplayName + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Owner + + + + String + + String + + + + + + OfferId + + + + String + + String + + + + + + DisplayName + + + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMGalleryItem + + Removes a Gallery Item from the Gallery Service. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMGalleryItem + + + + + + + + Remove-AzureRMGalleryItem + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMManagedLocation + + Removes a region from the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMManagedLocation + + + + + + + + Remove-AzureRMManagedLocation + + Name + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMManagedSubscription + + Removes a Subscription from the current user. This is applicable only to users with access to the Subscriptions.Admin namespace + + + + + Remove + AzureRMManagedSubscription + + + + + + + + Remove-AzureRMManagedSubscription + + SubscriptionId + + + + Guid + + + TargetSubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + SubscriptionId + + + + Guid + + Guid + + + + + + TargetSubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMOffer + + Removes an Offer. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMOffer + + + + + + + + Remove-AzureRMOffer + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMPlan + + Removes a Plan. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMPlan + + + + + + + + Remove-AzureRMPlan + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMResourceProviderRegistration + + Removes a custom Resource Provider from the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMResourceProviderRegistration + + + + + + + + Remove-AzureRMResourceProviderRegistration + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRMTenantSubscription + + Removes a Tenant Subscription. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Remove + AzureRMTenantSubscription + + + + + + + + Remove-AzureRMTenantSubscription + + TargetSubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + TargetSubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMManagedLocation + + Updates a region in the cloud. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMManagedLocation + + + + + + + + Set-AzureRMManagedLocation + + Location + + + + Location + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + + + Location + + Location + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMManagedSubscription + + Updates a Subscription for the current user. This cmdlet can be used only by users with access to the Subscriptions.Admin namespace. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMManagedSubscription + + + + + + + + Set-AzureRMManagedSubscription + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + Subscription + + + + SubscriptionDefinition + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + Subscription + + + + SubscriptionDefinition + + SubscriptionDefinition + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMOffer + + Updates an Offer. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMOffer + + + + + + + + Set-AzureRMOffer + + Offer + + + + AdminOfferModel + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Offer + + + + AdminOfferModel + + AdminOfferModel + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMPlan + + Updates a Plan. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMPlan + + + + + + + + Set-AzureRMPlan + + Plan + + + + AdminPlanModel + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Plan + + + + AdminPlanModel + + AdminPlanModel + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMResourceProviderRegistration + + Updates a Resource Provider Registration. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMResourceProviderRegistration + + + + + + + + Set-AzureRMResourceProviderRegistration + + ArmLocation + + + + String + + + Name + + + + String + + + ResourceGroup + + + + String + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + + DisplayName + + + + String + + + Location + + + + String + + + ManifestEndpoint + + + + Uri + + + UserName + + + + String + + + Password + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRMResourceProviderRegistration + + ProviderRegistration + + + + ProviderRegistrationModel + + + ArmLocation + + + + String + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ArmLocation + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + ResourceGroup + + + + String + + String + + + + + + SubscriptionId + + The Id of the subscription that has access to the required namespace to complete the operation + + Guid + + Guid + + + + + + DisplayName + + + + String + + String + + + + + + Location + + + + String + + String + + + + + + ManifestEndpoint + + + + Uri + + Uri + + + + + + UserName + + + + String + + String + + + + + + Password + + + + String + + String + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + ProviderRegistration + + + + ProviderRegistrationModel + + ProviderRegistrationModel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRMTenantSubscription + + Updates a tenant subscription. This cmdlet is applicable only to Microsoft Azure Stack Environments + + + + + Set + AzureRMTenantSubscription + + + + + + + + Set-AzureRMTenantSubscription + + Subscription + + + + SubscriptionDefinition + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + + ApiVersion + + Version of the API for this request + + String + + + DisableCertificateValidation + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Subscription + + + + SubscriptionDefinition + + SubscriptionDefinition + + + + + + AdminUri + + URI of the Azure Resource Manager endpoint + + Uri + + Uri + + + + + + Token + + A valid Security token for a user/principal that has access to the Subscription + + String + + String + + + + + + ApiVersion + + Version of the API for this request + + String + + String + + + + + + DisableCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/AddGalleryItem.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/AddGalleryItem.cs new file mode 100644 index 000000000000..79a46759df3e --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/AddGalleryItem.cs @@ -0,0 +1,78 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.IO; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Gallery Item Cmdlet + /// + [Cmdlet(VerbsCommon.Add, Nouns.GalleryItem)] + [OutputType(typeof(AzureOperationResponse))] + public class AddGalleryItem : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets the path. TODO - support directory and file path. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateNotNull] + public string Path { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + this.WriteVerbose(Resources.AddingGalleryItem.FormatArgs(this.Name)); + + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + using (var filestream = File.Open(this.Path, FileMode.Open, FileAccess.Read)) + { + var manifest = client.Package.CreateOrUpdate(this.ResourceGroup, Guid.NewGuid().ToString(), filestream); + var uploadParameters = new GalleryItemCreateOrUpdateParameters() { Manifest = manifest.Manifest }; + return client.GalleryItem.CreateOrUpdate(this.ResourceGroup, this.Name, uploadParameters); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/GetGalleryItem.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/GetGalleryItem.cs new file mode 100644 index 000000000000..297ce31e64f1 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/GetGalleryItem.cs @@ -0,0 +1,80 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Gallery Item Cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.GalleryItem)] + [OutputType(typeof(GalleryItemModel))] + public class GetGalleryItem : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (string.IsNullOrEmpty(this.Name)) + { + this.WriteVerbose(Resources.ListingGalleryItems); + + return string.IsNullOrEmpty(this.ResourceGroup) + ? client.GalleryItem.ListWithoutResourceGroup().GalleryItems + : client.GalleryItem.List(this.ResourceGroup).GalleryItems; + } + else if (string.IsNullOrEmpty(this.ResourceGroup)) + { + throw new ValidationMetadataException(Resources.ResourceGroupCannotBeEmpty); + } + else + { + this.WriteVerbose(Resources.GettingGalleryItem.FormatArgs(this.Name)); + return client.GalleryItem.Get(this.ResourceGroup, this.Name).GalleryItem; + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/RemoveGalleryItem.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/RemoveGalleryItem.cs new file mode 100644 index 000000000000..87cc4829d1bd --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Gallery/GalleryItems/RemoveGalleryItem.cs @@ -0,0 +1,64 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + + /// + /// Gallery Item Cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.GalleryItem)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveGalleryItem : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription identifier. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + return client.GalleryItem.Delete(this.ResourceGroup, this.Name); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/GetManagedLocation.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/GetManagedLocation.cs new file mode 100644 index 000000000000..dca7bd457b92 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/GetManagedLocation.cs @@ -0,0 +1,66 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Remove managed location cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.Location)] + [OutputType(typeof(Location))] + public class GetManagedLocation : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter] + [ValidateLength(1, 128)] + [ValidateNotNull] + [ValidatePattern("^[0-9a-z]+$")] + public string Name { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets the managed location + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (string.IsNullOrEmpty(this.Name)) + { + this.WriteVerbose(Resources.ListingManagedLocations); + return client.ManagedLocations.List().Locations; + } + else + { + this.WriteVerbose(Resources.GettingManagedLocation.FormatArgs(this.Name)); + return client.ManagedLocations.Get(this.Name).Location; + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/NewManagedLocation.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/NewManagedLocation.cs new file mode 100644 index 000000000000..0e18a05863ea --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/NewManagedLocation.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.AzureStack.Commands +{ + using System; + using System.Globalization; + using System.Linq; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// New managed location cmdlet + /// + [Cmdlet(VerbsCommon.New, Nouns.Location)] + [OutputType(typeof(Location))] + public class NewManagedLocation : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + [ValidatePattern("^[0-9a-z]+$")] + public string Name { get; set; } + + /// + /// Gets or sets the display name. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets or sets the latitude of location in signed degrees format. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + [ValidateRange(-90.0, 90.0)] + public double Latitude { get; set; } + + /// + /// Gets or sets the longitude of location in signed degrees format. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + [ValidateRange(-180.0, 180.0)] + public double Longitude { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Creates a new location + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.CreatingNewManagedLocation.FormatArgs(this.Name)); + var parameters = new ManagedLocationCreateOrUpdateParameters() + { + Location = new Location() + { + DisplayName = this.DisplayName, + Latitude = this.Latitude.ToString(CultureInfo.InvariantCulture), + Longitude = this.Longitude.ToString(CultureInfo.InvariantCulture), + Name = this.Name + } + }; + + if (client.ManagedLocations.List() + .Locations.Any(location => location.Name.EqualsInsensitively(parameters.Location.Name))) + { + throw new PSInvalidOperationException(Resources.ManagedLocationAlreadyExists.FormatArgs(parameters.Location.Name)); + } + + return client.ManagedLocations.CreateOrUpdate(parameters).Location; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/RemoveManagedLocation.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/RemoveManagedLocation.cs new file mode 100644 index 000000000000..0cd75526f60c --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/RemoveManagedLocation.cs @@ -0,0 +1,59 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.Azure; + using Microsoft.WindowsAzure; + using Microsoft.AzureStack.Management; + + /// + /// Remove managed location cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.Location)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveManagedLocation : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + [ValidatePattern("^[0-9a-z]+$")] + public string Name { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Removes the specified location + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.RemovingManagedLocation.FormatArgs(this.Name)); + return client.ManagedLocations.Delete(this.Name); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/SetManagedLocation.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/SetManagedLocation.cs new file mode 100644 index 000000000000..8cb6372aa5fa --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ManagedLocations/SetManagedLocation.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Set managed location cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.Location)] + [OutputType(typeof(Location))] + public class SetManagedLocation : AdminApiCmdlet + { + /// + /// Gets or sets the managed location. + /// + [Parameter(ValueFromPipeline = true, Mandatory = true)] + [ValidateNotNull] + public Location Location { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Updates the managed location with new values + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.UpdatingManagedLocation.FormatArgs(this.Location.Name)); + var parameters = new ManagedLocationCreateOrUpdateParameters(this.Location); + return client.ManagedLocations.CreateOrUpdate(parameters).Location; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/GetOffer.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/GetOffer.cs new file mode 100644 index 000000000000..2425306b6cd3 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/GetOffer.cs @@ -0,0 +1,122 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Get Offer cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.Offer, DefaultParameterSetName = "TenantList")] + [OutputType(typeof(OfferDefinition))] + [OutputType(typeof(AdminOfferModel))] + public class GetOffer : AdminApiCmdlet + { + /// + /// Gets or sets the offer identifier used in the tenant get flow. + /// + [Parameter(ParameterSetName = "TenantGet", Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string OfferId { get; set; } + + /// + /// Gets or sets the provider name. + /// + [Parameter(ParameterSetName = "TenantList")] + [ValidateNotNull] + public string Provider { get; set; } + + /// + /// Gets or sets the Offer name used in the Admin get flow. + /// + [Parameter(ParameterSetName = "Admin")] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ParameterSetName = "Admin", Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "Admin", Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets a switch indicating whether to return managed offers. + /// + [Parameter(ParameterSetName = "Admin", Mandatory = true)] + public SwitchParameter Managed { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + if (this.Managed.IsPresent) + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (string.IsNullOrEmpty(this.Name)) + { + this.WriteVerbose(Resources.ListingManagedOffers.FormatArgs(this.ResourceGroup)); + return client.ManagedOffers.List(this.ResourceGroup, includeDetails: true).Offers; + } + else + { + this.WriteVerbose(Resources.GettingManagedOffer.FormatArgs(this.Name, this.ResourceGroup)); + return client.ManagedOffers.Get(this.ResourceGroup, this.Name).Offer; + } + } + } + else + { + using (var client = this.GetAzureStackClient()) + { + if (string.IsNullOrEmpty(this.OfferId)) + { + if (string.IsNullOrEmpty(this.Provider)) + { + this.WriteVerbose(Resources.ListingOffers.FormatArgs("")); + return client.Offers.ListUnderRootProvider().Offers; + } + else + { + this.WriteVerbose(Resources.ListingOffers.FormatArgs(this.Provider)); + return client.Offers.List(this.Provider).Offers; + } + } + else + { + this.WriteVerbose(Resources.GettingOffer.FormatArgs(this.OfferId)); + return client.Offers.Get(this.OfferId).Offer; + } + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/NewOffer.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/NewOffer.cs new file mode 100644 index 000000000000..bb7d98a948a6 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/NewOffer.cs @@ -0,0 +1,131 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// New Offer cmdlet + /// + [Cmdlet(VerbsCommon.New, Nouns.Offer)] + [OutputType(typeof(AdminOfferModel))] + public class NewOffer : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the display name. + /// + [Parameter] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets or sets the state of the offer. + /// + [Parameter] + public AccessibilityState State { get; set; } + + /// + /// Gets or sets the base plans. + /// + [Parameter(ValueFromPipeline = true)] + [ValidateNotNull] + public AdminPlanModel[] BasePlans { get; set; } + + /// + /// Gets or sets the resource manager location. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public string ArmLocation { get; set; } // TODO - use API to get CSM location? + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + this.WriteVerbose(Resources.CreatingNewOffer.FormatArgs(this.Name, this.ResourceGroup)); + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + // Ensure the resource group is created + client.ResourceGroups.CreateOrUpdate(new ResourceGroupCreateOrUpdateParameters() + { + ResourceGroup = new ResourceGroupDefinition() + { + Location = this.ArmLocation, + Name = this.ResourceGroup, + } + }); + + var parameters = new ManagedOfferCreateOrUpdateParameters() + { + Offer = new AdminOfferModel() + { + Name = this.Name, + Location = this.ArmLocation, + Properties = new AdminOfferDefinition() + { + Name = this.Name, + DisplayName = this.DisplayName, + State = this.State, + } + } + }; + + if (this.BasePlans != null && this.BasePlans.Length > 0) + { + parameters.Offer.Properties.BasePlans = this.BasePlans.Select(plan => plan.Properties).ToArray(); + } + + if (client.ManagedOffers.List(this.ResourceGroup, includeDetails: false).Offers + .Any(offer => string.Equals(offer.Properties.Name, parameters.Offer.Properties.Name, StringComparison.OrdinalIgnoreCase))) + { + throw new PSInvalidOperationException(Resources.ManagedOfferAlreadyExists.FormatArgs(parameters.Offer.Properties.Name, this.ResourceGroup)); + } + + return client.ManagedOffers.CreateOrUpdate(this.ResourceGroup, parameters).Offer; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/RemoveOffer.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/RemoveOffer.cs new file mode 100644 index 000000000000..ef05e409042b --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/RemoveOffer.cs @@ -0,0 +1,65 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + + /// + /// Remove Offer cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.Offer)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveOffer : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.RemovingManagedOffer.FormatArgs(this.Name, this.ResourceGroup)); + return client.ManagedOffers.Delete(this.ResourceGroup, this.Name); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/SetOffer.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/SetOffer.cs new file mode 100644 index 000000000000..0c632aef8b22 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Offers/SetOffer.cs @@ -0,0 +1,65 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Set Offer cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.Offer)] + [OutputType(typeof(AdminOfferModel))] + public class SetOffer : AdminApiCmdlet + { + /// + /// Gets or sets the offer. + /// + [Parameter(ValueFromPipeline = true, Mandatory = true)] + [ValidateNotNull] + public AdminOfferModel Offer { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.UpdatingOffer.FormatArgs(this.Offer.Name, this.ResourceGroup)); + var parameters = new ManagedOfferCreateOrUpdateParameters(this.Offer); + return client.ManagedOffers.CreateOrUpdate(this.ResourceGroup, parameters).Offer; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/GetPlan.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/GetPlan.cs new file mode 100644 index 000000000000..ab549b101f77 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/GetPlan.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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Get Plan cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.Plan, DefaultParameterSetName = "TenantList")] + [OutputType(typeof(AdminPlanModel))] + ////[OutputType(typeof(PlanDefinition))] + public class GetPlan : AdminApiCmdlet + { + /// + /// Gets or sets the Offer name. + /// + [Parameter(ParameterSetName = "TenantGet", Mandatory = true)] + [Parameter(ParameterSetName = "Admin")] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ParameterSetName = "Admin", Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = "Admin", Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets a switch indicating whether to return managed plans. + /// + [Parameter(ParameterSetName = "Admin", Mandatory = true)] + public SwitchParameter Managed { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + if (this.Managed.IsPresent) + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (string.IsNullOrEmpty(this.Name)) + { + this.WriteVerbose(Resources.ListingManagedPlans.FormatArgs(this.ResourceGroup)); + return client.ManagedPlans.List(this.ResourceGroup, includeDetails: true).Plans; + } + else + { + this.WriteVerbose(Resources.GettingManagedPlan.FormatArgs(this.Name, this.ResourceGroup)); + return client.ManagedPlans.Get(this.ResourceGroup, this.Name).Plan; + } + } + } + else + { + throw new PSNotSupportedException("This API is not supported at this time. Please use the -Managed switch to get managed plans."); + + ////using (var client = this.GetAzureStackClient()) + ////{ + //// if (string.IsNullOrEmpty(this.Name)) + //// { + //// this.WriteVerbose(Resources.ListingPlans); + //// return client.Plans.List(includeDetails: true).Plans; + //// } + //// else + //// { + //// this.WriteVerbose(Resources.GettingPlan.FormatArgs(this.Name)); + //// return client.Plans.Get(this.Name).Plan; + //// } + ////} + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/NewPlan.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/NewPlan.cs new file mode 100644 index 000000000000..0960b62a0994 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/NewPlan.cs @@ -0,0 +1,120 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Linq; + using Microsoft.WindowsAzure.Commands.Common; + using System.Management.Automation; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// New Plan cmdlet + /// + [Cmdlet(VerbsCommon.New, Nouns.Plan, DefaultParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [OutputType(typeof(AdminPlanModel))] + public class NewPlan : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the display name. + /// + [Parameter] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets or sets the state of the offer. + /// + [Parameter] + public AccessibilityState State { get; set; } + + /// + /// Gets or sets the resource manager location. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public string ArmLocation { get; set; } // TODO - use API to get CSM location? + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + this.WriteVerbose(Resources.CreatingNewPlan.FormatArgs(this.Name, this.ResourceGroup)); + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + // Ensure the resource group is created + client.ResourceGroups.CreateOrUpdate(new ResourceGroupCreateOrUpdateParameters() + { + ResourceGroup = new ResourceGroupDefinition() + { + Location = this.ArmLocation, + Name = this.ResourceGroup, + } + }); + + // TODO - determine what properties are needed + var parameters = new ManagedPlanCreateOrUpdateParameters() + { + Plan = new AdminPlanModel() + { + Name = this.Name, + Location = this.ArmLocation, + Properties = new AdminPlanDefinition() + { + Name = this.Name, + DisplayName = this.DisplayName, + State = this.State, + ServiceQuotas = new ServiceQuotaDefinition[0], + } + } + }; + + if (client.ManagedPlans.List(this.ResourceGroup, includeDetails: false).Plans + .Any(p => string.Equals(p.Properties.Name, parameters.Plan.Properties.Name, StringComparison.OrdinalIgnoreCase))) + { + throw new PSInvalidOperationException(Resources.ManagedPlanAlreadyExists.FormatArgs(parameters.Plan.Properties.Name, this.ResourceGroup)); + } + + return client.ManagedPlans.CreateOrUpdate(this.ResourceGroup, parameters).Plan; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/RemovePlan.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/RemovePlan.cs new file mode 100644 index 000000000000..11ebb42b0f9c --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/RemovePlan.cs @@ -0,0 +1,65 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + + /// + /// Remove Plan cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.Plan)] + [OutputType(typeof(AzureOperationResponse))] + public class RemovePlan : AdminApiCmdlet + { + /// + /// Gets or sets the name. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.RemovingManagedPlan.FormatArgs(this.Name, this.ResourceGroup)); + return client.ManagedPlans.Delete(this.ResourceGroup, this.Name); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/SetPlan.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/SetPlan.cs new file mode 100644 index 000000000000..58f2db219a85 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Plans/SetPlan.cs @@ -0,0 +1,65 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Linq; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Set Plan cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.Plan)] + [OutputType(typeof(AdminPlanModel))] + public class SetPlan : AdminApiCmdlet + { + /// + /// Gets or sets the plan. + /// + [Parameter(ValueFromPipeline = true, Mandatory = true)] + [ValidateNotNull] + public AdminPlanModel Plan { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.UpdatingPlan.FormatArgs(this.Plan.Name, this.ResourceGroup)); + var parameters = new ManagedPlanCreateOrUpdateParameters(this.Plan); + return client.ManagedPlans.CreateOrUpdate(this.ResourceGroup, parameters).Plan; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/AddResourceProviderRegistration.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/AddResourceProviderRegistration.cs new file mode 100644 index 000000000000..06e8aee9d04e --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/AddResourceProviderRegistration.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.AzureStack.Commands +{ + using System; + using System.Linq; + using System.Management.Automation; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + using Microsoft.WindowsAzure.Commands.Common; + + /// + /// Add Resource Provider Registration Cmdlet + /// + [Cmdlet(VerbsCommon.Add, Nouns.ResourceProviderRegistration, DefaultParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [OutputType(typeof(ProviderRegistrationModel))] + public class AddResourceProviderRegistration : SetResourceProviderRegistration + { + /// + /// Validates the prerequisites. + /// + /// The client. + /// The parameters. + protected override void ValidatePrerequisites(AzureStackClient client, ProviderRegistrationCreateOrUpdateParameters parameters) + { + ArgumentValidator.ValidateNotNull("client", client); + ArgumentValidator.ValidateNotNull("parameters", parameters); + + client.ResourceGroups.CreateOrUpdate(new ResourceGroupCreateOrUpdateParameters() + { + ResourceGroup = new ResourceGroupDefinition() + { + Location = this.ArmLocation, + Name = this.ResourceGroup, + } + }); + + var name = parameters.ProviderRegistration.Properties.Name; + var location = parameters.ProviderRegistration.Properties.Location; + + if (client.ProviderRegistrations.List(this.ResourceGroup).ProviderRegistrations + .Any(p => + string.Equals(p.Properties.Manifest.Namespace, name, StringComparison.OrdinalIgnoreCase) + && string.Equals(p.Properties.Location, location, StringComparison.OrdinalIgnoreCase))) + { + throw new PSInvalidOperationException(Resources.ProviderRegistrationAlreadyExists.FormatArgs(name, location)); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/GetResourceProviderRegistration.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/GetResourceProviderRegistration.cs new file mode 100644 index 000000000000..aa314344f518 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/GetResourceProviderRegistration.cs @@ -0,0 +1,73 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Resource Provider Registration Cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.ResourceProviderRegistration)] + [OutputType(typeof(ProviderRegistrationModel))] + public class GetResourceProviderRegistration : AdminApiCmdlet + { + /// + /// Gets or sets the resource provider registration name. + /// + [Parameter] + [ValidateLength(1, 128)] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (string.IsNullOrEmpty(this.Name)) + { + this.WriteVerbose(Resources.ListingResourceProviderRegistration); + return client.ProviderRegistrations.List(this.ResourceGroup).ProviderRegistrations; + } + else + { + this.WriteVerbose(Resources.GettingResourceProviderRegistration.FormatArgs(this.Name)); + return client.ProviderRegistrations.Get(this.ResourceGroup, this.Name).ProviderRegistration; + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/RemoveResourceProviderRegistration.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/RemoveResourceProviderRegistration.cs new file mode 100644 index 000000000000..ad4c3351725c --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/RemoveResourceProviderRegistration.cs @@ -0,0 +1,65 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.WindowsAzure; + using Microsoft.AzureStack.Management; + + /// + /// Resource Provider Registration Cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.ResourceProviderRegistration)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveResourceProviderRegistration : AdminApiCmdlet + { + /// + /// Gets or sets the resource provider registration name. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.RemovingResourceProviderRegistration.FormatArgs(this.Name)); + return client.ProviderRegistrations.Delete(this.ResourceGroup, this.Name); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/SetResourceProviderRegistration.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/SetResourceProviderRegistration.cs new file mode 100644 index 000000000000..dc4d9c9e1ac0 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/ProviderRegistrations/SetResourceProviderRegistration.cs @@ -0,0 +1,172 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Linq; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Resource Provider Registration Cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.ResourceProviderRegistration, DefaultParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [OutputType(typeof(ProviderRegistrationModel))] + public class SetResourceProviderRegistration : AdminApiCmdlet + { + /// + /// Gets or sets the provider registration. + /// + [Parameter(Mandatory = true, ValueFromPipeline = true, ParameterSetName = CommonPSConst.ParameterSet.ByObject)] + [ValidateNotNull] + public ProviderRegistrationModel ProviderRegistration { get; set; } + + /// + /// Gets or sets the resource manager location. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public string ArmLocation { get; set; } // TODO - use API to get CSM location? + + /// + /// Gets or sets the resource provider registration name. + /// + [Parameter(Mandatory = true, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Name { get; set; } + + /// + /// Gets or sets the resource group. + /// + [Parameter(Mandatory = true, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string ResourceGroup { get; set; } + + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateNotNull] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets the resource provider registration display name. + /// + [Parameter(Mandatory = true, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets or sets the resource provider registration location (region). + /// + [Parameter(Mandatory = true, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateNotNull] + public string Location { get; set; } + + /// + /// Gets or sets the resource provider registration manifest endpoint. + /// + [Parameter(Mandatory = true, ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateAbsoluteUri] + [ValidateNotNull] + public Uri ManifestEndpoint { get; set; } + + /// + /// Gets or sets the resource provider registration user name. + /// + [Parameter(ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateNotNull] + public string UserName { get; set; } + + /// + /// Gets or sets the resource provider registration password. + /// + [Parameter(ParameterSetName = CommonPSConst.ParameterSet.ByProperty)] + [ValidateNotNull] + public string Password { get; set; } + + /// + /// Executes the API call(s) against Azure Resource Management API(s). + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + var parameters = new ProviderRegistrationCreateOrUpdateParameters() + { + ProviderRegistration = this.ProviderRegistration ?? new ProviderRegistrationModel() + { + Name = this.Name, + Location = this.ArmLocation, + Properties = new ProviderRegistrationDefinition() + { + Name = this.Name, + DisplayName = this.DisplayName, + Enabled = true, + Location = this.Location, + ManifestEndpoint = new ResourceProviderEndpoint() + { + EndpointUri = this.ManifestEndpoint.AbsoluteUri, + AuthenticationUsername = this.UserName, + AuthenticationPassword = this.Password, + } + } + } + }; + + this.WriteVerbose(Resources.AddingResourceProviderRegistration.FormatArgs(parameters.ProviderRegistration.Properties.Name)); + + this.ValidatePrerequisites(client, parameters); + + return client.ProviderRegistrations + .CreateOrUpdate(this.ResourceGroup, parameters) + .ProviderRegistration; + } + } + + /// + /// Validates the prerequisites. + /// + /// The client. + /// The parameters. + protected virtual void ValidatePrerequisites(AzureStackClient client, ProviderRegistrationCreateOrUpdateParameters parameters) + { + ArgumentValidator.ValidateNotNull("client", client); + ArgumentValidator.ValidateNotNull("parameters", parameters); + + if (!client.ResourceGroups.List().ResourceGroups.Any(r => string.Equals(r.Name, this.ResourceGroup, StringComparison.OrdinalIgnoreCase))) + { + throw new PSInvalidOperationException(Resources.ResourceGroupDoesNotExist.FormatArgs(this.ResourceGroup)); + } + + var name = parameters.ProviderRegistration.Properties.Name; + var location = parameters.ProviderRegistration.Properties.Location; + + if (!client.ProviderRegistrations.List(this.ResourceGroup).ProviderRegistrations + .Any(p => + string.Equals(p.Properties.Manifest.Namespace, name, StringComparison.OrdinalIgnoreCase) + && string.Equals(p.Properties.Location, location, StringComparison.OrdinalIgnoreCase))) + { + throw new PSInvalidOperationException(Resources.ProviderRegistrationDoesNotExist.FormatArgs(name, location)); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetManagedSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetManagedSubscription.cs new file mode 100644 index 000000000000..8e8477712dac --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetManagedSubscription.cs @@ -0,0 +1,63 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Get Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.ManagedSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class GetManagedSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + public Guid TargetSubscriptionId { get; set; } // Allow for empty GUID for list scenario + + /// + /// Gets or sets the admin subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Performs the API operation(s) against managed subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + if (this.TargetSubscriptionId == Guid.Empty) + { + this.WriteVerbose(Resources.ListingManagedSubscriptions); + return client.ManagedSubscriptions.List(includeDetails: true).Subscriptions; + } + else + { + this.WriteVerbose(Resources.GettingSubscriptionByID.FormatArgs(this.TargetSubscriptionId)); + return client.ManagedSubscriptions.Get(this.TargetSubscriptionId.ToString()).Subscription; + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetTenantSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetTenantSubscription.cs new file mode 100644 index 000000000000..b7f1d8447b16 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/GetTenantSubscription.cs @@ -0,0 +1,55 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Get Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.TenantSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class GetTenantSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription id. + /// + public Guid SubscriptionId { get; set; } // Allow for empty GUID for list scenario + + /// + /// Performs the API operation(s) against tenant subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient()) + { + if (this.SubscriptionId == Guid.Empty) + { + this.WriteVerbose(Resources.ListingSubscriptions); + return client.Subscriptions.List(true).Subscriptions; + } + else + { + this.WriteVerbose(Resources.GettingSubscriptionByID.FormatArgs(this.SubscriptionId)); + return client.Subscriptions.Get(this.SubscriptionId.ToString()).Subscription; + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewManagedSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewManagedSubscription.cs new file mode 100644 index 000000000000..86ca34874dd9 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewManagedSubscription.cs @@ -0,0 +1,115 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// New Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.New, Nouns.ManagedSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class NewManagedSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets the owner. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Owner { get; set; } + + /// + /// Gets or sets the identifier of the offer. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string OfferId { get; set; } + + /// + /// Gets or sets the display name. + /// + [Parameter] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets the subscription definition. + /// + protected SubscriptionDefinition GetSubscriptionDefinition() + { + // TODO: determine any extra properties which could / should be set + return new SubscriptionDefinition() + { + SubscriptionId = Guid.NewGuid().ToString(), + DisplayName = this.DisplayName, + OfferId = this.OfferId, + OfferName = GetAndValidateOfferName(this.OfferId), + Owner = this.Owner, + State = SubscriptionState.Enabled, + }; + } + + /// + /// Performs the API operation(s) against managed subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.CreatingNewSubscription.FormatArgs(this.Owner, this.OfferId, this.DisplayName)); + var parameters = new ManagedSubscriptionCreateOrUpdateParameters(this.GetSubscriptionDefinition()); + return client.ManagedSubscriptions.CreateOrUpdate(parameters).Subscription; + } + } + + /// + /// Gets and validates the name of the offer. + /// + /// The offer identifier. + private static string GetAndValidateOfferName(string offerId) + { + ArgumentValidator.ValidateNotNull("offerId", offerId); + + var parts = offerId.Trim('/').Split('/'); + + if (parts.Length != 4 + || !"delegatedProviders".EqualsInsensitively(parts[0]) + || !"offers".EqualsInsensitively(parts[2]) + || string.IsNullOrWhiteSpace(parts[1]) + || string.IsNullOrWhiteSpace(parts[3])) + { + throw new ArgumentException( + message: "Invalid offer identifier; must be of the form '/delegatedProviders/{providerId}/offers/{offerName}'", + paramName: "offerId"); + } + + return parts[3]; + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewTenantSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewTenantSubscription.cs new file mode 100644 index 000000000000..21b06a5fbc94 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/NewTenantSubscription.cs @@ -0,0 +1,108 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// New Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.New, Nouns.TenantSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class NewTenantSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the owner. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string Owner { get; set; } + + /// + /// Gets or sets the identifier of the offer. + /// + [Parameter(Mandatory = true)] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string OfferId { get; set; } + + /// + /// Gets or sets the display name. + /// + [Parameter] + [ValidateLength(1, 128)] + [ValidateNotNull] + public string DisplayName { get; set; } + + /// + /// Gets the subscription definition. + /// + protected SubscriptionDefinition GetSubscriptionDefinition() + { + // TODO: determine any extra properties which could / should be set + return new SubscriptionDefinition() + { + SubscriptionId = Guid.NewGuid().ToString(), + DisplayName = this.DisplayName, + OfferId = this.OfferId, + OfferName = GetAndValidateOfferName(this.OfferId), + Owner = this.Owner, + State = SubscriptionState.Enabled, + }; + } + + /// + /// Performs the API operation(s) against tenant subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient()) + { + this.WriteVerbose(Resources.CreatingNewSubscription.FormatArgs(this.Owner, this.OfferId, this.DisplayName)); + var parameters = new SubscriptionCreateOrUpdateParameters(this.GetSubscriptionDefinition()); + return client.Subscriptions.CreateOrUpdate(parameters).Subscription; + } + } + + /// + /// Gets and validates the name of the offer. + /// + /// The offer identifier. + private static string GetAndValidateOfferName(string offerId) + { + ArgumentValidator.ValidateNotNull("offerId", offerId); + + var parts = offerId.Trim('/').Split('/'); + + if (parts.Length != 4 + || !"delegatedProviders".EqualsInsensitively(parts[0]) + || !"offers".EqualsInsensitively(parts[2]) + || string.IsNullOrWhiteSpace(parts[1]) + || string.IsNullOrWhiteSpace(parts[3])) + { + throw new ArgumentException( + message: "Invalid offer identifier; must be of the form '/delegatedProviders/{providerId}/offers/{offerName}'", + paramName: "offerId"); + } + + return parts[3]; + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveManagedSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveManagedSubscription.cs new file mode 100644 index 000000000000..a55fd56cda63 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveManagedSubscription.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.ManagedSubscription)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveManagedSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription id. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription ID to be deleted. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateGuidNotEmpty] + public Guid TargetSubscriptionId { get; set; } + + /// + /// Performs the API operation(s) against managed subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose(Resources.DeletingSubscription.FormatArgs(this.TargetSubscriptionId)); + return client.ManagedSubscriptions.Delete(this.TargetSubscriptionId.ToString()); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveTenantSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveTenantSubscription.cs new file mode 100644 index 000000000000..bb9d1f36e05e --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/RemoveTenantSubscription.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.Azure; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Remove, Nouns.TenantSubscription)] + [OutputType(typeof(AzureOperationResponse))] + public class RemoveTenantSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription ID to be deleted. + /// + [Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] + [ValidateGuidNotEmpty] + public Guid TargetSubscriptionId { get; set; } + + /// + /// Performs the API operation(s) against tenant subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient()) + { + this.WriteVerbose(Resources.DeletingSubscription.FormatArgs(this.TargetSubscriptionId)); + return client.Subscriptions.Delete(this.TargetSubscriptionId.ToString()); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetManagedSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetManagedSubscription.cs new file mode 100644 index 000000000000..5ead39a1b456 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetManagedSubscription.cs @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + /// + /// Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.ManagedSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class SetManagedSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription id. + /// + [Parameter(Mandatory = false)] + [ValidateGuidNotEmpty] + public Guid SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription to be updated. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public SubscriptionDefinition Subscription { get; set; } + + /// + /// Performs the API operation(s) against managed subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient(this.SubscriptionId)) + { + this.WriteVerbose( + Resources.UpdatingManagedSubscription.FormatArgs( + this.Subscription.SubscriptionId, + this.Subscription.Owner, + this.SubscriptionId)); + + var parameters = new ManagedSubscriptionCreateOrUpdateParameters(this.Subscription); + return client.ManagedSubscriptions.CreateOrUpdate(parameters).Subscription; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetTenantSubscription.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetTenantSubscription.cs new file mode 100644 index 000000000000..09ea58409ea1 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Microsoft.Subscriptions/Subscriptions/SetTenantSubscription.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common; + using Microsoft.AzureStack.Management; + using Microsoft.AzureStack.Management.Models; + + /// + /// Subscription Cmdlet + /// + [Cmdlet(VerbsCommon.Set, Nouns.TenantSubscription)] + [OutputType(typeof(SubscriptionDefinition))] + public class SetTenantSubscription : AdminApiCmdlet + { + /// + /// Gets or sets the subscription to be updated. + /// + [Parameter(Mandatory = true)] + [ValidateNotNull] + public SubscriptionDefinition Subscription { get; set; } + + /// + /// Performs the API operation(s) against tenant subscriptions. + /// + protected override object ExecuteCore() + { + using (var client = this.GetAzureStackClient()) + { + this.WriteVerbose(Resources.UpdatingSubscription.FormatArgs(this.Subscription.SubscriptionId, this.Subscription.Owner)); + var parameters = new SubscriptionCreateOrUpdateParameters(this.Subscription); + return client.Subscriptions.CreateOrUpdate(parameters).Subscription; + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Nouns.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Nouns.cs new file mode 100644 index 000000000000..b7af401d29c8 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Nouns.cs @@ -0,0 +1,68 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + /// + /// All the nouns used in cmdlets. + /// + internal static class Nouns + { + /// + /// The prefix for cmdlet names. + /// + private const string Prefix = "AzureRM"; + + + /// + /// The noun for operations on Gallery Items. + /// + public const string GalleryItem = Prefix + "GalleryItem"; + + /// + /// The noun for operations on Resource Provider Registration. + /// + public const string ResourceProviderRegistration = Prefix + "ResourceProviderRegistration"; + + /// + /// The noun for operations on Tenant Subscriptions. + /// + public const string TenantSubscription = Prefix + "TenantSubscription"; + + /// + /// The noun for operations on Subscriptions as an administrator. + /// + public const string ManagedSubscription = Prefix + "ManagedSubscription"; + + /// + /// The noun for operations on Offers. + /// + public const string Offer = Prefix + "Offer"; + + /// + /// The noun for operations on Plans. + /// + public const string Plan = Prefix + "Plan"; + + /// + /// The noun for operations on Locations. + /// + public const string Location = Prefix + "ManagedLocation"; + + /// + /// The noun for operations on tokens. + /// + public const string Token = "AzureStackToken"; + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/AssemblyInfo.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..fc2dc57a7897 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft AzureStack Powershell ")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: Guid("0B02390C-8AA9-4D99-8AA8-2A9D2D39682F")] + +[assembly: AssemblyVersion("0.9.1")] +[assembly: AssemblyFileVersion("0.9.1")] \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.Designer.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..f77b7b7e76c9 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.Designer.cs @@ -0,0 +1,549 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.AzureStack.Commands { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AzureStack.Commands.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Adding gallery item with name "{0}".. + /// + public static string AddingGalleryItem { + get { + return ResourceManager.GetString("AddingGalleryItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Adding resource provider registration with name "{0}".. + /// + public static string AddingResourceProviderRegistration { + get { + return ResourceManager.GetString("AddingResourceProviderRegistration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating new managed location "{0}".. + /// + public static string CreatingNewManagedLocation { + get { + return ResourceManager.GetString("CreatingNewManagedLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating a new offer with name "{0}" in resource group "{1}".. + /// + public static string CreatingNewOffer { + get { + return ResourceManager.GetString("CreatingNewOffer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating a new plan with name "{0}" in resource group "{1}".. + /// + public static string CreatingNewPlan { + get { + return ResourceManager.GetString("CreatingNewPlan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating a new subscription for owner "{0}" to offer "{1}" with display name "{2}".. + /// + public static string CreatingNewSubscription { + get { + return ResourceManager.GetString("CreatingNewSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Deleting subscription "{0}".. + /// + public static string DeletingSubscription { + get { + return ResourceManager.GetString("DeletingSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected not empty collection.. + /// + public static string ExpectedNotEmptyCollection { + get { + return ResourceManager.GetString("ExpectedNotEmptyCollection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected not empty value.. + /// + public static string ExpectedNotEmptyValue { + get { + return ResourceManager.GetString("ExpectedNotEmptyValue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting gallery item with name "{0}".. + /// + public static string GettingGalleryItem { + get { + return ResourceManager.GetString("GettingGalleryItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting managed location "{0}".. + /// + public static string GettingManagedLocation { + get { + return ResourceManager.GetString("GettingManagedLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting managed offer "{0}" in resource group "{1}".. + /// + public static string GettingManagedOffer { + get { + return ResourceManager.GetString("GettingManagedOffer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting managed plan "{0}" in resource group "{1}".. + /// + public static string GettingManagedPlan { + get { + return ResourceManager.GetString("GettingManagedPlan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting managed Subscription with SubscriptionId "{0}".. + /// + public static string GettingManagedSubscriptionByID { + get { + return ResourceManager.GetString("GettingManagedSubscriptionByID", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting offer "{0}".. + /// + public static string GettingOffer { + get { + return ResourceManager.GetString("GettingOffer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting plan "{0}".. + /// + public static string GettingPlan { + get { + return ResourceManager.GetString("GettingPlan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting resource provider registration with name "{0}".. + /// + public static string GettingResourceProviderRegistration { + get { + return ResourceManager.GetString("GettingResourceProviderRegistration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Getting Subscription with SubscriptionId "{0}".. + /// + public static string GettingSubscriptionByID { + get { + return ResourceManager.GetString("GettingSubscriptionByID", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Azure profile is invalid, Make sure that you are in the Azure context with the Login-AzureRMAccount cmdlets.. + /// + public static string InvalidProfile { + get { + return ResourceManager.GetString("InvalidProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all gallery items.. + /// + public static string ListingGalleryItems { + get { + return ResourceManager.GetString("ListingGalleryItems", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all managed locations.. + /// + public static string ListingManagedLocations { + get { + return ResourceManager.GetString("ListingManagedLocations", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all managed offers in resource group "{0}".. + /// + public static string ListingManagedOffers { + get { + return ResourceManager.GetString("ListingManagedOffers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all managed plans in resource group "{0}".. + /// + public static string ListingManagedPlans { + get { + return ResourceManager.GetString("ListingManagedPlans", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all managed subscriptions.. + /// + public static string ListingManagedSubscriptions { + get { + return ResourceManager.GetString("ListingManagedSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing offers for provider "{0}".. + /// + public static string ListingOffers { + get { + return ResourceManager.GetString("ListingOffers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all plans.. + /// + public static string ListingPlans { + get { + return ResourceManager.GetString("ListingPlans", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all resource provider registrations.. + /// + public static string ListingResourceProviderRegistration { + get { + return ResourceManager.GetString("ListingResourceProviderRegistration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Listing all subscriptions.. + /// + public static string ListingSubscriptions { + get { + return ResourceManager.GetString("ListingSubscriptions", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A managed location with name "{0}" already exists.. + /// + public static string ManagedLocationAlreadyExists { + get { + return ResourceManager.GetString("ManagedLocationAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A managed offer with name "{0}" already exists in resource group "{1}".. + /// + public static string ManagedOfferAlreadyExists { + get { + return ResourceManager.GetString("ManagedOfferAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A managed offer with name "{0}" does not exist in resource group "{1}".. + /// + public static string ManagedOfferDoesNotExist { + get { + return ResourceManager.GetString("ManagedOfferDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A managed plan with name "{0}" and region "{1}" already exists.. + /// + public static string ManagedPlanAlreadyExists { + get { + return ResourceManager.GetString("ManagedPlanAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A managed plan with name "{0}" does not exist in resource group "{1}".. + /// + public static string ManagedPlanDoesNotExist { + get { + return ResourceManager.GetString("ManagedPlanDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A resource provider registration with name "{0}" and region "{1}" already exists.. + /// + public static string ProviderRegistrationAlreadyExists { + get { + return ResourceManager.GetString("ProviderRegistrationAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A resource provider registration with name "{0}" and region "{1}" does not exist.. + /// + public static string ProviderRegistrationDoesNotExist { + get { + return ResourceManager.GetString("ProviderRegistrationDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing gallery item with name "{0}".. + /// + public static string RemovingGalleryItem { + get { + return ResourceManager.GetString("RemovingGalleryItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing managed location "{0}".. + /// + public static string RemovingManagedLocation { + get { + return ResourceManager.GetString("RemovingManagedLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing managed offer "{0}" in resource group "{1}".. + /// + public static string RemovingManagedOffer { + get { + return ResourceManager.GetString("RemovingManagedOffer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing managed plan "{0}" in resource group "{1}".. + /// + public static string RemovingManagedPlan { + get { + return ResourceManager.GetString("RemovingManagedPlan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing resource provider registration with name "{0}".. + /// + public static string RemovingResourceProviderRegistration { + get { + return ResourceManager.GetString("RemovingResourceProviderRegistration", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource group cannot be empty.. + /// + public static string ResourceGroupCannotBeEmpty { + get { + return ResourceManager.GetString("ResourceGroupCannotBeEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A resource group with Name "{0}" does not exist.. + /// + public static string ResourceGroupDoesNotExist { + get { + return ResourceManager.GetString("ResourceGroupDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Both the parameters Token and AdminUri are required.. + /// + public static string TokenAndAdminUriRequired { + get { + return ResourceManager.GetString("TokenAndAdminUriRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating managed location "{0}".. + /// + public static string UpdatingManagedLocation { + get { + return ResourceManager.GetString("UpdatingManagedLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating managed subscription with id "{0}" and owner "{1}" under provider subscription '{2}'.. + /// + public static string UpdatingManagedSubscription { + get { + return ResourceManager.GetString("UpdatingManagedSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating offer with name "{0}" in resource group "{1}".. + /// + public static string UpdatingOffer { + get { + return ResourceManager.GetString("UpdatingOffer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating plan with name "{0}" in resource group "{1}".. + /// + public static string UpdatingPlan { + get { + return ResourceManager.GetString("UpdatingPlan", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updating subscription with id "{0}" and owner "{1}".. + /// + public static string UpdatingSubscription { + get { + return ResourceManager.GetString("UpdatingSubscription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument must be an absolute URI.. + /// + public static string ValidateAbsoluteUriNotAbsolute { + get { + return ResourceManager.GetString("ValidateAbsoluteUriNotAbsolute", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ValidateAbsoluteUri attribute was defined on property of type {0}. System.Uri type is expected.. + /// + public static string ValidateAbsoluteUriWrongType { + get { + return ResourceManager.GetString("ValidateAbsoluteUriWrongType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument must not be an empty GUID.. + /// + public static string ValidateGuidEmpty { + get { + return ResourceManager.GetString("ValidateGuidEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument must be a GUID.. + /// + public static string ValidateGuidWrongType { + get { + return ResourceManager.GetString("ValidateGuidWrongType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Disabling certificate validation may allow others to intercept and decrypt this web request.. + /// + public static string WarningDisableCertificateValidation { + get { + return ResourceManager.GetString("WarningDisableCertificateValidation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Azure Stack PowerShell. + /// + public static string WindowTitle { + get { + return ResourceManager.GetString("WindowTitle", resourceCulture); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.resx b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.resx new file mode 100644 index 000000000000..52d2930f4f11 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Properties/Resources.resx @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Azure Stack PowerShell + + + Getting gallery item with name "{0}". + + + Listing all gallery items. + + + Adding gallery item with name "{0}". + + + Removing gallery item with name "{0}". + + + Adding resource provider registration with name "{0}". + + + Getting resource provider registration with name "{0}". + + + Listing all resource provider registrations. + + + Removing resource provider registration with name "{0}". + + + A resource provider registration with name "{0}" and region "{1}" already exists. + + + A resource provider registration with name "{0}" and region "{1}" does not exist. + + + A resource group with Name "{0}" does not exist. + + + Getting Subscription with SubscriptionId "{0}". + + + Listing all subscriptions. + + + Resource group cannot be empty. + + + Getting managed offer "{0}" in resource group "{1}". + + + Listing all managed offers in resource group "{0}". + + + Listing all managed subscriptions. + + + Removing managed offer "{0}" in resource group "{1}". + + + Getting offer "{0}". + + + Listing offers for provider "{0}". + + + Getting managed plan "{0}" in resource group "{1}". + + + Getting plan "{0}". + + + Listing all managed plans in resource group "{0}". + + + Listing all plans. + + + A managed offer with name "{0}" already exists in resource group "{1}". + + + A managed offer with name "{0}" does not exist in resource group "{1}". + + + A managed plan with name "{0}" and region "{1}" already exists. + + + A managed plan with name "{0}" does not exist in resource group "{1}". + + + Removing managed plan "{0}" in resource group "{1}". + + + Creating a new offer with name "{0}" in resource group "{1}". + + + Creating a new plan with name "{0}" in resource group "{1}". + + + Creating a new subscription for owner "{0}" to offer "{1}" with display name "{2}". + + + Deleting subscription "{0}". + + + Getting managed Subscription with SubscriptionId "{0}". + + + Updating offer with name "{0}" in resource group "{1}". + + + Updating plan with name "{0}" in resource group "{1}". + + + Updating managed subscription with id "{0}" and owner "{1}" under provider subscription '{2}'. + + + Updating subscription with id "{0}" and owner "{1}". + + + Disabling certificate validation may allow others to intercept and decrypt this web request. + + + A managed location with name "{0}" already exists. + + + Creating new managed location "{0}". + + + Getting managed location "{0}". + + + Listing all managed locations. + + + Removing managed location "{0}". + + + Updating managed location "{0}". + + + The Azure profile is invalid, Make sure that you are in the Azure context with the Login-AzureRMAccount cmdlets. + + + Both the parameters Token and AdminUri are required. + + + Expected not empty collection. + + + Expected not empty value. + + + Argument must be an absolute URI. + + + ValidateAbsoluteUri attribute was defined on property of type {0}. System.Uri type is expected. + + + Argument must not be an empty GUID. + ValidationMetadataException + + + Argument must be a GUID. + ValidationMetadataException + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/StringExtensions.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/StringExtensions.cs new file mode 100644 index 000000000000..2ad977dea878 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/StringExtensions.cs @@ -0,0 +1,79 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Globalization; + + /// + /// String Extension Methods + /// + public static class StringExtensions + { + /// + /// Formats a string with given args and current culture. + /// + /// The format. + /// The args. + /// Formatted string + public static string FormatArgs(this string format, params object[] args) + { + return string.Format(CultureInfo.CurrentCulture, format, args); + } + + /// + /// Formats a string with given args and invariant culture. + /// + /// The format. + /// The args. + /// Formatted string + public static string FormatArgsInvariant(this string format, params object[] args) + { + return string.Format(CultureInfo.InvariantCulture, format, args); + } + + /// + /// Compares two string values insensitively. + /// + /// The original string. + /// The other string. + public static bool EqualsInsensitively(this string original, string otherString) + { + return string.Equals(original, otherString, StringComparison.InvariantCultureIgnoreCase); + } + + /// + /// Compares start of string insensitively. + /// + /// The original string. + /// The prefix to compare. + public static bool StartsWithInsensitively(this string original, string prefix) + { + return original.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase); + } + + /// + /// Compares end of string insensitively. + /// + /// The original string. + /// The suffix to compare. + public static bool EndsWithInsensitively(this string original, string suffix) + { + return original.EndsWith(suffix, StringComparison.InvariantCultureIgnoreCase); + } + + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/AuthenticationContextExtensions.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/AuthenticationContextExtensions.cs new file mode 100644 index 000000000000..88f963503957 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/AuthenticationContextExtensions.cs @@ -0,0 +1,195 @@ +//----------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------------- + +namespace Microsoft.AzureStack.Commands.Security +{ + using System; + using System.Collections.Generic; + using System.Collections.Specialized; + using System.Globalization; + using System.Reflection; + using System.Text; + using System.Threading.Tasks; + using Microsoft.IdentityModel.Clients.ActiveDirectory; + + /// + /// Authentication context extension methods. + /// + public static class AuthenticationContextExtensions + { + /// + /// The endpoint template URI + /// + private static readonly UriTemplate EndpointTemplateUri = new UriTemplate("/oauth2/{endpoint}"); + + /// + /// The token endpoint bindings + /// + private static readonly NameValueCollection TokenEndpointBindings = new NameValueCollection() + { + { "endpoint", "token" } + }; + + /// + /// Acquires token via non-interactive flow. + /// + /// The authority. + /// The resource. + /// The client identifier. + /// The user credential. + /// + /// We use reflection to call ADAL.NET internals to handle token acquisition, since the library does not support ADFS yet. + /// + public static AuthenticationResult AcquireTokenForAdfs(string authority, string resource, string clientId, UserCredential userCredential) + { + // BUG: 2384273 - [PowerShell]: Remove AuthenticationContextExtensions class and integrate support of non-interactive flow via legitimate APIs of ADAL.NET + var context = new AuthenticationContext(authority: authority, validateAuthority: false, tokenCache: TokenCache.DefaultShared); + var parameters = GetNewInstanceOfRequestParameters(resource, clientId, userCredential); + var handler = GetNewInstanceOfNonInteractiveHandler(context, resource, clientId, userCredential); + return handler.SendHttpMessage(parameters: parameters); + } + + /// + /// Sends the HTTP message. + /// + /// The handler. + /// The parameters. + private static AuthenticationResult SendHttpMessage(this object handler, object parameters) + { + var handlerType = handler.GetType(); + var methodInfo = handlerType.BaseType.GetMethod("SendHttpMessageAsync", BindingFlags.NonPublic | BindingFlags.Instance); + var taskResult = (Task)methodInfo.Invoke(obj: handler, parameters: new object[] { parameters }); + var result = taskResult.Result; + return result; + } + + /// + /// Authenticators the specified context. + /// + /// The context. + private static object Authenticator(this AuthenticationContext context) + { + return context.GetInstanceFieldValue("Authenticator", BindingFlags.NonPublic); + } + + /// + /// Sets the token URI. + /// + /// The authenticator. + /// The URI string. + private static void TokenUri(this object authenticator, string uriString) + { + authenticator.SetInstancePropertyValue("TokenUri", uriString, BindingFlags.Public); + } + + /// + /// Adds the secure parameter. + /// + /// The instance. + /// The key. + /// The secure string. + private static void AddSecureParameter(this Dictionary instance, string key, object secureString) + { + var typeOfInstance = instance.GetType(); + var methodInfo = typeOfInstance.GetMethod("AddSecureParameter", BindingFlags.Instance | BindingFlags.Public); + var parameters = new object[] { key, secureString }; + methodInfo.Invoke(obj: instance, parameters: parameters); + } + + /// + /// Secures the password. + /// + /// The credential. + private static object SecurePassword(this UserCredential credential) + { + return credential.GetInstancePropertyValue("SecurePassword", BindingFlags.NonPublic); + } + + /// + /// Gets the new instance of request parameters. + /// + /// The resource. + /// The client identifier. + /// The user credential. + private static object GetNewInstanceOfRequestParameters(string resource, string clientId, UserCredential userCredential) + { + var builder = new StringBuilder(); + var typeOfParameters = Type.GetType("Microsoft.IdentityModel.Clients.ActiveDirectory.RequestParameters, Microsoft.IdentityModel.Clients.ActiveDirectory"); + var arguments = new object[] { builder }; + var instanceOfParameters = (Dictionary)Activator.CreateInstance(type: typeOfParameters, args: arguments); + + // Prepare request parameters to be sent over the wire + instanceOfParameters.Add("grant_type", "password"); + instanceOfParameters.Add("resource", resource); + instanceOfParameters.Add("username", userCredential.UserName); + instanceOfParameters.AddSecureParameter("password", userCredential.SecurePassword()); + instanceOfParameters.Add("client_id", clientId); + + return instanceOfParameters; + } + + /// + /// Gets the new instance of non interactive handler. + /// + /// The context. + /// The resource. + /// The client identifier. + /// The user credential. + private static object GetNewInstanceOfNonInteractiveHandler(AuthenticationContext context, string resource, string clientId, UserCredential userCredential) + { + var uriString = EndpointTemplateUri.BindByName(new Uri(context.Authority), TokenEndpointBindings).OriginalString; + var cache = context.TokenCache; + var callAsync = false; + + // Retrieve and configure authenticator + var authenticator = context.Authenticator(); + authenticator.TokenUri(uriString); + + var typeOfObject = Type.GetType("Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenNonInteractiveHandler, Microsoft.IdentityModel.Clients.ActiveDirectory"); + var ctorArguments = new object[] { authenticator, cache, resource, clientId, userCredential, callAsync }; + var instanceOfHandler = Activator.CreateInstance(type: typeOfObject, args: ctorArguments); + return instanceOfHandler; + } + + /// + /// Gets the instance field value. + /// + /// The instance. + /// The name. + /// The visibility. + private static object GetInstanceFieldValue(this object instance, string name, BindingFlags visibility) + { + var typeOfInstance = instance.GetType(); + var fieldInfo = typeOfInstance.GetField(name, BindingFlags.Instance | visibility); + return fieldInfo.GetValue(instance); + } + + /// + /// Gets the instance property value. + /// + /// The instance. + /// The name. + /// The visibility. + private static object GetInstancePropertyValue(this object instance, string name, BindingFlags visibility) + { + var typeOfInstance = instance.GetType(); + var propertyInfo = typeOfInstance.GetProperty(name, BindingFlags.Instance | visibility); + return propertyInfo.GetValue(instance); + } + + /// + /// Sets the instance property value. + /// + /// The instance. + /// The name. + /// The value. + /// The visibility. + private static void SetInstancePropertyValue(this object instance, string name, object value, BindingFlags visibility) + { + var typeOfInstance = instance.GetType(); + var propertyInfo = typeOfInstance.GetProperty(name, BindingFlags.Instance | visibility); + propertyInfo.SetValue(instance, value); + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/GetToken.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/GetToken.cs new file mode 100644 index 000000000000..1fcccad3cf7c --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/GetToken.cs @@ -0,0 +1,210 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands.Security +{ + using System; + using System.Collections.Specialized; + using System.Management.Automation; + using System.Net; + using Microsoft.Azure.Commands.ResourceManager.Common; + using Microsoft.IdentityModel.Clients.ActiveDirectory; + + /// + /// Get Token Cmdlet + /// + [Cmdlet(VerbsCommon.Get, Nouns.Token, ConfirmImpact = ConfirmImpact.Low, DefaultParameterSetName = "ADFS")] + public class GetToken : Cmdlet + { + //// TODO: Some of these properties are configurable in customer environments; resolve design + + /// + /// The cmdlet behavior. + /// + private const PromptBehavior CmdletBehavior = PromptBehavior.Always; + + /// + /// Indicates whether to validate the authority. + /// + private const bool ValidateAuthority = false; + + /// + /// The authority template URI. + /// + private static readonly UriTemplate AuthorityTemplateUri = new UriTemplate("/{authority_type}/"); + + /// + /// The authority bindings. + /// + private static readonly NameValueCollection AuthorityBindings = new NameValueCollection() + { + { "authority_type", "adfs" } + }; + + /// + /// The redirect URI. + /// + private static readonly Uri NoOpRedirectUri = new Uri(SharedConstants.AzureStackPowerShell.RedirectUri); + + /// + /// Gets or sets URI of the issuing authority. + /// + [Parameter(Mandatory = true, Position = 0)] + [ValidateNotNull] + public string Authority { get; set; } + + /// + /// Gets or sets the resource. + /// + [Parameter] + [ValidateNotNull] + public string Resource { get; set; } + + /// + /// Gets or sets the tenant identifier. + /// + [Parameter(ParameterSetName = "AAD", Mandatory = true)] + [ValidateNotNull] + public string AadTenantId { get; set; } + + /// + /// Gets or sets the client identifier. + /// + [Parameter] + [ValidateNotNull] + public string ClientId { get; set; } + + /// + /// Gets or sets credentials used to request access token. + /// + [Parameter] + [ValidateNotNull] + public PSCredential Credential { get; set; } + + /// + /// Gets or sets a value indicating whether to disable certificate validation. + /// + [Parameter] + public SwitchParameter DisableCertificateValidation { get; set; } + + /// + /// Executes the cmdlet. + /// + protected override void ProcessRecord() + { + var originalValidateCallback = ServicePointManager.ServerCertificateValidationCallback; + AuthenticationResult result; + + try + { + // TODO (bryanr) - Evaluate if this should be removed entirely + if (this.DisableCertificateValidation) + { + this.WriteWarning(Resources.WarningDisableCertificateValidation); + ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true; + } + + this.Resource = this.Resource ?? SharedConstants.ResourceManager.ClientId; + this.ClientId = this.ClientId ?? SharedConstants.AzureStackPowerShell.ClientId; + + if (this.IsInteractiveTokenRequest()) + { + result = this.GetSecurityTokenWithInteractiveFlow(); + } + else + { + result = this.GetSecurityTokenWithNonInteractiveFlow(); + } + } + finally + { + if (this.DisableCertificateValidation) + { + ServicePointManager.ServerCertificateValidationCallback = originalValidateCallback; + } + } + + // Write the object to the pipeline only after the certificate validation callback has been restored. + // This will prevent other cmdlets in the pipeline from inheriting this security vulnerability. + this.WriteObject(result.AccessToken); + } + + /// + /// Gets the security token with non interactive flow. + /// + private AuthenticationResult GetSecurityTokenWithNonInteractiveFlow() + { + var uriString = this.BuildAuthorityUriString(); + var userCredential = new UserCredential(this.Credential.UserName, this.Credential.Password); + var result = default(AuthenticationResult); + + if (this.IsRequestForAadToken()) + { + var context = new AuthenticationContext(authority: uriString, validateAuthority: ValidateAuthority); + result = context.AcquireToken(resource: this.Resource, clientId: this.ClientId, userCredential: userCredential); + } + else + { + // NOTE: This is a case of using non-public APIs of ADAL.NET via reflection to acquire token (not officially supported by ADAL.NET team). + result = AuthenticationContextExtensions.AcquireTokenForAdfs(authority: uriString, resource: this.Resource, clientId: this.ClientId, userCredential: userCredential); + } + return result; + } + + /// + /// Determines whether this is an interactive token request. + /// + private bool IsInteractiveTokenRequest() + { + return this.Credential == null; + } + + /// + /// Gets the security token with interactive flow. + /// + private AuthenticationResult GetSecurityTokenWithInteractiveFlow() + { + var uriString = this.BuildAuthorityUriString(); + var context = new AuthenticationContext(authority: uriString, validateAuthority: ValidateAuthority); + var result = context.AcquireToken(resource: this.Resource, clientId: this.ClientId, redirectUri: NoOpRedirectUri, promptBehavior: CmdletBehavior); + return result; + } + + /// + /// Builds the authority URI string. + /// + private string BuildAuthorityUriString() + { + var baseAddressUri = new Uri(this.Authority); + + if (this.IsRequestForAadToken()) + { + return new UriTemplate("/{tenant_id}/").BindByPosition(baseAddressUri, this.AadTenantId).OriginalString; + } + else + { + return AuthorityTemplateUri.BindByName(baseAddressUri, AuthorityBindings).OriginalString; + } + } + + /// + /// Determines whether we are retrieving a token for AAD. + /// + private bool IsRequestForAadToken() + { + return !string.IsNullOrEmpty(this.AadTenantId); + } + + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/Shared.Authorization.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/Shared.Authorization.cs new file mode 100644 index 000000000000..4fa7c1d702a2 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/Shared.Authorization.cs @@ -0,0 +1,67 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands.Security +{ + /// + /// constant strings and values + /// + public static class SharedConstants + { + /// + /// Application settings for Azure Stack PowerShell authorization configuration. + /// + public static class AzureStackPowerShell + { + /// + /// The Azure Stack PowerShell client identifier. + /// + /// We use a hardcoded string with a guid value to be consistent with Azure Active Directory + /// and their client application registration procedure (each client app is assigned a string with unique identifier). + public const string ClientId = "445ace50-bb67-4e02-9371-3d69ced8c25a"; + + /// + /// The redirect uri which is a well-known string for native applications. + /// + public const string RedirectUri = "urn:ietf:wg:oauth:2.0:oob"; + } + + /// + /// Application settings for Azure PowerShell authorization configuration. + /// + public static class AzurePowerShell + { + /// + /// The Azure PowerShell client identifier. + /// + public const string ClientId = "1950a258-227b-4e31-a9cf-717495945fc2"; + + /// + /// The redirect uri which is a well-known string for native applications. + /// + public const string RedirectUri = AzureStackPowerShell.RedirectUri; + } + + /// + /// Application settings for Frontdoor authorization configuration. + /// + public static class ResourceManager + { + /// + /// The Azure Stack Frontdoor client identifier. + /// + public const string ClientId = "3795ab9c-1aa9-4258-97b5-79b402cafa8c"; + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/readme.txt b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/readme.txt new file mode 100644 index 000000000000..e71e7fb6117c --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/Token/readme.txt @@ -0,0 +1,24 @@ + +*** BRIEF GUIDE *** +Here are sample snippets of supported arguments/modes by the cmdlet: + +# PSCredential mode [upn-style] (aka. Resource Owner Password Credentials Grant flow) +$secpasswd = ConvertTo-SecureString "password_goes_here" -AsPlainText -Force +$mycreds = New-Object System.Management.Automation.PSCredential ("username@domain.com", $secpasswd) +Get-AzureRMToken -Authority https://ip_or_hostname_of_winauthsite:12998/ -Credential $mycreds + + +# PSCredential mode [domain\username-style] (aka. Resource Owner Password Credentials Grant flow) +$secpasswd = ConvertTo-SecureString "password_goes_here" -AsPlainText -Force +$mycreds = New-Object System.Management.Automation.PSCredential ("domain\username", $secpasswd) +Get-AzureRMToken -Authority https://ip_or_hostname_of_winauthsite:12998/ -Credential $mycreds + + +# PSCredential mode [username-style, ONLY available when WinAuthSite runs in LocalMachine mode] (aka. Resource Owner Password Credentials Grant flow) +$secpasswd = ConvertTo-SecureString "password_goes_here" -AsPlainText -Force +$mycreds = New-Object System.Management.Automation.PSCredential ("local_machine_username", $secpasswd) +Get-AzureRMToken -Authority https://ip_or_hostname_of_winauthsite:12998/ -Credential $mycreds + + +# Interactive mode [with UX prompt to collect credentials] (aka. Authorization Code Grant flow) +Get-AzureRMToken -Authority https://ip_or_hostname_of_winauthsite:12998/ \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ValidateAbsoluteUriAttribute.cs b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ValidateAbsoluteUriAttribute.cs new file mode 100644 index 000000000000..d9ac3d57bd65 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/ValidateAbsoluteUriAttribute.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands +{ + using System; + using System.Management.Automation; + using Microsoft.WindowsAzure.Commands.Common.Properties; + + /// + /// Validation for URI parameters in cmdlets + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class ValidateAbsoluteUriAttribute : ValidateArgumentsAttribute + { + /// + /// Do the validation + /// + /// The args + /// The intrinsics + protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics) + { + if (arguments == null) + { + return; + } + + var uri = arguments as Uri; + + if (uri == null) + { + throw new ValidationMetadataException(Resources.ValidateAbsoluteUriWrongType.FormatArgs(arguments.GetType().Name)); + } + + if (!uri.IsAbsoluteUri) + { + throw new ValidationMetadataException(Resources.ValidateAbsoluteUriNotAbsolute); + } + } + } +} diff --git a/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config new file mode 100644 index 000000000000..00c10cb245c9 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/Commands.AzureStackAdmin/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackAdmin/NuGet.Config b/src/ResourceManager/AzureStackAdmin/NuGet.Config new file mode 100644 index 000000000000..2de911013532 --- /dev/null +++ b/src/ResourceManager/AzureStackAdmin/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ResourceManager/AzureStackStorage/.nuget/packages.config b/src/ResourceManager/AzureStackStorage/.nuget/packages.config new file mode 100644 index 000000000000..091917678945 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/.nuget/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/AzureRM.AzureStackStorage.psd1 b/src/ResourceManager/AzureStackStorage/AzureRM.AzureStackStorage.psd1 new file mode 100644 index 000000000000..01c0259eb067 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/AzureRM.AzureStackStorage.psd1 @@ -0,0 +1,88 @@ +# +# Module manifest for module 'Microsoft.Azure.Commands.Insights' +# +# Generated by: Microsoft Corporation +# +# Generated on: 9/19/2015 +# + +@{ + +# Version number of this module. +ModuleVersion = '0.9.2' + +# ID used to uniquely identify this module +GUID = 'DA5816B5-97A6-4301-9AA0-72CC68C79F20' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = 'Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Microsoft Azure PowerShell - Storage management cmdlets for Azure Stack' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '3.0' + +# Name of the Windows PowerShell host required by this module +PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +PowerShellHostVersion = '' + +# Minimum version of the .NET Framework required by this module +DotNetFrameworkVersion = '4.0' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion='4.0' + +# Processor architecture (None, X86, Amd64, IA64) required by this module +ProcessorArchitecture = 'None' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.3'}) + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module +ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in ModuleToProcess +NestedModules = @( + '.\Microsoft.AzureStack.Commands.StorageAdmin.dll' +) + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = @() + +# List of all modules packaged with this module +ModuleList = @() + +# List of all files packaged with this module +FileList = @() + +# Private data to pass to the module specified in ModuleToProcess +PrivateData = '' + +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln b/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln new file mode 100644 index 000000000000..531d737e6baa --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/AzureStackStorage.sln @@ -0,0 +1,86 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{95C16AED-FD57-42A0-86C3-2CF4300A4817}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManager.Common", "..\Common\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj", "{3819D8A7-C62C-4C47-8DDD-0332D9CE1252}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureStackStorage", "Commands.AzureStackStorage\Commands.AzureStackStorage.csproj", "{D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureStackStorage.Test", "Commands.AzureStackStorage.Tests\Commands.AzureStackStorage.Test.csproj", "{D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Storage", "..\..\Common\Commands.Common.Storage\Commands.Common.Storage.csproj", "{65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources", "..\Resources\Commands.Resources\Commands.Resources.csproj", "{E1F5201D-6067-430E-B303-4E367652991B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7865F5ED-E0F3-45CD-87BA-214FE8A27061}" + ProjectSection(SolutionItems) = preProject + .nuget\packages.config = .nuget\packages.config + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3819D8A7-C62C-4C47-8DDD-0332D9CE1252}.Release|Any CPU.Build.0 = Release|Any CPU + {D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791}.Release|Any CPU.Build.0 = Release|Any CPU + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B}.Release|Any CPU.Build.0 = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.Build.0 = Release|Any CPU + {E1F5201D-6067-430E-B303-4E367652991B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1F5201D-6067-430E-B303-4E367652991B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1F5201D-6067-430E-B303-4E367652991B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1F5201D-6067-430E-B303-4E367652991B}.Release|Any CPU.Build.0 = Release|Any CPU + {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8058D403-06E3-4BED-8924-D166CE303961}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8058D403-06E3-4BED-8924-D166CE303961}.Release|Any CPU.Build.0 = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} + {3436A126-EDC9-4060-8952-9A1BE34CDD95} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} + EndGlobalSection +EndGlobal diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj new file mode 100644 index 000000000000..52aef5d3932f --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Commands.AzureStackStorage.Test.csproj @@ -0,0 +1,306 @@ + + + + + + Debug + AnyCPU + {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B} + Library + Properties + Microsoft.AzureStack.Commands.StorageAdmin.Test + Microsoft.AzureStack.Commands.StorageAdmin.Test + v4.5 + 512 + + ..\..\..\ + true + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + d7bcc31d + + + true + MSSharedLibKey.snk + true + true + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AnyCPU + + + bin\Release\ + TRACE;SIGN + true + pdbonly + AnyCPU + prompt + false + + + + ..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + + False + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.14-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + False + ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5799.28345-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll + + + False + ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5799.28345-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll + + + False + ..\..\..\packages\Microsoft.AzureStack.Management.Storage.0.9.2-preview\lib\net45\Microsoft.AzureStack.Management.Storage.dll + + + False + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll + + + False + ..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll + + + False + ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + + + ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll + + + False + ..\..\..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + False + ..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll + + + False + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + + + + False + C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll + + + + + False + ..\..\..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll + + + ..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll + True + + + ..\..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll + True + + + + + + + + + + + + + + + + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} + Commands.ResourceManager.Common + + + {3436a126-edc9-4060-8952-9a1be34cdd95} + Commands.ScenarioTests.ResourceManager.Common + + + {d4ca0cc1-cd0a-4ce2-a40d-2d8a082d8791} + Commands.AzureStackStorage + + + + + + Designer + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/MSSharedLibKey.snk b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/MSSharedLibKey.snk new file mode 100644 index 000000000000..695f1b38774e Binary files /dev/null and b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/MSSharedLibKey.snk differ diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Properties/AssemblyInfo.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..409808df0caf --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.Azure.Commands.Resources.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Microsoft.Azure.Commands.Resources.Test")] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("5802D147-3EE9-4352-A0B1-1C16B6DBCA7C")] + +[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)] +[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)] diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.cs new file mode 100644 index 000000000000..268980a885af --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class BlobServicesTests:RMTestBase + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetBlobService() + { + TestsController.NewInstance.RunPsTest("Test-GetBlobService"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestSetBlobService() + { + TestsController.NewInstance.RunPsTest("Test-SetBlobService"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.ps1 new file mode 100644 index 000000000000..fca4f8f60264 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/BlobServicesTests.ps1 @@ -0,0 +1,88 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single farm for a resource group with admin subscription id. +#> +function Test-GetBlobService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $orgin = Get-ACSBlobService -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + Assert-AreEqual $orgin.HealthStatus "Unknown" + Assert-AreEqual $orgin.FarmName "82ba752f-0fac-47e2-8477-5731f9f5db34" + Assert-AreEqual $orgin.Id "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/tableservices/default" + Assert-AreEqual $orgin.Location "redmond" + Assert-AreEqual $orgin.Name "82ba752f-0fac-47e2-8477-5731f9f5db34/default" + Assert-AreEqual $orgin.Type "Microsoft.Storage.Admin/farms/tableservices" + Assert-AreEqual $orgin.version "1.0" + + Assert-AreEqual $orgin.Settings.frontEndHttpListenPort "11002" + Assert-AreEqual $orgin.Settings.frontEndHttpsListenPort "11102" + Assert-AreEqual $orgin.Settings.frontEndCallbackThreadsCount "1800" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingEnabled "true" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold "100" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle "10" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds "20" + Assert-AreEqual $orgin.Settings.frontEndMemoryThrottlingEnabled "true" + Assert-AreEqual $orgin.Settings.frontEndMaxMillisecondsBetweenMemorySamples "10000" + Assert-AreEqual $orgin.Settings.frontEndMemoryThrottleThresholdSettings "5,100,0;7,50,0;10,25,0;15,0,25;" + #Assert-AreEqual $orgin.Settings.frontEndMinThreadPoolThreads "1600" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveIOCompletionThreshold "1500" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveWorkerThreadThreshold "1500" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds "30" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAlivePercentage "10" + Assert-AreEqual $orgin.Settings.frontEndUseSlaTimeInAvailability "true" + + $actual = $orgin | Set-ACSBlobService -FrontEndCpuBasedKeepAliveThrottlingEnabled $false + Assert-AreEqual $actual.Settings.frontEndCpuBasedKeepAliveThrottlingEnabled $false + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing farms in a resource group with admin subscription id. +#> +function Test-SetBlobService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Set-ACSBlobService -FarmName $farmName ` + -SubscriptionId $subscriptionId -ResourceGroupName $rgname -SkipCertificateValidation ` + -FrontEndCpuBasedKeepAliveThrottlingEnabled $true ` + -FrontEndMemoryThrottlingEnabled $true + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/Common.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/Common.ps1 new file mode 100644 index 000000000000..a49ecd290e12 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/Common.ps1 @@ -0,0 +1,65 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Gets valid resource group name +#> +function Get-ResourceGroupName +{ + return getAssetName +} + +<# +.SYNOPSIS +Gets valid resource name +#> +function Get-ResourceName +{ + return getAssetName +} + +<# +.SYNOPSIS +Gets the default location for a provider +#> +function Get-ProviderLocation($provider) +{ + $location = Get-AzureLocation | where {$_.Name -eq $provider} + if ($location -eq $null) { + "West US" + } else { + $location.Locations[0] + } +} + +<# +.SYNOPSIS +Gets valid application display name +#> +function Get-ApplicatonDisplayName +{ + return getAssetName +} + +<# +.SYNOPSIS +Cleans the created resource groups +#> +function Clean-ResourceGroup($rgname) +{ + if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) { + Remove-AzureResourceGroup -Name $rgname -Force + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/EventsTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/EventsTests.ps1 new file mode 100644 index 000000000000..987644a345fa --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/EventsTests.ps1 @@ -0,0 +1,143 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting the logs associated to a correlation Id. +#> +function Test-GetAzureCorrelationIdLog +{ + # Setup + $correlation = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d/incidents/L3N1YnNjcmlwdGlvbnMvYTkzZmIwN2MtNmM5My00MGJlLWJmM2ItNGYwZGViYTEwZjRiL3Jlc291cmNlR3JvdXBzL0RlZmF1bHQtV2ViLUVhc3RVUy9wcm92aWRlcnMvbWljcm9zb2Z0Lmluc2lnaHRzL2FsZXJ0cnVsZXMvY2hlY2tydWxlMy00YjEzNTQwMS1hMzBjLTQyMjQtYWUyMS1mYTUzYTViZDI1M2QwNjM1NjA5MjE5ODU0NzQ1NDI0' + + try + { + # Test + $actual = Get-AzureCorrelationIdLog -CorrelationId $correlation -starttime 2015-03-02T10:00:00 -endtime 2015-03-02T12:00:00 -detailedOutput + + # Assert TODO add more asserts + Assert-AreEqual $actual.Count 2 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests getting the logs associated to a resource group. +#> +function Test-GetAzureResourceGroupLog +{ + # Setup + $rgname = 'Default-Web-EastUS' + + try + { + $actual = Get-AzureResourceGroupLog -ResourceGroup $rgname -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 + + # Assert TODO add more asserts + Assert-AreEqual $actual.Count 2 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests getting the logs associated to a resource Id. +#> +function Test-GetAzureResourceLog +{ + # Setup + $rname = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.insights/alertrules/checkrule3-4b135401-a30c-4224-ae21-fa53a5bd253d' + + try + { + $actual = Get-AzureResourceLog -ResourceId $rname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + + # Assert TODO add more asserts + # Assert-Throws { Set-AzureResourceGroup -Name $rgname -Tags @{"testtag" = "testval"} } "Invalid tag format. Expect @{Name = `"tagName`"} or @{Name = `"tagName`"; Value = `"tagValue`"}" + Assert-AreEqual $actual.Count 2 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests getting the logs associated to a resource provider. +#> +function Test-GetAzureResourceProviderLog +{ + # Setup + $rpname = 'microsoft.insights' + + try + { + $actual = Get-AzureResourceProviderLog -ResourceProvider $rpname -startTime 2015-03-03T15:42:50Z -endTime 2015-03-03T16:42:50Z + + # Assert + Assert-AreEqual $actual.Count 2 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests getting the logs for a subscription Id. +#> +function Test-GetAzureSubscriptionIdLog +{ + # No Setup needed + + try + { + # Test + $actual = Get-AzureSubscriptionIdLog -starttime 2015-01-15T04:30:00 -endtime 2015-01-15T12:30:00 + + # Assert + Assert-AreEqual $actual.Count 1 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.cs new file mode 100644 index 000000000000..e4c991a23e67 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.cs @@ -0,0 +1,57 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class FarmsTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetFarm() + { + TestsController.NewInstance.RunPsTest("Test-GetFarm"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestListFarms() + { + TestsController.NewInstance.RunPsTest("Test-ListFarms"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestSetFarm() + { + TestsController.NewInstance.RunPsTest("Test-SetFarm"); + } + + //[Fact] + //[Trait(Category.AcceptanceType, Category.CheckIn)] + //public void TestGetFarms() + //{ + // TestsController.NewInstance.RunPsTest("Test-GetFarms"); + //} + + //[Fact] + //[Trait(Category.AcceptanceType, Category.CheckIn)] + //public void TestGetAlertHistory() + //{ + // TestsController.NewInstance.RunPsTest("Test-GetAlertHistory"); + //} + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.ps1 new file mode 100644 index 000000000000..3d5133e7b95d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FarmsTests.ps1 @@ -0,0 +1,105 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + + +<# +.SYNOPSIS +Tests getting a single farm for a resource group with admin subscription id. +#> +function Test-GetFarm +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $orgin = Get-ACSFarm -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + Assert-AreEqual $orgin.HealthStatus "Warning" + Assert-AreEqual $orgin.SettingsStore "anypath" + Assert-AreEqual $orgin.FarmName "farm_01" + Assert-AreEqual $orgin.Id "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/farm_01" + Assert-AreEqual $orgin.Location "west us" + Assert-AreEqual $orgin.Name "farm_01" + Assert-AreEqual $orgin.Type "Microsoft.Storage.Admin/farms" + + Assert-AreEqual $orgin.Settings.HostStyleHttpPort "80" + Assert-AreEqual $orgin.Settings.HostStyleHttpsPort "443" + Assert-AreEqual $orgin.Settings.SettingsPollingIntervalInSecond "60" + Assert-AreEqual $orgin.Settings.CorsAllowedOriginsList "http://manage.wossportal.com;http://www.example.com" + Assert-AreEqual $orgin.Settings.DataCenterUriHostSuffixes "contoso.com" + + $corsAllowedOriginsList = 'http://manage.wossportal.com;http://www.example.com' + $settingsPullingInterval = 90 + + $actual = $orgin | Set-ACSFarm -SettingsPollingIntervalInSecond $settingsPullingInterval -CorsAllowedOriginsList $corsAllowedOriginsList + Assert-AreEqual $actual.Settings.SettingsPollingIntervalInSecond $settingsPullingInterval + Assert-AreEqual $actual.Settings.CorsAllowedOriginsList $corsAllowedOriginsList + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing farms in a resource group with admin subscription id. +#> +function Test-ListFarms +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + + try + { + $actual = Get-ACSFarm -ResourceGroupName $rgname -SubscriptionId $subscriptionId + + # Assert TODO add more asserts + Assert-AreEqual $actual.Count 1 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests set farm settings in a resource group with admin subscription id. +#> +function Test-SetFarm +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $corsAllowedOriginsList = 'http://manage.wossportal.com;http://www.example.com' + $settingsPullingInterval = 90 + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Set-ACSFarm -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -SettingsPollingIntervalInSecond $settingsPullingInterval -CorsAllowedOriginsList $corsAllowedOriginsList + Assert-AreEqual $actual.HealthStatus "Unknown" + } + finally + { + # Cleanup + # No cleanup needed for now + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.cs new file mode 100644 index 000000000000..91d4c7f58a73 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class FaultsTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetFault() + { + TestsController.NewInstance.RunPsTest("Test-GetFault"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetHistoricFaults() + { + TestsController.NewInstance.RunPsTest("Test-GetHistoricFaults"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetCurrentFaults() + { + TestsController.NewInstance.RunPsTest("Test-GetCurrentFaults"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestResolveFault() + { + TestsController.NewInstance.RunPsTest("Test-ResolveFault"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.ps1 new file mode 100644 index 000000000000..8470bbacb8e5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/FaultsTests.ps1 @@ -0,0 +1,158 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single fault for a resource group with admin subscription id. +#> +function Test-GetFault +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $faultId = 'D64F6195-93FE-40AF-B0A7-D8EA10506028' + + try + { + $actual = Get-ACSFault -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -FaultId $faultId + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual.ActivatedTime.ToString("yyyy-MM-dd HH:mm:ss") "2015-05-18 18:02:00" + Assert-AreEqual $actual.AssociatedDataType 'Metrics' + Assert-AreEqual $actual.AssociatedEventQuery $null + Assert-AreEqual $actual.AssociatedMetricsName 'MetricsName' + Assert-AreEqual $actual.Description 'TBD' + Assert-AreEqual $actual.FaultId 'D64F6195-93FE-40AF-B0A7-D8EA10506028' + Assert-AreEqual $actual.FaultRuleName 'faultRule1' + Assert-AreEqual $actual.ResolutionText 'TBD' + Assert-AreEqual $actual.ResolvedTime $null + Assert-AreEqual $actual.ResourceUri '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1' + Assert-AreEqual $actual.Severity 'Critical' + Assert-AreEqual $actual.ResourceGroupName $rgname + Assert-AreEqual $actual.FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Dismiss a fault for a resource group with admin subscription id. +#> +function Test-ResolveFault +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $faultId = 'D64F6195-93FE-40AF-B0A7-D8EA10506028' + + try + { + $actual = Resolve-ACSFault -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -FaultId $faultId -Force + + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + + +<# +.SYNOPSIS +Tests get historic faults within a time period in a resource group with admin subscription id. +#> +function Test-GetHistoricFaults +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $startTime = [DateTime]'1/1/2015' + $endTime = [DateTime]'1/2/2015' + + $actual = Get-ACSFault ` + -FarmName $farmName -SubscriptionId $subscriptionId -ResourceGroupName $rgname -SkipCertificateValidation ` + -StartTime $startTime -EndTime $endTime + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual.ActivatedTime.ToString("yyyy-MM-dd HH:mm:ss") "2015-05-18 18:02:00" + Assert-AreEqual $actual.AssociatedDataType 'Metrics' + Assert-AreEqual $actual.AssociatedEventQuery $null + Assert-AreEqual $actual.AssociatedMetricsName 'MetricsName' + Assert-AreEqual $actual.Description 'TBD' + Assert-AreEqual $actual.FaultId 'D64F6195-93FE-40AF-B0A7-D8EA10506028' + Assert-AreEqual $actual.FaultRuleName 'faultRule1' + Assert-AreEqual $actual.ResolutionText 'TBD' + Assert-AreEqual $actual.ResolvedTime $null + Assert-AreEqual $actual.ResourceUri '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1' + Assert-AreEqual $actual.Severity 'Critical' + Assert-AreEqual $actual.ResourceGroupName $rgname + Assert-AreEqual $actual.FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests get current faults for a specific resource in a resource group with admin subscription id. +#> +function Test-GetCurrentFaults +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $resourceUri = '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/farms/03768357-B4F2-4C3C-AA75-574209B03D49' + $actual = Get-ACSFault ` + -FarmName $farmName -SubscriptionId $subscriptionId -ResourceGroupName $rgname -SkipCertificateValidation ` + -ResourceUri $resourceUri + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual.ActivatedTime.ToString("yyyy-MM-dd HH:mm:ss") "2015-05-18 18:02:00" + Assert-AreEqual $actual.AssociatedDataType 'Metrics' + Assert-AreEqual $actual.AssociatedEventQuery $null + Assert-AreEqual $actual.AssociatedMetricsName 'MetricsName' + Assert-AreEqual $actual.Description 'TBD' + Assert-AreEqual $actual.FaultId 'D64F6195-93FE-40AF-B0A7-D8EA10506028' + Assert-AreEqual $actual.FaultRuleName 'faultRule1' + Assert-AreEqual $actual.ResolutionText 'TBD' + Assert-AreEqual $actual.ResolvedTime $null + Assert-AreEqual $actual.ResourceUri '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1' + Assert-AreEqual $actual.Severity 'Critical' + Assert-AreEqual $actual.ResourceGroupName $rgname + Assert-AreEqual $actual.FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTest.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTest.cs new file mode 100644 index 000000000000..d225e1d5be30 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTest.cs @@ -0,0 +1,36 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class ManagementServicesTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetManagementService() + { + TestsController.NewInstance.RunPsTest("Test-GetManagementService"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestSetManagementService() + { + TestsController.NewInstance.RunPsTest("Test-SetManagementService"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTests.ps1 new file mode 100644 index 000000000000..54a13ff9473b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/ManagementServicesTests.ps1 @@ -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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single farm for a resource group with admin subscription id. +#> +function Test-GetManagementService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Get-ACSManagementService -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + + # Assert TODO add more asserts for detail payload check + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing farms in a resource group with admin subscription id. +#> +function Test-SetManagementService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Set-ACSManagementService -FarmName $farmName ` + -SubscriptionId $subscriptionId -ResourceGroupName $rgname -SkipCertificateValidation ` + -WacContainerGcFullScanIntervalInSeconds 3600 ` + -WacAccountGcFullScanIntervalInSeconds 3600 ` + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.cs new file mode 100644 index 000000000000..59282fd947b2 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.cs @@ -0,0 +1,51 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class NodesTests : RMTestBase + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetNode() + { + TestsController.NewInstance.RunPsTest("Test-GetNode"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestListNodes() + { + TestsController.NewInstance.RunPsTest("Test-ListNodes"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestDisableNode() + { + TestsController.NewInstance.RunPsTest("Test-DisableNode"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestEnableNode() + { + TestsController.NewInstance.RunPsTest("Test-EnableNode"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.ps1 new file mode 100644 index 000000000000..a05f3ccacdc8 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/NodesTests.ps1 @@ -0,0 +1,152 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single node for a resource group with admin subscription id. +#> +function Test-GetNode +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $nodeName = 'woss-node-1' + + try + { + $orgin = Get-ACSNode -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -NodeName $nodeName + Assert-AreEqual $orgin.HealthState "Critical" + Assert-AreEqual $orgin.FarmName "03768357-B4F2-4C3C-AA75-574209B03D49" + Assert-AreEqual $orgin.Id "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1" + Assert-AreEqual $orgin.Location "West_US" + Assert-AreEqual $orgin.Name "03768357-B4F2-4C3C-AA75-574209B03D49/woss-node-1" + Assert-AreEqual $orgin.Type "Microsoft.Storage.Admin/farms/nodes" + Assert-AreEqual $orgin.codeVersion "3.0.1414.9492" + Assert-AreEqual $orgin.configVersion "1.0" + Assert-AreEqual $orgin.faultDomain "fd:/woss-node-1" + Assert-AreEqual $orgin.configVersion "1.0" + Assert-AreEqual $orgin.upgradeDomain "WOSS_U1" + Assert-AreEqual $orgin.runningInstanceUris.count 2 + Assert-AreEqual $orgin.runningInstanceUris[0] "subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/tableserverinstances/woss-node-1" + Assert-AreEqual $orgin.runningInstanceUris[1] "subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/accountcontainerserverinstances/woss-node-1" + + $actual = $orgin | Disable-ACSNode + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing nodes in a resource group with admin subscription id. +#> +function Test-ListNodes +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Get-ACSNode -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + + # Assert TODO add more asserts + Assert-AreEqual $actual.Count 1 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests disabling a single node in cluster in a resource group with admin subscription id. +#> +function Test-EnableNode +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Enable-ACSNode -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + + # Assert TODO add more asserts + Assert-AreEqual $actual.Count 1 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests disabling a single node in cluster in a resource group with admin subscription id. +#> +function Test-DisableNode +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $nodeName = 'woss-node-1' + + try + { + $actual = Disable-ACSNode -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -NodeName $nodeName + + # Assert TODO add more asserts + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests enabling a single node in cluster in a resource group with admin subscription id. +#> +function Test-EnableNode +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $nodeName = 'woss-node-1' + + try + { + $actual = Enable-ACSNode -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -NodeName $nodeName + + # Assert TODO add more asserts + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.cs new file mode 100644 index 000000000000..bcb07aec7682 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.cs @@ -0,0 +1,64 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class RoleInstancesTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetRoleInstance() + { + TestsController.NewInstance.RunPsTest("Test-GetRoleInstance"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestListRoleInstances() + { + TestsController.NewInstance.RunPsTest("Test-ListRoleInstances"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestRestartRoleInstance() + { + TestsController.NewInstance.RunPsTest("Test-RestartRoleInstance"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestStartRoleInstance() + { + TestsController.NewInstance.RunPsTest("Test-StartRoleInstance"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestStopRoleInstance() + { + TestsController.NewInstance.RunPsTest("Test-StopRoleInstance"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestRoleInstancePipeline() + { + TestsController.NewInstance.RunPsTest("Test-RoleInstancePipeline"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.ps1 new file mode 100644 index 000000000000..15d453f65228 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/RoleInstancesTests.ps1 @@ -0,0 +1,187 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single role instance for a resource group with admin subscription id. +#> +function Test-GetRoleInstance +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + $roleInstanceId = 'D11180COL0' + + try + { + $result = Get-ACSRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -RoleType TableServer ` + -InstanceId $roleInstanceId + + Assert-AreEqual $result.HealthStatus "Healthy" + Assert-AreEqual $result.NodeUri "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL0" + Assert-AreEqual $result.InstanceId $roleInstanceId + Assert-AreEqual $result.Status "Active" + + $settings = $result.settings + Assert-AreEqual $settings.TableServerMaxConnections 100 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing role instances in a resource group with admin subscription id. +#> +function Test-ListRoleInstances +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + + try + { + $results = Get-ACSRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -RoleType TableServer + + # Assert TODO add more asserts + Assert-AreEqual $results.Count 6 + Assert-AreEqual $results[0].HealthStatus "Healthy" + Assert-AreEqual $results[0].NodeUri "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL0" + Assert-AreEqual $results[0].InstanceId "D11180COL0" + Assert-AreEqual $results[0].Status "Active" + + $settings = $results[0].settings + Assert-AreEqual $settings.TableServerMaxConnections 100 + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests restarting a role instance in cluster in a resource group with admin subscription id. +#> +function Test-RestartRoleInstance +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + $roleInstanceId = 'D11180COL0' + + try + { + $actual = Restart-ACSRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -RoleType TableServer ` + -InstanceId $roleInstanceId + + # Assert TODO add more asserts + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests starting a role instance in cluster in a resource group with admin subscription id. +#> +function Test-StartRoleInstance +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + $roleInstanceId = 'D11180COL0' + + try + { + $actual = Start-ACSBlobServerRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -InstanceId $roleInstanceId + + # Assert TODO add more asserts + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests stop a role instance in cluster in a resource group with admin subscription id. +#> +function Test-StopRoleInstance +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + $roleInstanceId = 'D11180COL0' + + try + { + $actual = Stop-ACSBlobServerRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -InstanceId $roleInstanceId + + # Assert TODO add more asserts + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests role instance pipeline. Get a roleinstance, then restart it thru pipeline. +#> +function Test-RoleInstancePipeline +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '3c62b865-d397-47fe-99ed-6dda536a1a69' + + try + { + $results = Get-ACSRoleInstance ` + -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -RoleType TableServer | Select-Object -First 1 | Restart-ACSRoleInstance + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.cs new file mode 100644 index 000000000000..4dd79031170e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.cs @@ -0,0 +1,36 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class SharesTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetShare() + { + TestsController.NewInstance.RunPsTest("Test-GetShare"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestListShares() + { + TestsController.NewInstance.RunPsTest("Test-ListShares"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.ps1 new file mode 100644 index 000000000000..4b7465a34510 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/SharesTests.ps1 @@ -0,0 +1,76 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single share for a resource group with admin subscription id. +#> +function Test-GetShare +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $shareName = '||smb|share1' + + try + { + $actual = Get-ACSShare -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -ShareName $shareName + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual.FreeCapacity 460 + Assert-AreEqual $actual.HealthStatus 'Warning' + Assert-AreEqual $actual.ShareName $shareName + Assert-AreEqual $actual.TotalCapacity 500 + Assert-AreEqual $actual.UncPath $shareName + Assert-AreEqual $actual.UsedCapacity 40 + Assert-AreEqual $actual.FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing shares in a resource group with admin subscription id. +#> +function Test-ListShares +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Get-ACSShare -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual[0].FreeCapacity 460 + Assert-AreEqual $actual[0].HealthStatus 'Warning' + Assert-AreEqual $actual[0].ShareName '||smb|share1' + Assert-AreEqual $actual[0].TotalCapacity 500 + Assert-AreEqual $actual[0].UncPath '||smb|share1' + Assert-AreEqual $actual[0].UsedCapacity 40 + Assert-AreEqual $actual[0].FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.cs new file mode 100644 index 000000000000..7458d90eb358 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class StorageAccountsTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetStorageAccount() + { + TestsController.NewInstance.RunPsTest("Test-GetStorageAccount"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestListStorageAccounts() + { + TestsController.NewInstance.RunPsTest("Test-ListStorageAccounts"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestUndoStorageAccountDeletion() + { + TestsController.NewInstance.RunPsTest("Test-UndoStorageAccountDeletion"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestStorageAccountPipeline() + { + TestsController.NewInstance.RunPsTest("Test-StorageAccountPipeline"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.ps1 new file mode 100644 index 000000000000..0b27df9d7813 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/StorageAccountsTests.ps1 @@ -0,0 +1,169 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single storage account with account ID given for a resource group with admin subscription id. +#> +function Test-GetStorageAccount +{ + # Setup + $rgname = 'system' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $accountId = 1 + + try + { + $actual = Get-ACSStorageAccount -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -AccountId $accountId -Detail + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual.AccountId 1 + Assert-AreEqual $actual.AdminViewId '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1' + Assert-AreEqual $actual.TenantViewId '/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007' + Assert-AreEqual $actual.AccountType 'StandardGRS' + Assert-AreEqual $actual.State 'Created' + Assert-AreEqual $actual.PrimaryEndpoints['blob'] 'https://host:11100/demo007' + Assert-AreEqual $actual.PrimaryEndpoints['queue'] 'https://host:11101/demo007' + Assert-AreEqual $actual.PrimaryEndpoints['table'] 'https://host:11102/demo007' + + #TODO: should the type of CreationTime be DateTime? + Assert-AreEqual $actual.CreationTime 'Tue, 13 Oct 2015 05:42:48 GMT' + Assert-AreEqual $actual.AlternateName $null + Assert-AreEqual $actual.StatusOfPrimary 'Available' + Assert-AreEqual $actual.TenantSubscriptionId '177fbbce-fd6a-4f11-bfa4-52c2f3a21918' + Assert-AreEqual $actual.TenantAccountName 'demo007' + Assert-AreEqual $actual.TenantResourceGroupName $rgname + Assert-AreEqual $actual.CurrentOperation 'None' + Assert-AreEqual $actual.CustomDomain $null + Assert-AreEqual $actual.AcquisitionOperationCount 0 + Assert-AreEqual $actual.DeletedTime $null + Assert-AreEqual $actual.AccountStatus 'Active' + Assert-AreEqual $actual.RecoveredTime.ToString("yyyy-MM-dd HH:mm:ss") '2015-10-13 05:44:29' + Assert-AreEqual $actual.RecycledTime $null + Assert-AreEqual $actual.Permissions $null + #TODO: verify WacAccountId, WacInternalState etc + Assert-AreEqual $actual.FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing storage accounts with partial/full storage account name given in a resource group with admin subscription id. +#> +function Test-ListStorageAccounts +{ + # Setup + $rgname = 'system' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $partialAccountName = 'acc' + $tenantSubscriptionId = 'DB3972C4-90B4-4A11-9209-D6C12060F6FC' + + try + { + $actual = Get-ACSStorageAccount -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -PartialAccountName $partialAccountName ` + -TenantSubscriptionId $tenantSubscriptionId + + Assert-AreEqual $actual.Count 1 + Assert-AreEqual $actual[0].AccountId 1 + Assert-AreEqual $actual[0].AdminViewId '/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1' + Assert-AreEqual $actual[0].TenantViewId '/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007' + Assert-AreEqual $actual[0].AccountType 'StandardGRS' + Assert-AreEqual $actual[0].State 'Created' + Assert-AreEqual $actual[0].PrimaryEndpoints['blob'] 'https://host:11100/demo007' + Assert-AreEqual $actual[0].PrimaryEndpoints['queue'] 'https://host:11101/demo007' + Assert-AreEqual $actual[0].PrimaryEndpoints['table'] 'https://host:11102/demo007' + + #TODO: should the type of CreationTime be DateTime? + Assert-AreEqual $actual[0].CreationTime 'Tue, 13 Oct 2015 05:42:48 GMT' + Assert-AreEqual $actual[0].AlternateName $null + Assert-AreEqual $actual[0].StatusOfPrimary 'Available' + Assert-AreEqual $actual[0].TenantSubscriptionId '177fbbce-fd6a-4f11-bfa4-52c2f3a21918' + Assert-AreEqual $actual[0].TenantAccountName 'demo007' + Assert-AreEqual $actual[0].TenantResourceGroupName $rgname + Assert-AreEqual $actual[0].CurrentOperation 'None' + Assert-AreEqual $actual[0].CustomDomain $null + Assert-AreEqual $actual[0].AcquisitionOperationCount 0 + Assert-AreEqual $actual[0].DeletedTime $null + Assert-AreEqual $actual[0].AccountStatus 'Active' + Assert-AreEqual $actual[0].RecoveredTime.ToString("yyyy-MM-dd HH:mm:ss") '2015-10-13 05:44:29' + Assert-AreEqual $actual[0].RecycledTime $null + Assert-AreEqual $actual[0].Permissions $null + #TODO: verify WacAccountId, WacInternalState etc + Assert-AreEqual $actual[0].FarmName $farmName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests undo the deletion of a storage account with account ID given in a resource group with admin subscription id. +#> +function Test-UndoStorageAccountDeletion +{ + # Setup + $rgname = 'system' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $accountId = 1 + $tenantSubscriptionId = 'DB3972C4-90B4-4A11-9209-D6C12060F6FC' + $newAccountName = 'acc_new_name' + + try + { + $actual = Undo-ACSStorageAccountDeletion -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName ` + -AccountId $accountId -NewAccountName $newAccountName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests pipeline. Get an account first, then undo deletion. +#> +function Test-StorageAccountPipeline +{ + # Setup + $rgname = 'system' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + $accountId = 1 + $newAccountName = 'acc_new_name' + + try + { + $actual = Get-ACSStorageAccount -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName -AccountId $accountId -Detail ` + | Undo-ACSStorageAccountDeletion -NewAccountName $newAccountName + } + finally + { + # Cleanup + # No cleanup needed for now + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.cs new file mode 100644 index 000000000000..76caea401fa7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.cs @@ -0,0 +1,36 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public class TableServicesTests + { + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetTableService() + { + TestsController.NewInstance.RunPsTest("Test-GetTableService"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestSetTableService() + { + TestsController.NewInstance.RunPsTest("Test-SetTableService"); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.ps1 b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.ps1 new file mode 100644 index 000000000000..3562f6c83351 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TableServicesTests.ps1 @@ -0,0 +1,85 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS +Tests getting a single farm for a resource group with admin subscription id. +#> +function Test-GetTableService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $orgin = Get-ACSTableService -ResourceGroupName $rgname -SubscriptionId $subscriptionId -FarmName $farmName + Assert-AreEqual $orgin.HealthStatus "Unknown" + Assert-AreEqual $orgin.FarmName "82ba752f-0fac-47e2-8477-5731f9f5db34" + Assert-AreEqual $orgin.Id "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/tableservices/default" + Assert-AreEqual $orgin.Location "redmond" + Assert-AreEqual $orgin.Name "82ba752f-0fac-47e2-8477-5731f9f5db34/default" + Assert-AreEqual $orgin.Type "Microsoft.Storage.Admin/farms/tableservices" + Assert-AreEqual $orgin.version "1.0" + + Assert-AreEqual $orgin.Settings.frontEndHttpListenPort "11002" + Assert-AreEqual $orgin.Settings.frontEndHttpsListenPort "11102" + Assert-AreEqual $orgin.Settings.frontEndCallbackThreadsCount "1800" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingEnabled "true" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold "100" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle "10" + Assert-AreEqual $orgin.Settings.frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds "20" + Assert-AreEqual $orgin.Settings.frontEndMemoryThrottlingEnabled "true" + Assert-AreEqual $orgin.Settings.frontEndMaxMillisecondsBetweenMemorySamples "10000" + Assert-AreEqual $orgin.Settings.frontEndMemoryThrottleThresholdSettings "5,100,0;7,50,0;10,25,0;15,0,25;" + #Assert-AreEqual $orgin.Settings.frontEndMinThreadPoolThreads "1600" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveIOCompletionThreshold "1500" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveWorkerThreadThreshold "1500" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds "30" + Assert-AreEqual $orgin.Settings.frontEndThreadPoolBasedKeepAlivePercentage "10" + Assert-AreEqual $orgin.Settings.frontEndUseSlaTimeInAvailability "true" + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + +<# +.SYNOPSIS +Tests listing farms in a resource group with admin subscription id. +#> +function Test-SetTableService +{ + # Setup + $rgname = 'Default-Web-EastUS' + $subscriptionId = 'a93fb07c-6c93-40be-bf3b-4f0deba10f4b' + $farmName = '03768357-B4F2-4C3C-AA75-574209B03D49' + + try + { + $actual = Set-ACSTableService -FarmName $farmName ` + -SubscriptionId $subscriptionId -ResourceGroupName $rgname -SkipCertificateValidation ` + -FrontEndCpuBasedKeepAliveThrottlingEnabled $true ` + -FrontEndMemoryThrottlingEnabled $true + } + finally + { + # Cleanup + # No cleanup needed for now + } +} + diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs new file mode 100644 index 000000000000..07e41b0a1902 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/ScenarioTests/TestsController.cs @@ -0,0 +1,154 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Common.Authentication; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Microsoft.Azure.Test; +using System; +using System.Linq; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; + +namespace Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests +{ + public sealed class TestsController : RMTestBase + { + private CSMTestEnvironmentFactory csmTestFactory; + private EnvironmentSetupHelper helper; + + public string UserDomain { get; private set; } + + public static TestsController NewInstance + { + get + { + return new TestsController(); + } + } + + public TestsController() + { + helper = new EnvironmentSetupHelper(); + } + + public void RunPsTest(params string[] scripts) + { + var callingClassType = TestUtilities.GetCallingClass(2); + var mockName = TestUtilities.GetCurrentMethodName(2); + + RunPsTestWorkflow( + () => scripts, + // no custom initializer + null, + // no custom cleanup + null, + callingClassType, + mockName); + } + + public void RunPsTestWorkflow( + Func scriptBuilder, + Action initialize, + Action cleanup, + string callingClassType, + string mockName) + { + using (UndoContext context = UndoContext.Current) + { + context.Start(callingClassType, mockName); + + this.csmTestFactory = new CSMTestEnvironmentFactory(); + + if(initialize != null) + { + initialize(this.csmTestFactory); + } + + SetupManagementClients(); + + helper.SetupEnvironment(AzureModule.AzureResourceManager); + + var callingClassName = callingClassType + .Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries) + .Last(); + helper.SetupModules( + AzureModule.AzureResourceManager, + "ScenarioTests\\Common.ps1", + "ScenarioTests\\" + callingClassName + ".ps1", + helper.RMProfileModule, + helper.GetRMModulePath("AzureRM.AzureStackStorage.psd1")); + + try + { + if (scriptBuilder != null) + { + var psScripts = scriptBuilder(); + + if (psScripts != null) + { + helper.RunPowerShellTest(psScripts); + } + } + } + finally + { + if(cleanup !=null) + { + cleanup(); + } + } + } + } + + private void SetupManagementClients() + { + var storageAdminClient = GetStorageManagementClient(); + + helper.SetupManagementClients(storageAdminClient); + } + + private IStorageAdminManagementClient GetStorageManagementClient() + { + return TestBase.GetServiceClient(this.csmTestFactory); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestGetBlobService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestGetBlobService.json new file mode 100644 index 000000000000..bc76856c652b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestGetBlobService.json @@ -0,0 +1,113 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/blobservices/default?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/tableservices/default\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34/default\",\"type\":\"Microsoft.Storage.Admin/farms/tableservices\",\"location\":\"redmond\",\"properties\":{\"settings\":{\"frontEndHttpListenPort\":11002,\"frontEndHttpsListenPort\":11102,\"frontEndCallbackThreadsCount\":1800,\"frontEndCpuBasedKeepAliveThrottlingEnabled\":true,\"frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold\":100,\"frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle\":10,\"frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds\":20,\"frontEndMemoryThrottlingEnabled\":true,\"frontEndMaxMillisecondsBetweenMemorySamples\":10000,\"frontEndMemoryThrottleThresholdSettings\":\"5,100,0;7,50,0;10,25,0;15,0,25;\",\"frontEndMinThreadPoolThreads\":1600,\"frontEndThreadPoolBasedKeepAliveIOCompletionThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveWorkerThreadThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds\":30,\"frontEndThreadPoolBasedKeepAlivePercentage\":10,\"frontEndUseSlaTimeInAvailability\":true},\"version\":\"1.0\",\"healthStatus\":\"Unknown\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/blobservices/default?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"frontEndCpuBasedKeepAliveThrottlingEnabled\":false}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/tableservices/default\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34/default\",\"type\":\"Microsoft.Storage.Admin/farms/tableservices\",\"location\":\"redmond\",\"properties\":{\"settings\":{\"frontEndHttpListenPort\":11002,\"frontEndHttpsListenPort\":11102,\"frontEndCallbackThreadsCount\":1800,\"frontEndCpuBasedKeepAliveThrottlingEnabled\":false,\"frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold\":100,\"frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle\":10,\"frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds\":20,\"frontEndMemoryThrottlingEnabled\":true,\"frontEndMaxMillisecondsBetweenMemorySamples\":10000,\"frontEndMemoryThrottleThresholdSettings\":\"5,100,0;7,50,0;10,25,0;15,0,25;\",\"frontEndMinThreadPoolThreads\":1600,\"frontEndThreadPoolBasedKeepAliveIOCompletionThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveWorkerThreadThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds\":30,\"frontEndThreadPoolBasedKeepAlivePercentage\":10,\"frontEndUseSlaTimeInAvailability\":true},\"version\":\"1.0\",\"healthStatus\":\"Unknown\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-GetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestSetBlobService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestSetBlobService.json new file mode 100644 index 000000000000..9e95f9889d52 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.BlobServicesTests/TestSetBlobService.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/blobservices/default?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"frontEndCallbackThreadsCount\":1800,\"frontEndCpuBasedKeepAliveThrottlingEnabled\":true,\"frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold\":100,\"frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle\":10,\"frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds\":20,\"frontEndMemoryThrottlingEnabled\":true}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2015-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-SetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestGetFarm.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestGetFarm.json new file mode 100644 index 000000000000..fd9d2cf026a4 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestGetFarm.json @@ -0,0 +1,113 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/farm_01\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"west us\",\"name\":\"farm_01\",\"properties\":{\"settings\":{\"settingsPollingIntervalInSecond\":60,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"},\"settingsStore\":\"anypath\",\"healthStatus\":\"Warning\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/farm_01?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"settingsPollingIntervalInSecond\":90,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\"}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2015-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-GetFarm": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestListFarms.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestListFarms.json new file mode 100644 index 000000000000..621041f941bc --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestListFarms.json @@ -0,0 +1,63 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/rg1/providers/Microsoft.Storage.Admin/farms/farm_01\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"west us\",\"name\":\"farm_01\",\"properties\":{\"settings\":{\"settingsPollingIntervalInSecond\":60,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"},\"settingsStore\":\"anypath\",\"healthStatus\":\"Warning\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-ListFarms": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestSetFarm.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestSetFarm.json new file mode 100644 index 000000000000..39f6ff51542e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FarmsTests/TestSetFarm.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"settingsPollingIntervalInSecond\":90,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\"}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2015-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-SetFarm": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetCurrentFaults.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetCurrentFaults.json new file mode 100644 index 000000000000..4dac049256a6 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetCurrentFaults.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults?api-version=2015-12-01-preview&$filter=resourceUri%20eq%20'%2Fsubscriptions%2Fa93fb07c-6c93-40be-bf3b-4f0deba10f4b%2Fresourcegroups%2FDefault-Web-EastUS%2Ffarms%2F03768357-B4F2-4C3C-AA75-574209B03D49'", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"type\":\"Microsoft.Storage.Admin/farms/faults\",\"location\":\"EAST US\",\"properties\":{\"faultId\":\"D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"faultRuleName\":\"faultRule1\",\"description\":\"TBD\",\"resourceUri\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1\",\"severity\":\"Critical\",\"activatedTime\":\"2015-05-18T18:02:00Z\",\"resolvedTime\":null,\"resolutionText\":\"TBD\",\"associatedDataType\":\"Metrics\",\"associatedMetricsName\":\"MetricsName\"}}]", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetFault.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetFault.json new file mode 100644 index 000000000000..e34bb073c2c2 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetFault.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults/D64F6195-93FE-40AF-B0A7-D8EA10506028?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"type\":\"Microsoft.Storage.Admin/farms/faults\",\"location\":\"EAST US\",\"properties\":{\"faultId\":\"D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"faultRuleName\":\"faultRule1\",\"description\":\"TBD\",\"resourceUri\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1\",\"severity\":\"Critical\",\"activatedTime\":\"2015-05-18T18:02:00Z\",\"resolvedTime\":null,\"resolutionText\":\"TBD\",\"associatedDataType\":\"Metrics\",\"associatedMetricsName\":\"MetricsName\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetHistoricFaults.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetHistoricFaults.json new file mode 100644 index 000000000000..b634a6b5dae5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestGetHistoricFaults.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults?api-version=2015-12-01-preview&$filter=startTime%20eq%20'2015-01-01T00%3A00%3A00.0000000'%20and%20endTime%20eq%20'2015-01-02T00%3A00%3A00.0000000'", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"type\":\"Microsoft.Storage.Admin/farms/faults\",\"location\":\"EAST US\",\"properties\":{\"faultId\":\"D64F6195-93FE-40AF-B0A7-D8EA10506028\",\"faultRuleName\":\"faultRule1\",\"description\":\"TBD\",\"resourceUri\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableserverinstances/woss-node1\",\"severity\":\"Critical\",\"activatedTime\":\"2015-05-18T18:02:00Z\",\"resolvedTime\":null,\"resolutionText\":\"TBD\",\"associatedDataType\":\"Metrics\",\"associatedMetricsName\":\"MetricsName\"}}]", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestResolveFault.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestResolveFault.json new file mode 100644 index 000000000000..bc1c76b18081 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.FaultsTests/TestResolveFault.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/faults/D64F6195-93FE-40AF-B0A7-D8EA10506028/dismiss?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 204 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestGetManagementService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestGetManagementService.json new file mode 100644 index 000000000000..3493e9af14d7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestGetManagementService.json @@ -0,0 +1,63 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/managementservices/default?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/managementservices/default\",\"name\":\"6fc55539-11fa-4a2d-aa19-a88cd546ef45/default\",\"type\":\"Microsoft.Storage.Admin/farms/managementservices\",\"location\":\"redmond\",\"properties\":{\"settings\":{\"wacContainerGcFullScanIntervalInSeconds\":3600,\"wacAccountGcFullScanIntervalInSeconds\":3600,\"wacGcWaitPeriodInMilliseconds\":32000,\"wacHoldingPeriodInHours\":336,\"wacMaxGcThreadNumber\":10,\"wacMaxCacheSize\":2097152,\"wacMaxConnections\":2000,\"healthAccountName\":\"monitoringaccount\",\"healthAccountKey\":\"zN8d5l/m+h2DmGDYEoTpz0wPHPdRzP8R+sVTFSzdwjCYWIt4hzA7JN6Gcjto2ZuFt7JbCqP7oU80tGRm6F1GTQ==\",\"healthHistoryDays\":7,\"metricsBucketCount\":8,\"metricsAccountName\":\"metricaccount\",\"metricsAccountKey\":\"IwULNjunNhFEfI6p53MpW1lb16h9+TRfHzrlcF/3t3csuOBG/7c4RSagXSSL975bfKSX049t2oARdqM4Xz+8mg==\"},\"version\":\"1.0\",\"healthStatus\":\"Healthy\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-GetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestSetManagementService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestSetManagementService.json new file mode 100644 index 000000000000..8d8ae94ed2b0 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.ManagementServicesTests/TestSetManagementService.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/managementservices/default?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"wacContainerGcFullScanIntervalInSeconds\":3600,\"wacAccountGcFullScanIntervalInSeconds\":3600,\"wacGcWaitPeriodInMilliseconds\":32000,\"wacHoldingPeriodInHours\":336,\"wacMaxGcThreadNumber\":10,\"wacMaxCacheSize\":2097152,\"wacMaxConnections\":2000,\"healthAccountName\":\"monitoringaccount\",\"healthAccountKey\":\"zN8d5l/m+h2DmGDYEoTpz0wPHPdRzP8R+sVTFSzdwjCYWIt4hzA7JN6Gcjto2ZuFt7JbCqP7oU80tGRm6F1GTQ==\",\"healthHistoryDays\":7,\"metricsBucketCount\":8,\"metricsAccountName\":\"metricsaccount\",\"metricsAccountKey\":\"IwULNjunNhFEfI6p53MpW1lb16h9+TRfHzrlcF/3t3csuOBG/7c4RSagXSSL975bfKSX049t2oARdqM4Xz+8mg==\"}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2015-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-SetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestDisableNode.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestDisableNode.json new file mode 100644 index 000000000000..c0a5fd467596 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestDisableNode.json @@ -0,0 +1,215 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/offline?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-DisableNode": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestEnableNode.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestEnableNode.json new file mode 100644 index 000000000000..6349939eddc7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestEnableNode.json @@ -0,0 +1,215 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/online?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-DisableNode": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestGetNode.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestGetNode.json new file mode 100644 index 000000000000..e8ca0eb38ce6 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestGetNode.json @@ -0,0 +1,216 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/woss-node-1\",\"type\":\"Microsoft.Storage.Admin/farms/nodes\",\"location\":\"West_US\",\"properties\":{\"codeVersion\":\"3.0.1414.9492\",\"configVersion\":\"1.0\",\"faultDomain\":\"fd:/woss-node-1\",\"healthStatus\":\"Critical\",\"ipAddressOrFqdn\":\"woss-node-1\",\"isSeedNode\":true,\"nodeId\":\"c8e6bfe487b4b8eceb5dc36ff6a2452\",\"nodeName\":\"woss-node-1\",\"nodeStatus\":\"Up\",\"nodeType\":\"Common\",\"nodeUpTime\":\"PT1H\",\"upgradeDomain\":\"WOSS_U1\",\"runningInstanceUris\":[\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/tableserverinstances/woss-node-1\",\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/accountcontainerserverinstances/woss-node-1\"]}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/offline?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/6368ed38-3570-481f-b4fa-1d0a6e8d3f3b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1/operationresults/491b11bf-fffc-4990-81c2-e6693627d5e2?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-GetNode": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b", + "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "Domain": "microsoft.com" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestListNodes.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestListNodes.json new file mode 100644 index 000000000000..f8c0dda6841c --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestListNodes.json @@ -0,0 +1,63 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/woss-node-1\",\"type\":\"Microsoft.Storage.Admin/farms/nodes\",\"location\":\"West_US\",\"properties\":{\"codeVersion\":\"3.0.1414.9492\",\"configVersion\":\"1.0\",\"faultDomain\":\"fd:/woss-node-1\",\"healthState\":\"Ok\",\"ipAddressOrFqdn\":\"woss-node-1\",\"isSeedNode\":true,\"nodeId\":\"c8e6bfe487b4b8eceb5dc36ff6a2452\",\"nodeName\":\"woss-node-1\",\"nodeStatus\":\"Up\",\"nodeType\":\"Common\",\"nodeUpTime\":\"PT1H\",\"upgradeDomain\":\"WOSS_U1\",\"runningInstanceUris\":[\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/tableserverinstances/woss-node-1\",\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/accountcontainerserverinstances/woss-node-1\"]}}]", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-ListNodes": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestSetFarm.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestSetFarm.json new file mode 100644 index 000000000000..9be6dec5715b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.NodesTests/TestSetFarm.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49?api-version=2014-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"settingsPollingIntervalInSecond\":90,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\"}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2014-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-SetFarm": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestGetRoleInstance.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestGetRoleInstance.json new file mode 100644 index 000000000000..c791614ae51a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestGetRoleInstance.json @@ -0,0 +1,84 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{ + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL0\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL0\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL0\", + \"historyInfos\": [] + } +}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestListRoleInstances.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestListRoleInstances.json new file mode 100644 index 000000000000..9cb83afd484a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestListRoleInstances.json @@ -0,0 +1,211 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[ + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL0\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL0\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL0\", + \"historyInfos\": [] + } + }, + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL1\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL1\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL1\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL1\", + \"historyInfos\": [] + } + }, + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL2\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL2\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL2\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL2\", + \"historyInfos\": [] + } + }, + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL3\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL3\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL3\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL3\", + \"historyInfos\": [] + } + }, + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL4\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL4\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL4\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL4\", + \"historyInfos\": [] + } + }, + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL5\", + \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL5\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", + \"location\": \"redmond\", + \"properties\": { + \"settings\": { + \"tableServerMaxCacheSize\": 917504, + \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, + \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, + \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, + \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL5\", + \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", + \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL5\", + \"historyInfos\": [] + } + } +]", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRestartRoleInstance.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRestartRoleInstance.json new file mode 100644 index 000000000000..c162bed5dee6 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRestartRoleInstance.json @@ -0,0 +1,159 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/restart?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRoleInstancePipeline.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRoleInstancePipeline.json new file mode 100644 index 000000000000..621f2c876031 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestRoleInstancePipeline.json @@ -0,0 +1,264 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[ + { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL0\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" + }, + \"roleIdentifier\": \"D11180COL0\", \"version\": \"2015-12-01-preview\", + \"status\": \"Active\", \"healthStatus\": \"Healthy\", + \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL0\", \"historyInfos\": [] + } +}, { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL1\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL1\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" +}, \"roleIdentifier\": \"D11180COL1\", \"version\": \"2015-12-01-preview\", \"status\": \"Active\", \"healthStatus\": \"Healthy\", \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL1\", \"historyInfos\": [] } }, { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL2\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL2\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" +}, \"roleIdentifier\": \"D11180COL2\", \"version\": \"2015-12-01-preview\", \"status\": \"Active\", \"healthStatus\": \"Healthy\", \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL2\", \"historyInfos\": [] } }, { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL3\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL3\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" +}, \"roleIdentifier\": \"D11180COL3\", \"version\": \"2015-12-01-preview\", \"status\": \"Active\", \"healthStatus\": \"Healthy\", \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL3\", \"historyInfos\": [] } }, { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL4\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL4\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" +}, \"roleIdentifier\": \"D11180COL4\", \"version\": \"2015-12-01-preview\", \"status\": \"Active\", \"healthStatus\": \"Healthy\", \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL4\", \"historyInfos\": [] } }, { + \"id\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL5\", \"name\": \"3c62b865-d397-47fe-99ed-6dda536a1a69/D11180COL5\", + \"type\": \"Microsoft.Storage.Admin/farms/tableserverinstances\", \"location\": \"redmond\", + \"properties\": { \"settings\": { + \"tableServerMaxCacheSize\": 917504, \"tableServerMaxConnections\": 100, + \"tableServerCpuUsagePercentageThrottling\": 0.8, \"tableServerCpuUsageThrottlingThreshold\": 90, + \"tableServerMaxThrottlingProbabilityForAccount\": 0.9, \"tableServerPendingRequestCountThrottlingThreshold\": 5000, + \"tableServerScanThrottlingThreshold\": 10, \"settingsPollingIntervalInSeconds\": 60, + \"settingsTimestamp\": \"20151117T195500\" +}, \"roleIdentifier\": \"D11180COL5\", \"version\": \"2015-12-01-preview\", \"status\": \"Active\", \"healthStatus\": \"Healthy\", \"nodeUri\": \"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/nodes/D11180COL5\", \"historyInfos\": [] } } ]", "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] +}, "StatusCode": 200 }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/restart?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, +{ + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/tableserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 +} + ], "Names": { +}, "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" +} } diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStartRoleInstance.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStartRoleInstance.json new file mode 100644 index 000000000000..9c48ea040555 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStartRoleInstance.json @@ -0,0 +1,159 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/online?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStopRoleInstance.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStopRoleInstance.json new file mode 100644 index 000000000000..3a3a240c282c --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.RoleInstancesTests/TestStopRoleInstance.json @@ -0,0 +1,159 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/offline?api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-correlation-request-id": [ + "1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:1fccaffa-7dd6-4fd0-8ebf-bdf8523ae631" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "5" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31991" + ], + "x-ms-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-correlation-request-id": [ + "f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004139Z:f62f23d6-0868-4e9e-ada8-f31ca9538c1e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:41:39 GMT" + ], + "Location": [ + "https://management.azure.com/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/3c62b865-d397-47fe-99ed-6dda536a1a69/blobserverinstances/D11180COL0/operationresults/8006fda9-6397-4a93-8d10-d5dd36b20c93?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2015-12-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31988" + ], + "x-ms-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-correlation-request-id": [ + "514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150218T004225Z:514a2b94-333d-4837-a70f-e7bc4572d6ff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 18 Feb 2015 00:42:25 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestGetShare.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestGetShare.json new file mode 100644 index 000000000000..fab64152f234 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestGetShare.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/shares/%7C%7Csmb%7Cshare1?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/shares/smb|share1\",\"type\":\"Microsoft.Storage.Admin/farms/shares\",\"location\":\"west us\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/smb|share1\",\"properties\":{\"shareName\":\"||smb|share1\",\"uncPath\":\"||smb|share1\",\"healthStatus\":\"Warning\",\"totalCapacity\":500,\"freeCapacity\":460,\"usedCapacity\":40}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestListShares.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestListShares.json new file mode 100644 index 000000000000..4026a850c8ac --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.SharesTests/TestListShares.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/shares?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/shares/smb|share1\",\"type\":\"Microsoft.Storage.Admin/farms/shares\",\"location\":\"west us\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/smb|share1\",\"properties\":{\"shareName\":\"||smb|share1\",\"uncPath\":\"||smb|share1\",\"healthStatus\":\"Warning\",\"totalCapacity\":500,\"freeCapacity\":460,\"usedCapacity\":40}}]", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestGetStorageAccount.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestGetStorageAccount.json new file mode 100644 index 000000000000..b2f40ac7ff81 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestGetStorageAccount.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts?api-version=2015-12-01-preview&$filter=VersionedAccountName%20eq%20%271%27&summary=false", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1\",\"type\":\"Microsoft.Storage.Admin/storageaccounts\",\"name\":\"1\",\"location\":\"redmond\",\"tags\":{},\"properties\":{\"provisioningState\":\"Succeeded\",\"primaryEndpoints\":{\"blob\":\"https://host:11100/demo007\",\"queue\":\"https://host:11101/demo007\",\"table\":\"https://host:11102/demo007\"},\"primaryLocation\":\"redmond\",\"statusOfPrimary\":\"Available\",\"tenantViewId\":\"/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007\",\"tenantSubscriptionId\":\"177fbbce-fd6a-4f11-bfa4-52c2f3a21918\",\"tenantStorageAccountName\":\"demo007\",\"tenantResourceGroupName\":\"system\",\"currentOperation\":\"None\",\"acquisitionOperationCount\":0,\"accountStatus\":\"Active\",\"recoveredTime\":\"2015-10-13T05:44:29.743\",\"accountType\":\"Standard_GRS\",\"creationTime\":\"Tue, 13 Oct 2015 05:42:48 GMT\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestListStorageAccounts.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestListStorageAccounts.json new file mode 100644 index 000000000000..d00f8650e5ce --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestListStorageAccounts.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts?api-version=2015-12-01-preview&$filter=TenantSubscriptionId%20eq%20%27DB3972C4-90B4-4A11-9209-D6C12060F6FC%27%20and%20PartialAccountName%20eq%20%27acc%27&summary=true", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1\",\"type\":\"Microsoft.Storage.Admin/storageaccounts\",\"name\":\"1\",\"location\":\"redmond\",\"tags\":{},\"properties\":{\"provisioningState\":\"Succeeded\",\"primaryEndpoints\":{\"blob\":\"https://host:11100/demo007\",\"queue\":\"https://host:11101/demo007\",\"table\":\"https://host:11102/demo007\"},\"primaryLocation\":\"redmond\",\"statusOfPrimary\":\"Available\",\"tenantViewId\":\"/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007\",\"tenantSubscriptionId\":\"177fbbce-fd6a-4f11-bfa4-52c2f3a21918\",\"tenantStorageAccountName\":\"demo007\",\"tenantResourceGroupName\":\"system\",\"currentOperation\":\"None\",\"acquisitionOperationCount\":0,\"accountStatus\":\"Active\",\"recoveredTime\":\"2015-10-13T05:44:29.743\",\"accountType\":\"Standard_GRS\",\"creationTime\":\"Tue, 13 Oct 2015 05:42:48 GMT\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestStorageAccountPipeLine.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestStorageAccountPipeLine.json new file mode 100644 index 000000000000..0a13cdb366c3 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestStorageAccountPipeLine.json @@ -0,0 +1,213 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts?api-version=2015-12-01-preview&$filter=VersionedAccountName%20eq%20%271%27&summary=false", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1\",\"type\":\"Microsoft.Storage.Admin/storageaccounts\",\"name\":\"1\",\"location\":\"redmond\",\"tags\":{},\"properties\":{\"provisioningState\":\"Succeeded\",\"primaryEndpoints\":{\"blob\":\"https://host:11100/demo007\",\"queue\":\"https://host:11101/demo007\",\"table\":\"https://host:11102/demo007\"},\"primaryLocation\":\"redmond\",\"statusOfPrimary\":\"Available\",\"tenantViewId\":\"/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007\",\"tenantSubscriptionId\":\"177fbbce-fd6a-4f11-bfa4-52c2f3a21918\",\"tenantStorageAccountName\":\"demo007\",\"tenantResourceGroupName\":\"system\",\"currentOperation\":\"None\",\"acquisitionOperationCount\":0,\"accountStatus\":\"Active\",\"recoveredTime\":\"2015-10-13T05:44:29.743\",\"accountType\":\"Standard_GRS\",\"creationTime\":\"Tue, 13 Oct 2015 05:42:48 GMT\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1?action=undelete&api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "{\"newAccountName\":\"acc_new_name\",\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts?api-version=2015-12-01-preview&$filter=%7Bversionedaccountname%20eq%20%271%27%7D&summary=true", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1\",\"type\":\"Microsoft.Storage.Admin/storageaccounts\",\"name\":\"1\",\"location\":\"redmond\",\"tags\":{},\"properties\":{\"provisioningState\":\"Succeeded\",\"primaryEndpoints\":{\"blob\":\"https://host:11100/demo007\",\"queue\":\"https://host:11101/demo007\",\"table\":\"https://host:11102/demo007\"},\"primaryLocation\":\"redmond\",\"statusOfPrimary\":\"Available\",\"tenantViewId\":\"/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007\",\"tenantSubscriptionId\":\"177fbbce-fd6a-4f11-bfa4-52c2f3a21918\",\"tenantStorageAccountName\":\"demo007\",\"tenantResourceGroupName\":\"system\",\"currentOperation\":\"None\",\"acquisitionOperationCount\":0,\"accountStatus\":\"Active\",\"recoveredTime\":\"2015-10-13T05:44:29.743\",\"accountType\":\"Standard_GRS\",\"creationTime\":\"Tue, 13 Oct 2015 05:42:48 GMT\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/providers/Microsoft.Resources.Admin/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourceGroups/system/SynchronizeResources?api-version=1.0", + "RequestMethod": "POST", + "RequestBody": "{\"apiVersion\":\"2015-06-15\",\"resourceLocation\":\"redmond\",\"targetOperation\":\"Create\",\"id\":\"subscriptions/177FBBCE-FD6A-4F11-BFA4-52C2F3A21918/resourceGroups/system/providers/Microsoft.Storage/StorageAccounts/acc_new_name\",\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"correlationId\":\"4ec418ca-5acd-47da-83bb-0aefbe8f365e\",\"frontdoorLocation\":\"redmond\",\"timestamp\":\"2015-10-19T05:51:43.9138942Z\",\"message\":\"Resource group synchronization jobs started successfully.\",\"data\":{\"targetNamespaces\":[\"Microsoft.Authorization\",\"Microsoft.Insights\",\"Microsoft.Gallery\",\"Microsoft.Sql\",\"Microsoft.Sql.Admin\",\"Microsoft.Subscriptions\",\"Microsoft.Subscriptions.Admin\",\"Microsoft.Commerce\",\"Microsoft.Storage\",\"Microsoft.Storage.Admin\"]}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestUndoStorageAccountDeletion.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestUndoStorageAccountDeletion.json new file mode 100644 index 000000000000..75b53bf6fc19 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.StorageAccountsTests/TestUndoStorageAccountDeletion.json @@ -0,0 +1,161 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1?action=undelete&api-version=2015-12-01-preview", + "RequestMethod": "POST", + "RequestBody": "{\"newAccountName\":\"acc_new_name\",\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts?api-version=2015-12-01-preview&$filter=%7Bversionedaccountname%20eq%20%271%27%7D&summary=true", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/storageaccounts/1\",\"type\":\"Microsoft.Storage.Admin/storageaccounts\",\"name\":\"1\",\"location\":\"redmond\",\"tags\":{},\"properties\":{\"provisioningState\":\"Succeeded\",\"primaryEndpoints\":{\"blob\":\"https://host:11100/demo007\",\"queue\":\"https://host:11101/demo007\",\"table\":\"https://host:11102/demo007\"},\"primaryLocation\":\"redmond\",\"statusOfPrimary\":\"Available\",\"tenantViewId\":\"/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourcegroups/system/providers/Microsoft.Storage/storageaccounts/demo007\",\"tenantSubscriptionId\":\"177fbbce-fd6a-4f11-bfa4-52c2f3a21918\",\"tenantStorageAccountName\":\"demo007\",\"tenantResourceGroupName\":\"system\",\"currentOperation\":\"None\",\"acquisitionOperationCount\":0,\"accountStatus\":\"Active\",\"recoveredTime\":\"2015-10-13T05:44:29.743\",\"accountType\":\"Standard_GRS\",\"creationTime\":\"Tue, 13 Oct 2015 05:42:48 GMT\"}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/providers/Microsoft.Resources.Admin/subscriptions/177fbbce-fd6a-4f11-bfa4-52c2f3a21918/resourceGroups/system/SynchronizeResources?api-version=1.0", + "RequestMethod": "POST", + "RequestBody": "{\"apiVersion\":\"2015-06-15\",\"resourceLocation\":\"redmond\",\"targetOperation\":\"Create\",\"id\":\"subscriptions/177FBBCE-FD6A-4F11-BFA4-52C2F3A21918/resourceGroups/system/providers/Microsoft.Storage/StorageAccounts/acc_new_name\",\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"correlationId\":\"4ec418ca-5acd-47da-83bb-0aefbe8f365e\",\"frontdoorLocation\":\"redmond\",\"timestamp\":\"2015-10-19T05:51:43.9138942Z\",\"message\":\"Resource group synchronization jobs started successfully.\",\"data\":{\"targetNamespaces\":[\"Microsoft.Authorization\",\"Microsoft.Insights\",\"Microsoft.Gallery\",\"Microsoft.Sql\",\"Microsoft.Sql.Admin\",\"Microsoft.Subscriptions\",\"Microsoft.Subscriptions.Admin\",\"Microsoft.Commerce\",\"Microsoft.Storage\",\"Microsoft.Storage.Admin\"]}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestGetTableService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestGetTableService.json new file mode 100644 index 000000000000..d86f4ab1a435 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestGetTableService.json @@ -0,0 +1,63 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableservices/default?api-version=2015-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/82ba752f-0fac-47e2-8477-5731f9f5db34/tableservices/default\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34/default\",\"type\":\"Microsoft.Storage.Admin/farms/tableservices\",\"location\":\"redmond\",\"properties\":{\"settings\":{\"frontEndHttpListenPort\":11002,\"frontEndHttpsListenPort\":11102,\"frontEndCallbackThreadsCount\":1800,\"frontEndCpuBasedKeepAliveThrottlingEnabled\":true,\"frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold\":100,\"frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle\":10,\"frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds\":20,\"frontEndMemoryThrottlingEnabled\":true,\"frontEndMaxMillisecondsBetweenMemorySamples\":10000,\"frontEndMemoryThrottleThresholdSettings\":\"5,100,0;7,50,0;10,25,0;15,0,25;\",\"frontEndMinThreadPoolThreads\":1600,\"frontEndThreadPoolBasedKeepAliveIOCompletionThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveWorkerThreadThreshold\":1500,\"frontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds\":30,\"frontEndThreadPoolBasedKeepAlivePercentage\":10,\"frontEndUseSlaTimeInAvailability\":true},\"version\":\"1.0\",\"healthStatus\":\"Unknown\"}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-GetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestListNodes.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestListNodes.json new file mode 100644 index 000000000000..71b0d19f3bc9 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestListNodes.json @@ -0,0 +1,63 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes?api-version=2014-12-01-preview", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ + "Microsoft.AzureStack.Management.StorageAdmin/0.9.0.0 AzurePowershell/v0.8.14" + ] + }, + "ResponseBody": "{\"value\":[{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/nodes/woss-node-1\",\"name\":\"03768357-B4F2-4C3C-AA75-574209B03D49/woss-node-1\",\"type\":\"Microsoft.Storage.Admin/farms/nodes\",\"location\":\"West_US\",\"properties\":{\"codeVersion\":\"3.0.1414.9492\",\"configVersion\":\"1.0\",\"faultDomain\":\"fd:/woss-node-1\",\"healthState\":\"Ok\",\"ipAddressOrFqdn\":\"woss-node-1\",\"isSeedNode\":true,\"nodeId\":\"c8e6bfe487b4b8eceb5dc36ff6a2452\",\"nodeName\":\"woss-node-1\",\"nodeStatus\":\"Up\",\"nodeType\":\"Common\",\"nodeUpTime\":\"PT1H\",\"upgradeDomain\":\"WOSS_U1\",\"runningInstanceUris\":[\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/tableserverinstances/woss-node-1\",\"subscriptions/serviceAdmin/resourcegroups/system/providers/Microsoft.Storage.Admin/farms/WEST_US_1/accountcontainerserverinstances/woss-node-1\"]}}]}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "Content-Length": [ + "8232" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "31998" + ], + "x-ms-request-id": [ + "WestUS_d9e73d2735f24797a08dda5d8228e509_635609224343322694" + ], + "x-ms-correlation-request-id": [ + "45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150302T194714Z:45888041-1ede-478b-949f-13aa6e47e0ba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-ListFarms": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestSetTableService.json b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestSetTableService.json new file mode 100644 index 000000000000..2d5a9cd4cb5f --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/SessionRecords/Microsoft.AzureStack.Commands.StorageAdmin.Test.ScenarioTests.TableServicesTests/TestSetTableService.json @@ -0,0 +1,62 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourcegroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49/tableservices/default?api-version=2015-12-01-preview", + "RequestMethod": "PATCH", + "RequestBody": "{\"properties\":{\"settings\":{\"frontEndCallbackThreadsCount\":1800,\"frontEndCpuBasedKeepAliveThrottlingEnabled\":true,\"frontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold\":100,\"frontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle\":10,\"frontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds\":20,\"frontEndMemoryThrottlingEnabled\":true}},\"tags\":{}}", + "RequestHeaders": { + "Accept": [ "application/json" ], + "User-Agent": [ "Microsoft.Azure.Insights.InsightsClient/0.9.0.0 AzurePowershell/v0.8.14" ], + "Content-Length": [ "1217" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Connection": [ "Keep-Alive" ], + "Expect": [ "100-continue" ] + }, + "ResponseBody": "{\"id\":\"/subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/Microsoft.Storage.Admin/farms/03768357-B4F2-4C3C-AA75-574209B03D49\",\"name\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"type\":\"Microsoft.Storage.Admin/farms\",\"location\":\"redmond\",\"properties\":{\"farmId\":\"82ba752f-0fac-47e2-8477-5731f9f5db34\",\"version\":\"2015-12-01-preview\",\"settingsStore\":\"file://172.17.145.159/SMB/Settings/ObjectStorageService/Settings\",\"healthStatus\":\"Unknown\",\"settings\":{\"settingsPollingIntervalInSecond\":90,\"hostStyleHttpPort\":80,\"hostStyleHttpsPort\":443,\"corsAllowedOriginsList\":\"http://manage.wossportal.com;http://www.example.com\",\"dataCenterUriHostSuffixes\":\"contoso.com\"}}}", + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Mon, 03 Mar 2015 00:07:07 GMT" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Content-Length": [ + "1612" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "47af504c-88a1-49c5-9766-e397d54e490b" + ], + "x-ms-correlation-request-id": [ + "e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "x-ms-routing-request-id": [ + "WESTUS:20150303T190828Z:e223e5fa-7d3c-4d2c-a2e9-aed3011aefb7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-SetTableService": [ + "" + ] + }, + "Variables": { + "SubscriptionId": "a93fb07c-6c93-40be-bf3b-4f0deba10f4b" + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config new file mode 100644 index 000000000000..e66b0eed3c46 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage.Tests/packages.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs new file mode 100644 index 000000000000..feb3bda45a9d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminCmdlet.cs @@ -0,0 +1,232 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using System.Net; +using System.Net.Security; +using Microsoft.Azure; +using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Admin cmdlet base + /// + public abstract class AdminCmdlet : AzureRMCmdlet, IDisposable + { + private bool disposed; + + /// + /// Storage Admin Management Client + /// + public StorageAdminManagementClient Client + { + get; + set; + } + + /// + /// Subscription identifier + /// + [Parameter(Position = 0, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string SubscriptionId { get; set; } + + /// + /// Authentication token + /// + [Parameter(Position = 1, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string Token { get; set; } + + /// + /// Azure package admin URL + /// + [Parameter(Position = 2, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + [ValidateAbsoluteUri] + public Uri AdminUri { get; set; } + + /// + /// Resource group name + /// + [Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string ResourceGroupName { get; set; } + + /// + /// Disable certification validation + /// + [Parameter] + public SwitchParameter SkipCertificateValidation { get; set; } + + ~AdminCmdlet() + { + Dispose(false); + } + + private RemoteCertificateValidationCallback originalValidateCallback; + + private static readonly RemoteCertificateValidationCallback unCheckCertificateValidation = (s, certificate, chain, sslPolicyErrors) => true; + + //TODO: take back the validation + private void ValidateParameters() + { + if (string.IsNullOrEmpty(Token)) + { + if (DefaultContext == null) + { + throw new ApplicationException(Resources.InvalidProfile); + } + } + else + { + // if token is specified, AdminUri is required as well. + if (AdminUri == null || SubscriptionId == null) + { + throw new ApplicationException(Resources.TokenAndAdminUriRequired); + } + } + } + + + /// + /// Initial StorageAdminManagementClient + /// + /// + protected override void BeginProcessing() + { + base.BeginProcessing(); + + originalValidateCallback = ServicePointManager.ServerCertificateValidationCallback; + + if (SkipCertificateValidation) + { + ServicePointManager.ServerCertificateValidationCallback = unCheckCertificateValidation; + } + + ValidateParameters(); + + Client = GetClient(); + } + + protected override AzureContext DefaultContext + { + get + { + if (DefaultProfile == null) + { + return null; + } + + return DefaultProfile.Context; + } + } + + /// + /// Dispose StorageAdminManagementClient + /// + /// + protected override void EndProcessing() + { + StorageAdminManagementClient client = Client; + if (client != null) + { + client.Dispose(); + } + Client = null; + if (SkipCertificateValidation) + { + if (originalValidateCallback != null) + { + ServicePointManager.ServerCertificateValidationCallback = originalValidateCallback; + } + } + + base.EndProcessing(); + } + + protected override void ProcessRecord() + { + Execute(); + base.ProcessRecord(); + } + + protected virtual void Execute() + { + } + + /// + /// Get token credentials + /// + /// + protected TokenCloudCredentials GetTokenCredentials() + { + return new TokenCloudCredentials(SubscriptionId, Token); + } + + /// + /// Dispose the resources + /// + /// Indicates whether the managed resources should be disposed or not + protected override void Dispose(bool disposing) + { + if (!disposed) + { + if (Client != null) + { + Client.Dispose(); + Client = null; + } + + disposed = true; + } + base.Dispose(disposing); + } + + protected StorageAdminManagementClient GetClient() + { + // get client from azure session if token is null or empty + if (string.IsNullOrEmpty(Token)) + { + return GetClientThruAzureSession(); + } + + return new StorageAdminManagementClient( + baseUri: AdminUri, + credentials: new TokenCloudCredentials(subscriptionId: SubscriptionId, token: Token)); + } + + private StorageAdminManagementClient GetClientThruAzureSession() + { + var context = DefaultContext; + + var armUri = context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager); + + var credentials = AzureSession.AuthenticationFactory.GetSubscriptionCloudCredentials(context); + + if (string.IsNullOrEmpty(SubscriptionId)) + { + SubscriptionId = credentials.SubscriptionId; + } + + return AzureSession.ClientFactory.CreateCustomClient(credentials, armUri); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminException.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminException.cs new file mode 100644 index 000000000000..8c2a0f7610f4 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminException.cs @@ -0,0 +1,40 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Exception for admin operation errors + /// + public sealed class AdminException : Exception + { + /// + /// Constructor + /// + /// + public AdminException(string message) + : base(message) { } + + /// + /// Constructor + /// + /// + /// + public AdminException(string message, Exception innerException) + : base(message, innerException) { } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricCmdLet.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricCmdLet.cs new file mode 100644 index 000000000000..41d354d0e4c1 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricCmdLet.cs @@ -0,0 +1,81 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + public abstract class AdminMetricCmdlet: AdminCmdlet + { + /// + /// Gets or sets the timegrain parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public TimeGrain TimeGrain { get; set; } + + /// + /// Gets or sets the starttime parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + public DateTime StartTime { get; set; } + + /// + /// Gets or sets the endtime parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + public DateTime EndTime { get; set; } + + /// + /// Gets or sets the metricnames parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string[] MetricNames { get; set; } + + /// + /// Gets or sets the detailedoutput parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + public SwitchParameter DetailedOutput { get; set; } + + + /// + /// Get Metrics result + /// + /// + /// + protected abstract MetricsResult GetMetricsResult(string filter); + + /// + /// + /// + protected override void Execute() + { + string filter = Tools.GenerateFilter(MetricNames, StartTime, EndTime, TimeGrain); + bool fullDetails = this.DetailedOutput.IsPresent; + + MetricsResult metrics = GetMetricsResult(filter); + var result = metrics.Metrics.Select(_ => fullDetails ? new PSMetric(_) : new PSMetricNoDetails(_)); + WriteObject(result, true); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricDefinitionCmdlet.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricDefinitionCmdlet.cs new file mode 100644 index 000000000000..f06e02baec1e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/AdminMetricDefinitionCmdlet.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + public abstract class AdminMetricDefinitionCmdlet : AdminCmdlet + { + /// + /// Gets or sets the metricnames parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string[] MetricNames { get; set; } + + /// + /// Gets or sets the detailedoutput parameter of the cmdlet + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true)] + public SwitchParameter DetailedOutput { get; set; } + + /// + /// Get Metrics definition result + /// + /// + /// + protected abstract MetricDefinitionsResult GetMetricDefinitionsResult(string filter); + + /// + /// + /// + protected override void Execute() + { + string filter = Tools.GenerateFilter(MetricNames); + bool fullDetails = this.DetailedOutput.IsPresent; + + MetricDefinitionsResult definitions = GetMetricDefinitionsResult(filter); + var result = definitions.Value.Select(_ => fullDetails ? new PSMetricDefinition(_) : new PSMetricDefinitionNoDetails(_)); + WriteObject(result); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/BaseCmdlet.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/BaseCmdlet.cs new file mode 100644 index 000000000000..8f97ba9aad29 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/BaseCmdlet.cs @@ -0,0 +1,117 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + public abstract class BaseCmdlet : PSCmdlet + { + /// + /// Gets or sets the progress record. + /// + protected ProgressRecord ProgressRecord { get; set; } + + // TODO: progress handler when necessary + //protected void ProgressHandler(object sender, ProgressEventArgs e) + //{ + //} + + /// + /// Gets the name of the cmdlet + /// + protected string CmdletName + { + get + { + return MyInvocation.MyCommand.Name; + } + } + + /// + /// Process record for this cmdlet. + /// + /// + /// We will catch all exceptions here so we can log them in our event provider. + /// + protected override void ProcessRecord() + { + Execute(); + } + + /// + /// Execute this cmdlet. + /// + /// + /// Descendant classes must override this methods instead of Cmdlet.ProcessRecord, so + /// we can have a unique place where log all errors. + /// + protected abstract void Execute(); + + /// + /// Send an error event to the current event source + /// + /// The operation + /// The message + /// The exception + protected abstract void TraceError(string operation, string message, Exception exception); + + /// + /// Send a warning event to the current event source + /// + /// The operation + /// The message + protected abstract void TraceWarning(string operation, string message); + + /// + /// Send an informational event to the current event source + /// + /// The operation + /// The message + protected abstract void TraceInformational(string operation, string message); + + /// + /// Send a verbose event to the current event source + /// + /// The operation. + /// The message. + protected abstract void TraceVerbose(string operation, string message); + + /// + /// Override the WriteError method to log the error on our event provider. + /// + /// The error to write + public new void WriteError(ErrorRecord errorRecord) + { + if (errorRecord == null) + throw new ArgumentNullException("errorRecord"); + base.WriteError(errorRecord); + TraceError(CmdletName, errorRecord.Exception.Message, errorRecord.Exception); + } + + /// + /// Override the WriteWarning method to log the warning on our event provider. + /// + /// The text to write + public new void WriteWarning(string text) + { + base.WriteWarning(text); + TraceWarning(CmdletName, text); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj new file mode 100644 index 000000000000..8f5a235bba32 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Commands.AzureStackStorage.csproj @@ -0,0 +1,237 @@ + + + + + Debug + AnyCPU + {D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791} + Library + Properties + Microsoft.AzureStack.Commands.StorageAdmin + Microsoft.AzureStack.Commands.StorageAdmin + v4.5 + 512 + ..\..\..\ + true + /assemblyCompareMode:StrongNameIgnoringVersion + + + true + full + false + ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.AzureStackStorage\ + DEBUG;TRACE + prompt + 4 + true + false + true + + + ..\..\..\Package\Release\ResourceManager\AzureResourceManager\AzureRM.AzureStackStorage\ + TRACE;SIGN + true + pdbonly + AnyCPU + bin\Release\Microsoft.AzureStack.Commands.StorageAdmin.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + MinimumRecommendedRules.ruleset + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules + true + true + MSSharedLibKey.snk + true + false + + + + False + ..\..\..\packages\Hyak.Common.1.0.3\lib\portable-net403+win+wpa81\Hyak.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.6.1-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + True + + + False + ..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + + False + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.14-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + False + ..\..\..\packages\Microsoft.AzureStack.Management.Storage.0.9.2-preview\lib\net45\Microsoft.AzureStack.Management.Storage.dll + + + False + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll + + + False + ..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll + + + False + ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + True + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.1.8.2\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.0.11.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll + True + + + ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll + + + False + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + + + + + + + + + False + ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AzureRM.AzureStackStorage.psd1 + PreserveNewest + + + + Designer + + + + + + + + Always + Designer + + + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} + Commands.ResourceManager.Common + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Enums.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Enums.cs new file mode 100644 index 000000000000..2fc0dea2b3ab --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Enums.cs @@ -0,0 +1,77 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands.StorageAdmin +{ + public enum TimeGrain + { + Daily = 0, + Hourly, + Minutely + } + + /// + /// + /// + public enum RoleType + { + /// + /// + /// + TableServer, + + /// + /// + /// + BlobServer, + + /// + /// + /// + TableMaster, + + /// + /// + /// + AccountContainerserver, + + /// + /// + /// + TableFrontend, + + /// + /// + /// + BlobFrontend, + + /// + /// + /// + MetricsServer, + + /// + /// + /// + HealthMonitoringserver + } + + public enum StorageAccountSearchFilterParameter + { + TenantSubscriptionId, + PartialAccountName, + StorageAccountStatus, + VersionedAccountName + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Extensions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Extensions.cs new file mode 100644 index 000000000000..a24df9aa8ba6 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Extensions.cs @@ -0,0 +1,88 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal static class Extensions + { + public static string FormatInvariantCulture(this string format, params object[] arg0) + { + return string.Format(CultureInfo.InvariantCulture, format, arg0); + } + + /// + /// A string representation of the list of MetricAvailability objects including indentation + /// + /// The list of MetricAvailability objects + /// The number of tabs to insert in front of each member + /// A string representation of the list of MetricAvailability objects including indentation + public static string ToString(this IList metricAvailabilities, int indentationTabs) + { + StringBuilder output = new StringBuilder(); + foreach (var metricAvailability in metricAvailabilities) + { + output.AppendLine(); + output.AddSpacesInFront(indentationTabs).AppendLine("Retention : " + metricAvailability.Retention); + output.AddSpacesInFront(indentationTabs).Append("Values : " + metricAvailability.TimeGrain); + } + + return output.ToString(); + } + + /// + /// A string representation of the list of PSMetricValue objects including indentation + /// + /// The list of PSMetricValue objects + /// The number of tabs to insert in front of each member + /// A string representation of the list of PSMetricValue objects including indentation + public static string ToString(this IList metricValues, int indentationTabs) + { + StringBuilder output = new StringBuilder(); + foreach (var metricValue in metricValues) + { + output.AppendLine(); + output.AddSpacesInFront(indentationTabs).AppendLine("Average : " + metricValue.Average); + output.AddSpacesInFront(indentationTabs).AppendLine("Count : " + metricValue.Count); + output.AddSpacesInFront(indentationTabs).AppendLine("Maximum : " + metricValue.Maximum); + output.AddSpacesInFront(indentationTabs).AppendLine("Minimum : " + metricValue.Minimum); + output.AddSpacesInFront(indentationTabs).AppendLine("Properties : " + metricValue.Properties); + output.AddSpacesInFront(indentationTabs).AppendLine("Timestamp : " + metricValue.TimeStamp); + output.AddSpacesInFront(indentationTabs).Append("Total : " + metricValue.Total); + } + return output.ToString(); + } + + /// + /// Add spaces into the string builder + /// + /// The string builder + /// The number of tab chars to insert + /// The input string builder with the tabs appended + public static StringBuilder AddSpacesInFront(this StringBuilder output, int indentationTabs) + { + for (int i = 0; i < indentationTabs; i++) + { + output.Append('\t'); + } + + return output; + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm.cs new file mode 100644 index 000000000000..0efb92b578d9 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm.cs @@ -0,0 +1,73 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Add-Farm [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-SettingAccessString] {string} [-Region] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Add, Nouns.AdminFarm, SupportsShouldProcess = true)] + public sealed class AddAdminFarm : AdminCmdlet + { + const string ShouldProcessTargetFormat = "farm {0} "; + + /// + /// Farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// setting access string. ex: file:\\localhost\db1\settings + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNull] + public string SettingAccessString { get; set; } + + /// + /// Location of the farm + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string Location{ get; set; } + + protected override void Execute() + { + if (ShouldProcess(string.Format(CultureInfo.InvariantCulture, ShouldProcessTargetFormat, FarmName))){ + FarmCreateParameters request = new FarmCreateParameters + { + Location = Location, + + Properties = new FarmCreate + { + SettingAccessString = SettingAccessString + } + }; + + FarmGetResponse response = Client.Farms.Create(ResourceGroupName, FarmName, request); + + WriteObject(new FarmResponse(response.Farm)); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm_new.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm_new.cs new file mode 100644 index 000000000000..465016f78c4e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/AddFarm_new.cs @@ -0,0 +1,87 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Add-Farm [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-SettingAccessString] {string} [-Region] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Add, Nouns.AdminFarm, SupportsShouldProcess = true)] + public sealed class AddAdminFarm : AdminCmdlet + { + const string ShouldProcessTargetFormat = "farm {0} "; + + /// + /// Farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// setting access string. ex: file:\\localhost\db1\settings + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNull] + public string SettingAccessString { get; set; } + + /// + /// Location of the farm + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string Location{ get; set; } + + protected override void Execute() + { + if (ShouldProcess(string.Format(CultureInfo.InvariantCulture, ShouldProcessTargetFormat, FarmName))){ + FarmCreateParameters request = new FarmCreateParameters + { + Location = Location, + + Properties = new FarmCreate + { + SettingAccessString = SettingAccessString + } + }; + + FarmGetResponse response = Client.Farms.Create(ResourceGroupName, FarmName, request); + + WriteObject(response); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEvent.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEvent.cs new file mode 100644 index 000000000000..9dd647198b0f --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEvent.cs @@ -0,0 +1,151 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Parameter Set: EventWithFilter + /// Get-Event [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} -ResourceGroupName {string} + /// [-SkipCertificateValidation] -FarmName {string} -StartTime {DateTime} -EndTime {DateTime} [-NodeName {string}] + /// [-ResourceUri {string}] [-ProviderGuid {Guid}] -EventIds {int[]} [{CommonParameters}] + /// + /// Parameter Set: EventWithLocation + /// Get-Event [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} -EventQuery {EventQuery} + /// [{CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFarmEvent, DefaultParameterSetName = EventWithFilterSet)] + public sealed class GetEvent : AdminCmdlet + { + const string EventWithFilterSet = "EventWithFilter"; + + const string EventWithLocationSet = "EventWithLocation"; + + Action func; + + /// + /// + /// + [Parameter(Mandatory = true, ParameterSetName = EventWithFilterSet)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = true, ParameterSetName = EventWithFilterSet)] + public DateTime StartTime + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = true, ParameterSetName = EventWithFilterSet)] + public DateTime EndTime + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, ParameterSetName = EventWithFilterSet)] + public String NodeName + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, ParameterSetName = EventWithFilterSet)] + public String ResourceUri + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, ParameterSetName = EventWithFilterSet)] + public Guid ProviderGuid + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, ParameterSetName = EventWithFilterSet)] + public int[] EventId + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = EventWithLocationSet)] + public EventQuery EventQuery + { + get; + set; + } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + switch (ParameterSetName) + { + case EventWithFilterSet: + { + func = () => WriteObject( + Client.Farms.ExecuteEventQuery(ResourceGroupName, FarmName, StartTime, EndTime, NodeName, ResourceUri, ProviderGuid, EventId)); + } + break; + case EventWithLocationSet: + { + func = () => WriteObject( + Client.Farms.ExecuteEventQuery(EventQuery), + true); + } + break; + default: + throw new ArgumentException(Resources.BadParameterSet); + } + } + + protected override void Execute() + { + func(); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEventQuery.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEventQuery.cs new file mode 100644 index 000000000000..5d3ac6864e6b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetEventQuery.cs @@ -0,0 +1,142 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-EventQuery [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-StartTime] {DateTime} [-EndTime] {DateTime} [[-NodeName] {string}] + /// [[-ResourceUri] {string}] [[-ProviderGuid] {Guid}] [[-EventIds] {int[]}] [{CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFarmEventQuery)] + public sealed class GetEventQuery : AdminCmdlet + { + /// + /// + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = true, Position = 5)] + public DateTime StartTime + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = true, Position = 6)] + public DateTime EndTime + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, Position = 7)] + public string NodeName + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, Position = 8)] + public string ResourceUri + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, Position = 9)] + public Guid? ProviderGuid + { + get; + set; + } + + /// + /// + /// + [Parameter(Mandatory = false, Position = 10)] + public int[] EventId + { + get; + set; + } + + protected override void Execute() + { + List filterList = new List(); + filterList.Add(string.Format(CultureInfo.InvariantCulture, "startTime eq '{0:O}'", StartTime.ToUniversalTime())); + filterList.Add(string.Format(CultureInfo.InvariantCulture, "endTime eq '{0:O}'", EndTime.ToUniversalTime())); + if (!string.IsNullOrEmpty(NodeName)) + { + filterList.Add(string.Format(CultureInfo.InvariantCulture, "computerName eq '{0}'", NodeName)); + } + if (!string.IsNullOrEmpty(ResourceUri)) + { + filterList.Add(string.Format(CultureInfo.InvariantCulture, "resourceUri eq '{0}'", ResourceUri)); + } + if (ProviderGuid != null) + { + filterList.Add(string.Format(CultureInfo.InvariantCulture, "providerId eq '{0}'", ProviderGuid)); + } + if (EventId != null) + { + List eventIdFilters = new List(); + foreach (var eventId in EventId) + { + eventIdFilters.Add(string.Format(CultureInfo.InvariantCulture, "eventId eq '{0}'", eventId)); + } + if (eventIdFilters.Any()) + { + string eventIdFilter = eventIdFilters.Aggregate((current, next) => string.Format(CultureInfo.InvariantCulture, "{0} or {1}", current, next)); + filterList.Add(string.Format(CultureInfo.InvariantCulture, "({0})", eventIdFilter)); + } + } + string filter = filterList.Aggregate((current, next) => string.Format(CultureInfo.InvariantCulture, "{0} and {1}", current, next)); + + EventQuery eventQuery = Client.Farms.GetEventQuery(ResourceGroupName, FarmName, filter); + WriteObject(eventQuery, true); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarm.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarm.cs new file mode 100644 index 000000000000..d36d4448dac5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarm.cs @@ -0,0 +1,58 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-Farm [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [[-FarmName] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFarm)] + public sealed class GetAdminFarm : AdminCmdlet + { + /// + /// Farm identifier + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName + { + get; + set; + } + + protected override void Execute() + { + if (string.IsNullOrEmpty(FarmName) == false) + { + FarmGetResponse response = Client.Farms.Get(ResourceGroupName, FarmName); + WriteObject(new FarmResponse(response.Farm)); + } + else + { + FarmListResponse response = Client.Farms.List(ResourceGroupName); + + WriteObject(response.Farms.Select(_=>new FarmResponse(_)), true); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetricDefinitions.cs new file mode 100644 index 000000000000..e40211a0e751 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetricDefinitions.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFarmMetricDefinition)] + public sealed class GetFarmMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.Farms.GetMetricDefinitions(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetrics.cs new file mode 100644 index 000000000000..aa8739be268d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/GetFarmMetrics.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFarmMetric)] + public sealed class GetFarmMetric : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.Farms.GetMetrics(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/InvokeLogCollect.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/InvokeLogCollect.cs new file mode 100644 index 000000000000..41512eda09a8 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/InvokeLogCollect.cs @@ -0,0 +1,144 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using System.Runtime.InteropServices; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsData.Export, Nouns.Log, SupportsShouldProcess = true)] + public sealed class InvokeLogCollect : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string FarmName { get; set; } + + /// + /// StartTime + /// + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public DateTime StartTime { get; set; } + + /// + /// + /// + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public DateTime EndTime { get; set; } + + /// + /// Credential to run the log copy + /// + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCredential Credential { get; set; } + + /// + /// Blob Prefix for the uploaded logs + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string LogPrefix { get; set; } + + /// + /// Azure blob name + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string AzureStorageContainer { get; set; } + + /// + /// Azure Storage account name + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string AzureStorageAccountName { get; set; } + + /// + /// Azure storage account key + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string AzureStorageAccountKey { get; set; } + + /// + /// Azure SAS Token + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string AzureSasToken { get; set; } + + /// + /// Target Share folder to save logs + /// + [Parameter(Mandatory = false)] + [ValidateNotNullOrEmpty] + public string TargetShareFolder { get; set; } + + protected override void Execute() + { + IntPtr valuePtr = IntPtr.Zero; + string password; + try + { + valuePtr = Marshal.SecureStringToGlobalAllocUnicode(Credential.Password); + password = Marshal.PtrToStringUni(valuePtr); + } + finally + { + Marshal.ZeroFreeGlobalAllocUnicode(valuePtr); + } + + LogCollectParameters parameters = new LogCollectParameters + { + AzureBlobContainer = AzureStorageContainer, + AzureSasToken = AzureSasToken, + AzureStorageAccountKey = AzureStorageAccountKey, + AzureStorageAccountName = AzureStorageAccountName, + EndTime = EndTime, + StartTime = StartTime, + LogPrefix = LogPrefix, + UserName = Credential.UserName, + PlainPassword = password, + TargetShareFolder = TargetShareFolder + }; + + var logCollectTask = Client.Farms.CollectLogAsync(ResourceGroupName, FarmName, parameters); + + WriteVerbose("Sending request to start a log Collect job, it will take some time..."); + + var response = logCollectTask.Result; + + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, Resources.OperationFailedErrorMessage, response.StatusCode)); + } + + WriteObject(response); + } + } +} + diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/SetFarm.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/SetFarm.cs new file mode 100644 index 000000000000..35b12db7deb7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Farm/SetFarm.cs @@ -0,0 +1,97 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Set-Farm [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [[-SettingPollingIntervalInSeconds] {int}] [-FarmName] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Set, Nouns.AdminFarm, SupportsShouldProcess = true)] + public sealed class SetAdminFarm : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// + /// + [Parameter] + [SettingField] + public int? SettingsPollingIntervalInSecond { get; set; } + + /// + /// + /// + [Parameter] + [SettingField] + public int? HostStyleHttpPort { get; set; } + + /// + /// + /// + [Parameter] + [SettingField] + public int? HostStyleHttpsPort { get; set; } + + /// + /// + /// + [Parameter] + [SettingField] + public string CorsAllowedOriginsList { get; set; } + + /// + [Parameter] + [SettingField] + public string DataCenterUriHostSuffixes { get; set; } + + protected override void Execute() + { + string confirmString; + FarmSettings settings = Tools.ToSettingsObject(this, out confirmString); + + if (ShouldProcess( + Resources.SetFarmDescription.FormatInvariantCulture(FarmName, confirmString), + Resources.SetFarmWarning.FormatInvariantCulture(FarmName, confirmString), + Resources.ShouldProcessCaption)) + { + + FarmUpdateParameters parameters = new FarmUpdateParameters + { + Farm = new FarmBase {Settings = settings} + }; + + FarmGetResponse response = Client.Farms.Update(ResourceGroupName, FarmName, parameters); + + WriteObject(new FarmResponse(response.Farm)); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/GetFault.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/GetFault.cs new file mode 100644 index 000000000000..5ce56681d2cf --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/GetFault.cs @@ -0,0 +1,151 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// get faults + /// + /// SYNTAX + /// Parameter Set: GetFault + /// Get-Fault [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} -FaultId {string} [ {CommonParameters}] + /// + /// Parameter Set: GetCurrentFault + /// Get-Fault [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-ResourceUri {string}] [ {CommonParameters}] + /// + /// Parameter Set: GetHistoryFault + /// Get-Fault [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} -StartTime {DateTime} -EndTime {DateTime} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminFault, DefaultParameterSetName = GetCurrentFaultSet)] + public sealed class GetFault : AdminCmdlet + { + + const string GetCurrentFaultSet = "GetCurrentFault"; + const string GetHistoryFaultSet = "GetHistoryFault"; + const string GetFaultSet = "GetFault"; + Action func; + + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// Fault Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = GetFaultSet)] + [ValidateNotNull] + public string FaultId + { + get; + set; + } + + /// + /// Resource Uri + /// + [Alias("Id")] + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = GetCurrentFaultSet)] + [ValidateNotNull] + public string ResourceUri + { + get; + set; + } + + /// + /// Query Fault StartTime + /// + [Parameter(Mandatory = true, ParameterSetName = GetHistoryFaultSet)] + [ValidateNotNull] + public DateTime StartTime + { + get; + set; + } + + /// + /// Query Fault EndTime + /// + [Parameter(Mandatory = true, ParameterSetName = GetHistoryFaultSet)] + [ValidateNotNull] + public DateTime EndTime + { + get; + set; + } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + + switch (ParameterSetName) + { + case GetFaultSet: + { + func = () => + { + FaultGetResponse fault = Client.Faults.Get(ResourceGroupName, FarmName, FaultId); + WriteObject(new FaultResponse(fault.Fault)); + }; + } + break; + case GetHistoryFaultSet: + { + func = () => + { + FaultListResponse faults = Client.Faults.ListHistoryFaults(ResourceGroupName, FarmName, + StartTime.ToString("O", CultureInfo.InvariantCulture), + EndTime.ToString("O", CultureInfo.InvariantCulture)); + WriteObject(faults.Select(_ => new FaultResponse(_)), true); + }; + } + break; + case GetCurrentFaultSet: + { + func = () => + { + FaultListResponse faults = Client.Faults.ListCurrentFaults(ResourceGroupName, FarmName, ResourceUri); + WriteObject(faults.Faults.Select(_=>new FaultResponse(_)), true); + }; + } + break; + default: + throw new ArgumentException("Bad GetFault parameter set"); + } + } + + protected override void Execute() + { + func(); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/ResolveFault.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/ResolveFault.cs new file mode 100644 index 000000000000..985f8ac3bdba --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Fault/ResolveFault.cs @@ -0,0 +1,76 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// dismiss faults + /// + /// SYNTAX + /// Resolve-Fault [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-FaultId] {string} [-Force] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsDiagnostic.Resolve, Nouns.AdminFault, SupportsShouldProcess = true)] + public sealed class ResolveFault : AdminCmdlet + { + const string ShouldProcessTargetFormat = "fault {0} "; + const string ShouldContinueQuery = "Continue with resolve fault?"; + const string ShouldContinueCaption = "Confirm"; + + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// Fault Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNull] + public string FaultId + { + get; + set; + } + + [Parameter] + public SwitchParameter Force + { + get; + set; + } + + protected override void Execute() + { + if (ShouldProcess(string.Format(CultureInfo.InvariantCulture, ShouldProcessTargetFormat, FaultId)) && + (Force || ShouldContinue(ShouldContinueQuery,ShouldContinueCaption))) + { + Client.Faults.Dismiss(ResourceGroupName, FarmName, FaultId); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/MSSharedLibKey.snk b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/MSSharedLibKey.snk new file mode 100644 index 000000000000..695f1b38774e Binary files /dev/null and b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/MSSharedLibKey.snk differ diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Microsoft.AzureStack.Commands.StorageAdmin.dll-Help.xml b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Microsoft.AzureStack.Commands.StorageAdmin.dll-Help.xml new file mode 100644 index 000000000000..31b7aa1f5362 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Microsoft.AzureStack.Commands.StorageAdmin.dll-Help.xml @@ -0,0 +1,10970 @@ + + + + + Add-ACSFarm + + Register a new provisioned ACS farm. + + + + + Add + ACSFarm + + + + After fabric admin deploy a new ACS farm. Service Admin could use the cmdlet to registered that farm to SRP. + + + + Add-ACSFarm + + FarmName + + + + String + + + SettingAccessString + + + + String + + + Location + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SettingAccessString + + + + String + + String + + + + + + Location + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +Add-ACSFarm -ResourceGroupName $resourceGroup -FarmName 'YourNameFarmName' -Location 'YourLocation' + + + + + + + + + + + + + + + + + + + + + + Disable-ACSNode + + Disable a particular node from service fabric cluster. + + + + + Disable + ACSNode + + + + Disable a particular node from service fabric cluster. After disable, service fabric instances will be moved to other nodes. + + + + Disable-ACSNode + + FarmName + + + + String + + + NodeName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + NodeName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +Disable-ACSNode -ResourceGroupName $resourceGroup -NodeName 'YourNodeName' + + + + + + + + + + + + + + + + + + + + + + Enable-ACSNode + + Enable a particular node in the service fabric cluster. + + + + + Enable + ACSNode + + + + Enable a particular node in the service fabric cluster. After enabing the node, service instances can be initantiated to this node. + + + + Enable-ACSNode + + FarmName + + + + String + + + NodeName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + NodeName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +Eable-ACSNode -ResourceGroupName $resourceGroup -NodeName 'YourNodeName' + + + + + + + + + + + + + + + + + + + + + + Get-ACSBlobService + + Retrieve the status and settings of blob service + + + + + Get + ACSBlobService + + + + Retrieve the status and settings of blob service + + + + Get-ACSBlobService + + FarmName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSBlobService -ResourceGroupName $resourceGroup -FarmName $farm.Name | fl + + + + + + + + + + + + + + + + + + + + + + + Get-ACSBlobServiceMetric + + Retrieve the metrics of blob service + + + + + Get + ACSBlobServiceMetric + + + + Retrieve the metrics of blob service + + + + Get-ACSBlobServiceMetric + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSBlobServiceMetricDefinition + + Retrieve the metric definitions of blob service + + + + + Get + ACSBlobServiceMetricDefinition + + + + Retrieve the metric definitions of blob service + + + + Get-ACSBlobServiceMetricDefinition + + FarmName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSEventQuery + + Returns a query object, which could be used as the input parameter for Get-ACSEvent. + + + + + Get + ACSEventQuery + + + + This cmdlet returns a ACSEventQuery object. Then the ACSEventQuery object can be used to query events from Azure-consistent Storage system. + + + + Get-ACSEventQuery + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + Node + + + + String + + + ResourceUri + + + + String + + + ProviderGuid + + + + Nullable`1[Guid] + + + EventId + + + + Int32[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + Node + + + + String + + String + + + + + + ResourceUri + + + + String + + String + + + + + + ProviderGuid + + + + Nullable`1[Guid] + + Nullable`1[Guid] + + + + + + EventId + + + + Int32[] + + Int32[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +$endtime=get-date +$starttime=$endtime.addminutes(-10) + +Get-ACSEventQuery -FarmId $farm.Name -ResourceGroupName $resourceGroup -StartTime $starttime + -EndTime $endtime + + + + + + + + + + + + + + + + + + + + + + Get-ACSEvents + + List the events in the Azure Consistent Storage system. + + + + + Get + ACSEvents + + + + This cmdlet returns a list of event objects. You could specify query parameters: start time, end time, computer name, resource uri, provider guid, event id. You can also compose an event query with Get-ACSEventQuery cmdlet. + + + + Get-ACSEvents + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + Node + + + + String + + + ResourceUri + + + + String + + + ProviderGuid + + + + Guid + + + EventId + + + + Int32[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + Get-ACSEvents + + EventQuery + + + + EventQuery + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + Node + + + + String + + String + + + + + + ResourceUri + + + + String + + String + + + + + + ProviderGuid + + + + Guid + + Guid + + + + + + EventId + + + + Int32[] + + Int32[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + EventQuery + + + + EventQuery + + EventQuery + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSEvents -startTime $startTime -endtime $endtime -FarmName $farm -ResourceGroupName $resourceGroup + + + + + + + + + + + + + + + + + + + + + + Get-ACSFarm + + Retrieve the Azure-consistent Storage Farm and its properties and settings. + + + + + Get + ACSFarm + + + + Retrieve the Azure-consistent Storage Farm and its properties and settings. + + + + Get-ACSFarm + + FarmName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +Get-ACSFarm -ResourceGroupName $resourceGroup + + + + + + + + + + + + + + + + + + + + + + Get-ACSFarmMetric + + Retrieve the metrics of ACS farm + + + + + Get + ACSFarmMetric + + + + Retrieve the metrics of ACS farm + + + + Get-ACSFarmMetric + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSFarmMetricDefinition + + Retrieve the metric definitions of ACS farm + + + + + Get + ACSFarmMetricDefinition + + + + Retrieve the metric definitions of ACS farm + + + + Get-ACSFarmMetricDefinition + + FarmName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSFault + + List faults in the Azure Consistent Storage system. + + + + + Get + ACSFault + + + + This cmdlet returns a list of faults in the Azure-consistent Storage system. It supports several parameter set: +The default parameter set is GetCurrentFaults, which returns a list of current active fault objects. If ResourceUri is specified, the cmdlet returns a list of current active fault objects on this resource. +GetHistoryFaults returns a list of active fault objects within specified time range. +GetFault returns one fault object with the specified fault ID. + + + + Get-ACSFault + + FarmName + + + + String + + + ResourceUri + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + Get-ACSFault + + FarmName + + + + String + + + FaultId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + Get-ACSFault + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + ResourceUri + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + FaultId + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FaultResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSFault -ResourceGroupName $resourceGroup -FarmName $farm.Name + + + + + + + + + + + + + + + + + + + + + + + Get-ACSManagementService + + Retrieve running status and settings of management service. + + + + + Get + ACSManagementService + + + + Retrieve running status and settings of management service. + + + + Get-ACSManagementService + + FarmName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.ManagementServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSManagementService -ResourceGroupName $resourceGroup -FarmName $farm.Name | fl + + + + + + + + + + + + + + + + + + + + + + Get-ACSManagementServiceMetric + + Retrieve the metrics of management service + + + + + Get + ACSManagementServiceMetric + + + + Retrieve the metrics of management service + + + + Get-ACSManagementServiceMetric + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSManagementServiceMetricDefinition + + Retrieve the metric definitions of management service + + + + + Get + ACSManagementServiceMetricDefinition + + + + Retrieve the metric definitions of management service + + + + Get-ACSManagementServiceMetricDefinition + + FarmName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSNode + + Get a list of nodes in Azure Consistent Storage. + + + + + Get + ACSNode + + + + Get a list of nodes in Azure Consistent Storage. A node could be of either Blob Server type and Service Fabric Node type. + + + + Get-ACSNode + + FarmName + + + + String + + + NodeName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + NodeName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSNode -ResourceGroupName $resourceGroup -FarmName $farm.Name + + + + + + + + + + + + + + + + + + + + + + Get-ACSNodeMetric + + Retrieve the metrics of a node + + + + + Get + ACSNodeMetric + + + + Retrieve the metrics of a node + + + + Get-ACSNodeMetric + + FarmName + + + + String + + + NodeName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + NodeName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSNodeMetricDefinition + + Retrieve the metric definitions of node + + + + + Get + ACSNodeMetricDefinition + + + + Retrieve the metric definitions of node + + + + Get-ACSNodeMetricDefinition + + FarmName + + + + String + + + NodeName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + NodeName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.NodeResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSRoleInstance + + Get a list of a specific type of role instances. + + + + + Get + ACSRoleInstance + + + + Get a list of a specific type of role instances, including TableServer | BlobServer | TableMaster | AccountContainerserver | TableFrontend | BlobFrontend | MetricsServer | HealthMonitoringserver. + + + + Get-ACSRoleInstance + + FarmName + + + + String + + + RoleType + + + + RoleType + + + InstanceId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + RoleType + + + + RoleType + + RoleType + + + + + + InstanceId + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobFrontendRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableFrontendInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.MonitoringServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.MetricsServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableMasterRoleInstanceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSRoleInstance -ResourceGroupName $resourceGroup -FarmId $farm.Name -RoleType BlobFrontend + + + + + + + + + + + + + + + + -------------------------- Example 2 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSRoleInstance -ResourceGroupName $resourceGroup -FarmId $farm.Name -RoleType BlobFrontend + + + + + + + + + + + + + + + + + + + + + + Get-ACSRoleInstanceMetric + + Retrieve the metrics of a role instance + + + + + Get + ACSRoleInstanceMetric + + + + Retrieve the metrics of a role instance + + + + Get-ACSRoleInstanceMetric + + FarmName + + + + String + + + RoleType + + + + RoleType + + + InstanceId + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + RoleType + + + + RoleType + + RoleType + + + + + + InstanceId + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSRoleInstanceMetricDefinition + + Retrieve the metric definitions of role instance + + + + + Get + ACSRoleInstanceMetricDefinition + + + + Retrieve the metric definitions of role instance + + + + Get-ACSRoleInstanceMetricDefinition + + FarmName + + + + String + + + RoleType + + + + RoleType + + + InstanceId + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + RoleType + + + + RoleType + + RoleType + + + + + + InstanceId + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSShare + + Get list of SMB shares used in the Azure Consistent Storage system. + + + + + Get + ACSShare + + + + Get list of SMB shares used in the Azure Consistent Storage system. + + + + Get-ACSShare + + FarmName + + + + String + + + ShareName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + ShareName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.ShareResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSShare -ResourceGroupName $resourceGroup -FarmName $farm.Name -ShareName 'YourShareName' + + + + + + + + + + + + + + + + + + + + + + Get-ACSShareMetric + + Retrieve the metrics of a share + + + + + Get + ACSShareMetric + + + + Retrieve the metrics of a share + + + + Get-ACSShareMetric + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + ShareName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + ShareName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSShareMetricDefinition + + Retrieve the metric definitions of share + + + + + Get + ACSShareMetricDefinition + + + + Retrieve the metric definitions of share + + + + Get-ACSShareMetricDefinition + + FarmName + + + + String + + + ShareName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + ShareName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSStorageAccount + + Retrieve a list of the tenant storage accounts based on the tenant subscription ID, account name (or part of the account name) , account status or based on a account ID. + + + + + Get + ACSStorageAccount + + + + Retrieve a list of the tenant storage accounts based on the tenant subscription ID, account name (or part of the account name) , account status or based on a account ID. + + + + Get-ACSStorageAccount + + FarmName + + + + String + + + TenantSubscriptionId + + + + String + + + PartialAccountName + + + + String + + + StorageAccountStatus + + + + Nullable`1[Int32] + + + Detail + + + + SwitchParameter + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + Get-ACSStorageAccount + + FarmName + + + + String + + + AccountId + + + + Int64 + + + Detail + + + + SwitchParameter + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + TenantSubscriptionId + + + + String + + String + + + + + + PartialAccountName + + + + String + + String + + + + + + StorageAccountStatus + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + Detail + + + + SwitchParameter + + SwitchParameter + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + AccountId + + + + Int64 + + Int64 + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.StorageAccountResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSStorageAccount -ResourceGroupName $resourceGroup -FarmName $farm.Name -PartialAccountName ‘YourStorageAccountName’ + + + + + + + + + + + + + + + + + + + + + + + Get-ACSTableService + + Get status and settings of table service. + + + + + Get + ACSTableService + + + + Get status and settings of table service. + + + + Get-ACSTableService + + FarmName + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Get-ACSTableService -ResourceGroupName $resourceGroup -FarmName $farm.Name + + + + + + + + + + + + + + + + + + + + + + Get-ACSTableServiceMetric + + Retrieve the metrics of table service + + + + + Get + ACSTableServiceMetric + + + + Retrieve the metrics of table service + + + + Get-ACSTableServiceMetric + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + TimeGrain + + + + TimeGrain + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + TimeGrain + + + + TimeGrain + + TimeGrain + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricNoDetails + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.Metric + + + + + + + + + + + + + + + + + + + + + + + + + Get-ACSTableServiceMetricDefinition + + Retrieve the metric definitions of table service + + + + + Get + ACSTableServiceMetricDefinition + + + + Retrieve the metric definitions of table service + + + + Get-ACSTableServiceMetricDefinition + + FarmName + + + + String + + + MetricNames + + + + String[] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + MetricNames + + + + String[] + + String[] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinition + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.PSMetricDefinitionNoDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Export-ACSLog + + Invoke the log collector, which will collect logs, metrics, settings, health, and other system related information and package all these information into a package. + + + + + Export + ACSLog + + + + Invoke the log collector, which will collect logs, metrics, settings, health, and other system related informations and package all these information into a package. Later you can send the package to Microsoft for support. + + + + Export-ACSLog + + FarmName + + + + String + + + StartTime + + + + DateTime + + + EndTime + + + + DateTime + + + UserName + + + + String + + + Password + + + + String + + + LogPrefix + + + + String + + + AzureStorageContainer + + + + String + + + AzureStorageAccountName + + + + String + + + AzureStorageAccountKey + + + + String + + + AzureSasToken + + + + String + + + TargetShareFolder + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + StartTime + + + + DateTime + + DateTime + + + + + + EndTime + + + + DateTime + + DateTime + + + + + + UserName + + + + String + + String + + + + + + Password + + + + String + + String + + + + + + LogPrefix + + + + String + + String + + + + + + AzureStorageContainer + + + + String + + String + + + + + + AzureStorageAccountName + + + + String + + String + + + + + + AzureStorageAccountKey + + + + String + + String + + + + + + AzureSasToken + + + + String + + String + + + + + + TargetShareFolder + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Resolve-ACSFault + + Resolve/Dismiss a fault in Azure Consistent Storage System. + + + + + Resolve + ACSFault + + + + This cmdlet change the state of a fault from Active to Resolved. + + + + Resolve-ACSFault + + FarmName + + + + String + + + FaultId + + + + String + + + Force + + + + SwitchParameter + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + FaultId + + + + String + + String + + + + + + Force + + + + SwitchParameter + + SwitchParameter + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Resolve-ACSFault -ResourceGroupName $resourceGroup -FarmName $farm.Name -FaultId <FaultId> + + + + + + + + + + + + + + + + + + + + + + Restart-ACSRoleInstance + + Restart a role instance in the Azure Consistent Storage system. + + + + + Restart + ACSRoleInstance + + + + Restart a role instance in the Azure Consistent Storage system. + + + + Restart-ACSRoleInstance + + FarmName + + + + String + + + RoleType + + + + RoleType + + + InstanceId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + RoleType + + + + RoleType + + RoleType + + + + + + InstanceId + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Restart-ACSRoleInstance -ResourceGroupName $resourceGroup -FarmName $farm.Name -InstanceID 'YourInstanceID' + + + + + + + + + + + + + + + + + + + + + + Set-ACSBlobService + + Configure Settings of blob service + + + + + Set + ACSBlobService + + + + Configure Settings of blob service + + + + Set-ACSBlobService + + FarmName + + + + String + + + FrontEndCpuBasedKeepAliveThrottlingEnabled + + + + Nullable`1[Boolean] + + + FrontEndMemoryThrottlingEnabled + + + + Nullable`1[Boolean] + + + BlobSvcContainerGcInterval + + + + Nullable`1[Int32] + + + BlobSvcShallowGcInterval + + + + Nullable`1[Int32] + + + BlobSvcStreamMapMinContainerOccupancyPercent + + + + Nullable`1[Int32] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + FrontEndCpuBasedKeepAliveThrottlingEnabled + + + + Nullable`1[Boolean] + + Nullable`1[Boolean] + + + + + + FrontEndMemoryThrottlingEnabled + + + + Nullable`1[Boolean] + + Nullable`1[Boolean] + + + + + + BlobSvcContainerGcInterval + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + BlobSvcShallowGcInterval + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + BlobSvcStreamMapMinContainerOccupancyPercent + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse, + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Set-ACSBlobService -ResourceGroupName $resourceGroup -FarmName $farm.Name -FrontEndCpuBasedKeepAliveThrottlingEnabled $true + + + + + + + + + + + + + + + + + + + + + + Set-ACSFarm + + Change the setting of service configuration on ACS Farm + + + + + Set + ACSFarm + + + + Change the setting of service configuration on ACS Farm + + + + Set-ACSFarm + + FarmName + + + + String + + + SettingsPollingIntervalInSecond + + + + Nullable`1[Int32] + + + HostStyleHttpPort + + + + Nullable`1[Int32] + + + HostStyleHttpsPort + + + + Nullable`1[Int32] + + + CorsAllowedOriginsList + + + + String + + + DataCenterUriHostSuffixes + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + SettingsPollingIntervalInSecond + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + HostStyleHttpPort + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + HostStyleHttpsPort + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + CorsAllowedOriginsList + + + + String + + String + + + + + + DataCenterUriHostSuffixes + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Set-ACSFarm -ResourceGroupName $resourceGroup -FarmName $farm.Name -SettingPollingIntervalInSeconds 45 + + + + + + + + + + + + + + + + + + + + + + Set-ACSManagementService + + Configure Settings of management service + + + + + Set + ACSManagementService + + + + Configure Settings of management service + + + + Set-ACSManagementService + + FarmName + + + + String + + + WacContainerGcFullScanIntervalInSeconds + + + + Nullable`1[Int32] + + + WacAccountGcFullScanIntervalInSeconds + + + + Nullable`1[Int32] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + WacContainerGcFullScanIntervalInSeconds + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + WacAccountGcFullScanIntervalInSeconds + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.ManagementServiceResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.ManagementServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Set-ACSManagementService -ResourceGroupName $resourceGroup -FarmName $farm.Name WacAccountGcFullScanIntervalInSeconds 60000000 + + + + + + + + + + + + + + + + + + + + + + Set-ACSTableService + + Configure Settings of table service + + + + + Set + ACSTableService + + + + Configure Settings of table service + + + + Set-ACSTableService + + FarmName + + + + String + + + FrontEndCpuBasedKeepAliveThrottlingEnabled + + + + Nullable`1[Boolean] + + + FrontEndMemoryThrottlingEnabled + + + + Nullable`1[Boolean] + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + FrontEndCpuBasedKeepAliveThrottlingEnabled + + + + Nullable`1[Boolean] + + Nullable`1[Boolean] + + + + + + FrontEndMemoryThrottlingEnabled + + + + Nullable`1[Boolean] + + Nullable`1[Boolean] + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableServiceResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableServiceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Set-ACSTableService -ResourceGroupName $resourceGroup -FarmName $farm.Name -FrontEndCpuBasedKeepAliveThrottlingEnabled $true + + + + + + + + + + + + + + + + + + + + + + Start-ACSBlobServerRoleInstance + + Start blob service instance on a specific physical node. + + + + + Start + ACSBlobServerRoleInstance + + + + Start blob service instance on a specific physical node. + + + + Start-ACSBlobServerRoleInstance + + FarmName + + + + String + + + InstanceId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + InstanceId + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +start-ACSBlobServerRoleInstance -ResourceGroupName $resourceGroup -FarmName $farm.Name -InstanceID 'YourInstanceID' + + + + + + + + + + + + + + + + + + + + + + Stop-ACSBlobServerRoleInstance + + Stop blob service instance on a specific physical node. + + + + + Stop + ACSBlobServerRoleInstance + + + + Stop blob service instance on a specific physical node. + + + + Stop-ACSBlobServerRoleInstance + + FarmName + + + + String + + + InstanceId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + InstanceId + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +stop-ACSBlobServerRoleInstance -ResourceGroupName $resourceGroup -FarmName $farm.Name -InstanceID 'YourInstanceID' + + + + + + + + + + + + + + + + + + + + + + Sync-ACSStorageAccount + + Synchronize the account status of the tenant storage accounts from backend to frontend cache. + + + + + Sync + ACSStorageAccount + + + + After undelete a storage account, service admin need to synchronize the account status change back to the frontend cache in order to make sure the frontend could serve the request for that undeleted storage account. + + + + Sync-ACSStorageAccount + + TenantAccountName + + + + String + + + TenantSubscriptionId + + + + String + + + Location + + + + String + + + TenantResourceGroup + + + + String + + + StorageAccountApiVersion + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + TenantAccountName + + + + String + + String + + + + + + TenantSubscriptionId + + + + String + + String + + + + + + Location + + + + String + + String + + + + + + TenantResourceGroup + + + + String + + String + + + + + + StorageAccountApiVersion + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.StorageAccountResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +Sync-ACSStorageAccount -AccountName first -TenantSubscriptionId <TenantSubscriptionId> -ResourceLocation 'local' -ResourceGroupName $resourceGroup + + + + + + + + + + + + + + + + + + + + + + Undo-ACSStorageAccountDeletion + + Undelete a tenant storage account. + + + + + Undo + ACSStorageAccountDeletion + + + + Service admin can use the cmdlet to recover a a storage account deleted by tenant admin. + + + + Undo-ACSStorageAccountDeletion + + FarmName + + + + String + + + AccountId + + + + Int64 + + + NewAccountName + + + + String + + + StorageAccountApiVersion + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + AccountId + + + + Int64 + + Int64 + + + + + + NewAccountName + + + + String + + String + + + + + + StorageAccountApiVersion + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.StorageAccountResponse + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $resourceGroup = 'System' + +$farm = Get-ACSFarm -ResourceGroupName $resourceGroup + +Undo-ACSStorageAccountDeletion -ResourceGroupName $resourceGroup -FarmName $farm.Name -AccountId <AccountId> + + + + + + + + + + + + + + + + + + + + + + Update-ACSRoleInstance + + Update the settings of a role instance from setting repository + + + + + Update + ACSRoleInstance + + + + Update the settings of a role instance from setting repository + + + + Update-ACSRoleInstance + + FarmName + + + + String + + + RoleType + + + + RoleType + + + InstanceId + + + + String + + + SubscriptionId + + + + String + + + Token + + + + String + + + AdminUri + + + + Uri + + + ResourceGroupName + + + + String + + + SkipCertificateValidation + + + + SwitchParameter + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + FarmName + + + + String + + String + + + + + + RoleType + + + + RoleType + + RoleType + + + + + + InstanceId + + + + String + + String + + + + + + SubscriptionId + + + + String + + String + + + + + + Token + + + + String + + String + + + + + + AdminUri + + + + Uri + + Uri + + + + + + ResourceGroupName + + + + String + + String + + + + + + SkipCertificateValidation + + + + SwitchParameter + + SwitchParameter + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.FarmResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.AccountContainerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobFrontendRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableFrontendInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.BlobServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.MonitoringServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.MetricsServerRoleInstanceResponse + + + + + + + + + + Microsoft.AzureStack.Commands.StorageAdmin.TableMasterRoleInstanceResponse + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/AccountContainerRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/AccountContainerRoleInstanceResponse.cs new file mode 100644 index 000000000000..6503f748ddf1 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/AccountContainerRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class AccountContainerRoleInstanceResponse: RoleInstanceResponseBase + { + public AccountContainerRoleInstanceResponse(AccountContainerRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.AccountContainerserver; + } + + public AccountContainerRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobFrontEndRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobFrontEndRoleInstanceResponse.cs new file mode 100644 index 000000000000..2c0cb5942589 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobFrontEndRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class BlobFrontEndRoleInstanceResponse : RoleInstanceResponseBase + { + public BlobFrontEndRoleInstanceResponse(BlobFrontEndRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.BlobFrontend; + } + + public BlobFrontEndRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServerRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServerRoleInstanceResponse.cs new file mode 100644 index 000000000000..9481834555f5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServerRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class BlobServerRoleInstanceResponse : RoleInstanceResponseBase + { + public BlobServerRoleInstanceResponse(BlobServerRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.BlobServer; + } + + public BlobServerRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServiceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServiceResponse.cs new file mode 100644 index 000000000000..6a3ce22d01a9 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/BlobServiceResponse.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class BlobServiceResponse : ServiceResponseBase + { + public BlobServiceResponse(BlobServiceResponseResource resource) : base(resource, "BlobService") + { + } + + public BlobServiceSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FarmResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FarmResponse.cs new file mode 100644 index 000000000000..ac95a56cc53d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FarmResponse.cs @@ -0,0 +1,31 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class FarmResponse: ResponseBase + { + public FarmResponse(FarmModel resource) : base(resource) + { + } + + public string SettingsStore { get; set; } + + public HealthStatus HealthStatus { get; set; } + + public FarmSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FaultResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FaultResponse.cs new file mode 100644 index 000000000000..0c5849fd5a56 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/FaultResponse.cs @@ -0,0 +1,42 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class FaultResponse:ResponseBase + { + public FaultResponse(FaultModel resource) : base(resource) + { + } + + public DateTime ActivatedTime { get; set; } + public AssociatedDataType AssociatedDataType { get; set; } + public EventQuery AssociatedEventQuery { get; set; } + public string AssociatedMetricsName { get; set; } + public string Description { get; set; } + public string FaultId { get; set; } + public string FaultRuleName { get; set; } + public string ResolutionText { get; set; } + public DateTime? ResolvedTime { get; set; } + public string ResourceUri { get; set; } + public Severity Severity { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ManagementServiceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ManagementServiceResponse.cs new file mode 100644 index 000000000000..efdc123bf904 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ManagementServiceResponse.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class ManagementServiceResponse : ServiceResponseBase + { + public ManagementServiceResponse(ManagementServiceResponseResource resource) : base(resource, "ManagementService") + { + } + + public ManagementServiceSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MetricsServerRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MetricsServerRoleInstanceResponse.cs new file mode 100644 index 000000000000..59367d1fb10b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MetricsServerRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class MetricsServerRoleInstanceResponse : RoleInstanceResponseBase + { + public MetricsServerRoleInstanceResponse(MetricsServerRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.MetricsServer; + } + + public MetricsServerRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MonitoringServerRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MonitoringServerRoleInstanceResponse.cs new file mode 100644 index 000000000000..6badb606e8df --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/MonitoringServerRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class MonitoringServerRoleInstanceResponse : RoleInstanceResponseBase + { + public MonitoringServerRoleInstanceResponse(MonitoringServerRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.HealthMonitoringserver; + } + + public MonitoringServerRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/NodeResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/NodeResponse.cs new file mode 100644 index 000000000000..5d8f936cb979 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/NodeResponse.cs @@ -0,0 +1,54 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class NodeResponse : ResponseBase + { + public NodeResponse(NodeModel resource) : base(resource) + { + } + + public string CodeVersion { get; set; } + + public string ConfigVersion { get; set; } + + public Uri FaultDomain { get; set; } + + public HealthStatus HealthState { get; set; } + + + public string IpAddressOrFqdn { get; set; } + + public bool IsSeedNode { get; set; } + + public string NodeId { get; set; } + + public string NodeName { get; set; } + + public NodeStatus NodeStatus { get; set; } + + public string NodeType { get; set; } + + public TimeSpan NodeUpTime { get; set; } + + public string UpgradeDomain { get; set; } + + public IEnumerable RunningInstanceUris { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSAvailabilityCollection.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSAvailabilityCollection.cs new file mode 100644 index 000000000000..b996e695487d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSAvailabilityCollection.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System.Collections.Generic; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Wraps around a list of Dimension objects to display them with indentation + /// + internal class PSAvailabilityCollection + { + private IList metricAvailabilities; + + /// + /// Initializes a new instance of the PSAvailabilityCollection class + /// + /// The list of metric availabilities + public PSAvailabilityCollection(IList metricAvailabilities) + { + this.metricAvailabilities = metricAvailabilities; + } + + /// + /// A string representation of the list MetricAvailability objects including indentation + /// + /// A string representation of the list of MetricAvailability objects including indentation + public override string ToString() + { + return this.metricAvailabilities.ToString(indentationTabs: 1); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetric.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetric.cs new file mode 100644 index 000000000000..1c8fa3717543 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetric.cs @@ -0,0 +1,39 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Wrapps around the Metric and exposes a summary of the properties properties + /// + internal class PSMetric : PSMetricNoDetails + { + /// + /// Gets or sets the MetricValues collection of the metric + /// + public new PSMetricValuesCollection MetricValues { get; set; } + + /// + /// Initializes a new instance of the PSMetric class. + /// + /// The input Metric object + public PSMetric(Metric metric) : base(metric) + { + this.MetricValues = new PSMetricValuesCollection(metric.MetricValues); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinition.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinition.cs new file mode 100644 index 000000000000..6bde718617d5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinition.cs @@ -0,0 +1,36 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class PSMetricDefinition : PSMetricDefinitionNoDetails + { + /// + /// Gets or sets the MetricAvailabilties of the metric + /// + public new PSAvailabilityCollection MetricAvailabilities { get; set; } + + /// + /// Initializes an new instance of the PSMetricDefinition class + /// + /// The MetricDefinition + public PSMetricDefinition(MetricDefinition metricDefinition): base(metricDefinition) + { + this.MetricAvailabilities = new PSAvailabilityCollection(metricDefinition.MetricAvailabilities); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinitionNoDetails.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinitionNoDetails.cs new file mode 100644 index 000000000000..513ef158af2b --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricDefinitionNoDetails.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Wraps around MetricDefinition to provide summarized data about it + /// + internal class PSMetricDefinitionNoDetails : MetricDefinition + { + /// + /// Gets or sets the Name of the metric + /// + public new string Name { get; set; } + + /// + /// Initializes an new instance of the PSMetricDefinitionNoDetails class + /// + /// The MetricDefinition + public PSMetricDefinitionNoDetails(MetricDefinition metricDefinition) + { + // Keep the original value (localized string, Dictionary, List) in the base + base.Name = metricDefinition.Name; + + this.MetricAvailabilities = metricDefinition.MetricAvailabilities; + this.Name = metricDefinition.Name == null ? null : metricDefinition.Name.Value; + this.PrimaryAggregationType = metricDefinition.PrimaryAggregationType; + this.Unit = metricDefinition.Unit; + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricNoDetails.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricNoDetails.cs new file mode 100644 index 000000000000..6a995608e94a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricNoDetails.cs @@ -0,0 +1,47 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Wrapps around the Metric and exposes a summary of the properties properties + /// + internal class PSMetricNoDetails : Metric + { + /// + /// Gets or sets the Name of the metric + /// + public new string Name { get; set; } + + /// + /// Initializes a new instance of the PSMetric class. + /// + /// The input Metric object + public PSMetricNoDetails(Metric metric) + { + // Keep the original value (localized string, Dictionary, List) in the base + base.Name = metric.Name; + + this.EndTime = metric.EndTime; + this.Name = metric.Name == null ? null : metric.Name.Value; + this.MetricValues = metric.MetricValues; + this.StartTime = metric.StartTime; + this.TimeGrain = metric.TimeGrain; + this.MetricUnit = metric.MetricUnit; + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricValuesCollection.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricValuesCollection.cs new file mode 100644 index 000000000000..aa29d4aa0262 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/PSMetricValuesCollection.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System.Collections.Generic; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Wraps around a list of PSMetricValue objects to display them with indentation + /// + internal class PSMetricValuesCollection + { + private IList metricValues; + + /// + /// Initializes a new instance of the PSMetricValuesCollection class + /// + /// The list of metric values + public PSMetricValuesCollection(IList metricValues) + { + this.metricValues = metricValues; + } + + /// + /// A string representation of the list Dimension objects including indentation + /// + /// A string representation of the list of Dimension objects including indentation + public override string ToString() + { + return this.metricValues.ToString(indentationTabs: 1); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ResponseBase.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ResponseBase.cs new file mode 100644 index 000000000000..45dbab258e80 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ResponseBase.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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class ResponseBase : ResourceBase + { + public ResponseBase(ResourceBase resource) : this(resource, "Properties") + { + + } + + public ResponseBase(ResourceBase resource, string propertyNameToExpand) + { + Id = resource.Id; + Location = resource.Location; + Tags = resource.Tags; + Type = resource.Type; + Name = resource.Name; + + // Id is in the following format: + // /subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/{providerName}/farms/{farmId}/nodes/{nodeId} + string[] ids = resource.Id.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + ResourceGroupName = ids[3]; + FarmName = ids[7]; + + Type inputType = resource.GetType(); + Type outPutType = this.GetType(); + + PropertyInfo propertiesPropertyInfo = inputType.GetProperty(propertyNameToExpand); + + if (propertiesPropertyInfo != null) + { + var propertiesValue = propertiesPropertyInfo.GetValue(resource); + PropertyInfo[] properties = propertiesValue.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); + foreach (var property in properties) + { + object propertyValue = property.GetValue(propertiesValue); + if (propertyValue != null) + { + PropertyInfo propertyInfoInResponse = outPutType.GetProperty(property.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + if (propertyInfoInResponse != null) + { + propertyInfoInResponse.SetValue(this, propertyValue); + } + } + } + } + } + + public string ResourceGroupName { get; set; } + public string FarmName { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/RoleInstanceResponseBase.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/RoleInstanceResponseBase.cs new file mode 100644 index 000000000000..48e81bbf1197 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/RoleInstanceResponseBase.cs @@ -0,0 +1,47 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class RoleInstanceResponseBase:ResponseBase + { + public RoleInstanceResponseBase(ResourceBase resource) : base(resource) + { + } + + public string InstanceId + { + get + { + return RoleIdentifier; + } + } + + protected string RoleIdentifier { get; set; } + public string Version { get; set; } + public RoleInstanceStatus Status { get; set; } + public HealthStatus HealthStatus { get; set; } + public string NodeUri { get; set; } + public IEnumerable HistoryInfos { get; set; } + + public RoleType RoleType { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ServiceResponseBase.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ServiceResponseBase.cs new file mode 100644 index 000000000000..faf9bfaa967d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ServiceResponseBase.cs @@ -0,0 +1,33 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class ServiceResponseBase : ResponseBase + { + public ServiceResponseBase(ResourceBase resource, string propertyNameToExpand) : base(resource, propertyNameToExpand) + { + } + + public HealthStatus HealthStatus { get; set; } + public string Version { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ShareResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ShareResponse.cs new file mode 100644 index 000000000000..64652e20efe4 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/ShareResponse.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class ShareResponse:ResponseBase + { + public ShareResponse(ShareModel resource) : base(resource) + { + } + + public ulong? FreeCapacity { get; set; } + public HealthStatus HealthStatus { get; set; } + public string ShareName { get; set; } + public ulong? TotalCapacity { get; set; } + public string UncPath { get; set; } + public ulong? UsedCapacity { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/StorageAccountResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/StorageAccountResponse.cs new file mode 100644 index 000000000000..89a828bc9a85 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/StorageAccountResponse.cs @@ -0,0 +1,80 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class StorageAccountResponse : ResponseBase + { + public StorageAccountResponse(StorageAccountModel model, string farmName) + : base(model) + { + // Manually set those with different names or in root + this.AccountId = long.Parse(model.Name, CultureInfo.InvariantCulture); + this.AdminViewId = model.Id; + this.Location = model.Location; + this.WacAccountId = model.Properties.AccountId; + this.ResourceType = model.ResourceType; + this.Type = model.Type; + this.Tags = model.Tags; + this.FarmName = farmName; + } + + public string ResourceType { get; set; } + public long AccountId { get; set; } + public string AdminViewId { get; set; } + public string TenantViewId { get; set; } + public StorageAccountType AccountType { get; set; } + + public StorageAccountState State { get; set; } + + public IDictionary PrimaryEndpoints { get; set; } + + public string CreationTime { get; set; } + + public string AlternateName { get; set; } + + public RegionStatus StatusOfPrimary { get; set; } + + public Guid TenantSubscriptionId { get; set; } + + public string TenantAccountName { get; set; } + + public string TenantResourceGroupName { get; set; } + + public StorageAccountOperation CurrentOperation { get; set; } + + public string CustomDomain { get; set; } + public int AcquisitionOperationCount { get; set; } + public DateTime? DeletedTime { get; set; } + + public StorageAccountStatus AccountStatus { get; set; } + + public DateTime? RecoveredTime { get; set; } + + public DateTime? RecycledTime { get; set; } + + public WacAccountPermissions? Permissions { get; set; } + + public ulong? WacAccountId { get; set; } + public WacAccountStates? WacInternalState { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableFrontEndRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableFrontEndRoleInstanceResponse.cs new file mode 100644 index 000000000000..a51df47b2617 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableFrontEndRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class TableFrontEndRoleInstanceResponse : RoleInstanceResponseBase + { + public TableFrontEndRoleInstanceResponse(TableFrontEndRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.TableFrontend; + } + + public TableFrontEndRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableMasterRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableMasterRoleInstanceResponse.cs new file mode 100644 index 000000000000..f812b6deebff --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableMasterRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class TableMasterRoleInstanceResponse : RoleInstanceResponseBase + { + public TableMasterRoleInstanceResponse(TableMasterRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.TableMaster; + } + + public TableMasterRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServerRoleInstanceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServerRoleInstanceResponse.cs new file mode 100644 index 000000000000..bed88bbadf24 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServerRoleInstanceResponse.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class TableServerRoleInstanceResponse : RoleInstanceResponseBase + { + public TableServerRoleInstanceResponse(TableServerRoleInstanceModel resource) : base(resource) + { + RoleType = RoleType.TableServer; + } + + public TableServerRoleInstanceEffectiveSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServiceResponse.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServiceResponse.cs new file mode 100644 index 000000000000..186316580e60 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Model/TableServiceResponse.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal class TableServiceResponse : ServiceResponseBase + { + public TableServiceResponse(TableServiceResponseResource resource) : base(resource, "TableService") + { + } + + public TableServiceSettings Settings { get; set; } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/DisableNode.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/DisableNode.cs new file mode 100644 index 000000000000..1cde4b28da59 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/DisableNode.cs @@ -0,0 +1,68 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +// +// +// Copyright (C) Microsoft. All rights reserved. +// +// + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Disable-Node [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [[-NodeName] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsLifecycle.Disable, Nouns.AdminNode, SupportsShouldProcess = true)] + public sealed class DisableAdminNode : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName { get; set; } + + /// + /// Node name + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNullOrEmpty] + public string NodeName { get; set; } + + protected override void Execute() + { + if (ShouldProcess( + Resources.DisableNodeVerboseDescription.FormatInvariantCulture(NodeName, FarmName), + Resources.DisableNodeVerboseWarning.FormatInvariantCulture(NodeName, FarmName), + Resources.ShouldProcessCaption)) + { + var response = Client.Nodes.Disable(ResourceGroupName, FarmName, NodeName); + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, Resources.OperationFailedErrorMessage, response.StatusCode)); + } + } + } + } +} + diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/EnableNode.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/EnableNode.cs new file mode 100644 index 000000000000..9955e771d210 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/EnableNode.cs @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Enable-Node [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [[-NodeName] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsLifecycle.Enable, Nouns.AdminNode, SupportsShouldProcess = true)] + public sealed class EnableAdminNode : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName { get; set; } + + /// + /// Node name + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNullOrEmpty] + public string NodeName { get; set; } + + protected override void Execute() + { + if (ShouldProcess( + Resources.EnableNodeVerboseDescription.FormatInvariantCulture(NodeName, FarmName), + Resources.EnableNodeVerboseWarning.FormatInvariantCulture(NodeName, FarmName), + Resources.ShouldProcessCaption)) + { + var response = Client.Nodes.Enable(ResourceGroupName, FarmName, NodeName); + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, Resources.OperationFailedErrorMessage, response.StatusCode)); + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNode.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNode.cs new file mode 100644 index 000000000000..d00cd742619e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNode.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-Node [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [[-NodeName] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminNode)] + public sealed class GetAdminNode : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// Node name + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, Position = 5)] + public string NodeName { get; set; } + + + protected override void Execute() + { + if (string.IsNullOrEmpty(NodeName)) + { + NodeListResponse nodes = Client.Nodes.List(ResourceGroupName, FarmName); + + WriteObject(nodes.Nodes.Select(_=>new NodeResponse(_)), true); + } + else + { + NodeGetResponse node = Client.Nodes.Get(ResourceGroupName, FarmName, NodeName); + WriteObject(new NodeResponse(node.Node)); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetricDefinitions.cs new file mode 100644 index 000000000000..a939a6fee198 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetricDefinitions.cs @@ -0,0 +1,51 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminNodeMetricDefinition)] + public sealed class GetNodeMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// Node name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public string NodeName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.Nodes.GetMetricDefinitions(ResourceGroupName, FarmName, NodeName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetrics.cs new file mode 100644 index 000000000000..7a3dc6860e0a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Node/GetNodeMetrics.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminNodeMetric)] + public sealed class GetNodeMetrics : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// Node name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public string NodeName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.Nodes.GetMetrics(ResourceGroupName, FarmName, NodeName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Nouns.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Nouns.cs new file mode 100644 index 000000000000..49306c358290 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Nouns.cs @@ -0,0 +1,93 @@ +// ---------------------------------------------------------------------------------- +// +// 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.AzureStack.Commands.StorageAdmin +{ + class Nouns + { + public const string Prefix = "ACS"; + + public const string Metric = "Metric"; + + public const string MetricDefinition = "MetricDefinition"; + + + // farm + public const string AdminFarm = Prefix + "Farm"; + + public const string AdminFarmMetric = AdminFarm + Metric; + + public const string AdminFarmMetricDefinition = AdminFarm + MetricDefinition; + + public const string AdminFarmEvent = Prefix + "Event"; + + public const string AdminFarmEventQuery = Prefix + "EventQuery"; + + // LogCollect + public const string Log = Prefix + "Log"; + + // node + public const string AdminNode = Prefix + "Node"; + + public const string AdminNodeMetric = AdminNode + Metric; + + public const string AdminNodeMetricDefinition = AdminNode + MetricDefinition; + + // blob server role instance + public const string AdminBlobServerRoleInstance = Prefix + "BlobServerRoleInstance"; + + // role instance + public const string AdminRoleInstance = Prefix + "RoleInstance"; + + // role instance + public const string AdminRoleInstanceSettingsPullNow = Prefix + "RoleInstancePullSettings"; + + public const string AdminRoleInstanceMetric = AdminRoleInstance + Metric; + + public const string AdminRoleInstanceMetricDefinition = AdminRoleInstance + MetricDefinition; + + // service + public const string AdminTableService = Prefix + "TableService"; + public const string AdminBlobService = Prefix + "BlobService"; + public const string AdminManagementService = Prefix + "ManagementService"; + + public const string AdminTableServiceMetric = AdminTableService + Metric; + public const string AdminTableServiceMetricDefinition = AdminTableService + MetricDefinition; + + public const string AdminBlobServiceMetric = AdminBlobService + Metric; + public const string AdminBlobServiceMetricDefinition = AdminBlobService + MetricDefinition; + + public const string AdminManagementServiceMetric = AdminManagementService + Metric; + public const string AdminManagementServiceMetricDefinition = AdminManagementService + MetricDefinition; + + // share + public const string AdminShare = Prefix + "Share"; + + public const string AdminShareMetric = AdminShare + Metric; + + public const string AdminShareMetricDefinition = AdminShare + MetricDefinition; + + // fault + public const string AdminFault = Prefix + "Fault"; + + // role instance + public const string AdminInstance = Prefix + "Instance"; + + // storage account + public const string AdminStorageAccount = Prefix + "StorageAccount"; + + // storage account deletion operation + public const string AdminStorageAccountDeletion = Prefix + "StorageAccountDeletion"; + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Properties/AssemblyInfo.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..f0d5722a28e3 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft AzureStack Powershell ")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: Guid("D4CA0CC1-CD0A-4CE2-A40D-2D8A082D8791")] + +[assembly: AssemblyVersion("0.9.2")] +[assembly: AssemblyFileVersion("0.9.2")] \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.Designer.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.Designer.cs new file mode 100644 index 000000000000..2a844b8de104 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.Designer.cs @@ -0,0 +1,432 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.AzureStack.Commands.StorageAdmin { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AzureStack.Commands.StorageAdmin.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Bad parameter set. + /// + internal static string BadParameterSet { + get { + return ResourceManager.GetString("BadParameterSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ACS Blob Service. + /// + internal static string BlobService { + get { + return ResourceManager.GetString("BlobService", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Disabling Node '{0}' in Storage cluster '{1}'.. + /// + internal static string DisableNodeVerboseDescription { + get { + return ResourceManager.GetString("DisableNodeVerboseDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to disable Node '{0}' in Storage cluster '{1}'?. + /// + internal static string DisableNodeVerboseWarning { + get { + return ResourceManager.GetString("DisableNodeVerboseWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enabling Node '{0}' in Storage cluster '{1}'.. + /// + internal static string EnableNodeVerboseDescription { + get { + return ResourceManager.GetString("EnableNodeVerboseDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to enable Node '{0}' in Storage cluster '{1}'?. + /// + internal static string EnableNodeVerboseWarning { + get { + return ResourceManager.GetString("EnableNodeVerboseWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to get undeleted storage account via Account Id or one of its properties is invalid: Tenant Subscription Id, Tenant View Id, Tenant Resource Group Name, Location.. + /// + internal static string FailedToGetAccount { + get { + return ResourceManager.GetString("FailedToGetAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to undelete storage account.. + /// + internal static string FailedToUndeleteAccount { + get { + return ResourceManager.GetString("FailedToUndeleteAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Azure profile is invalid, Make sure that you are in the Azure context with the Add-AzureEnvironment and Add-AzureAccount cmdlets.. + /// + internal static string InvalidProfile { + get { + return ResourceManager.GetString("InvalidProfile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This role type is not supported: '{0}'. + /// + internal static string InvalidRoleTypeErrorMessageFormat { + get { + return ResourceManager.GetString("InvalidRoleTypeErrorMessageFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ACS Management Service. + /// + internal static string ManagementService { + get { + return ResourceManager.GetString("ManagementService", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Operation is failed. Error code is: '{0}'. + /// + internal static string OperationFailedErrorMessage { + get { + return ResourceManager.GetString("OperationFailedErrorMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If specified VersionedAccountName parameter, PartialAccountName, StorageAccountStatus or TenantSubscriptionId parameters must not be set.. + /// + internal static string OtherParameterMustNotSetWithVersionedAccountNameSet { + get { + return ResourceManager.GetString("OtherParameterMustNotSetWithVersionedAccountNameSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Restarting role instance '{0}' with type '{1}'.. + /// + internal static string RestartRoleInstanceVerboseDescription { + get { + return ResourceManager.GetString("RestartRoleInstanceVerboseDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to restart role instance '{0}' with type '{1}'.. + /// + internal static string RestartRoleInstanceVerboseWarning { + get { + return ResourceManager.GetString("RestartRoleInstanceVerboseWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Retrieve properties of undeleted storage account to prepare for resource sync. + /// + internal static string RetrieveUndeletedStorageAccount { + get { + return ResourceManager.GetString("RetrieveUndeletedStorageAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Performing the operation set ACS Farm '{0}', {1}.. + /// + internal static string SetFarmDescription { + get { + return ResourceManager.GetString("SetFarmDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to perform the operation "set ACS Farm '{0}', {1}"?. + /// + internal static string SetFarmWarning { + get { + return ResourceManager.GetString("SetFarmWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Performing the operation set {0} {1}.. + /// + internal static string SetServiceDescription { + get { + return ResourceManager.GetString("SetServiceDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to '{0}' to '{1}'. + /// + internal static string SetServiceSettingParameter { + get { + return ResourceManager.GetString("SetServiceSettingParameter", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to perform the operation "set {0}{1}"?. + /// + internal static string SetServiceWarning { + get { + return ResourceManager.GetString("SetServiceWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Confirm. + /// + internal static string ShouldProcessCaption { + get { + return ResourceManager.GetString("ShouldProcessCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Specified SMB share will be removed. + /// + internal static string ShouldProcessRemoveSmbShare { + get { + return ResourceManager.GetString("ShouldProcessRemoveSmbShare", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting Blob server instance '{0}'.. + /// + internal static string StartBlobServerRoleInstanceVerboseDescription { + get { + return ResourceManager.GetString("StartBlobServerRoleInstanceVerboseDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to start Blob server role instance ‘{0}’.. + /// + internal static string StartBlobServerRoleInstanceVerboseWarning { + get { + return ResourceManager.GetString("StartBlobServerRoleInstanceVerboseWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stopping Blob server instance '{0}'.. + /// + internal static string StopBlobServerRoleInstanceVerboseDescription { + get { + return ResourceManager.GetString("StopBlobServerRoleInstanceVerboseDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to stop Blob server role instance ‘{0}’.. + /// + internal static string StopBlobServerRoleInstanceVerboseWarning { + get { + return ResourceManager.GetString("StopBlobServerRoleInstanceVerboseWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Account '{0}'. + /// + internal static string StorageAccount { + get { + return ResourceManager.GetString("StorageAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Storage Account With VersionedAccountName '{0}'. + /// + internal static string StorageAccountAdminView { + get { + return ResourceManager.GetString("StorageAccountAdminView", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource Sync. + /// + internal static string SyncOperation { + get { + return ResourceManager.GetString("SyncOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ACS Table Service. + /// + internal static string TableService { + get { + return ResourceManager.GetString("TableService", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Both the parameters Token, AdminUri and SubscriptionId are required.. + /// + internal static string TokenAndAdminUriRequired { + get { + return ResourceManager.GetString("TokenAndAdminUriRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Triger resource sync now.. + /// + internal static string TriggerResourceSync { + get { + return ResourceManager.GetString("TriggerResourceSync", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Undelete. + /// + internal static string UndeleteOperation { + get { + return ResourceManager.GetString("UndeleteOperation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Performing the operation update the settings on ACS Role Instance '{0}' with type '{1}'.. + /// + internal static string UpdateRoleInstanceSettingDescription { + get { + return ResourceManager.GetString("UpdateRoleInstanceSettingDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to perform the operation "update the settings on ACS Role Instance '{0}' with type '{1}'"?. + /// + internal static string UpdateRoleInstanceSettingWarning { + get { + return ResourceManager.GetString("UpdateRoleInstanceSettingWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument should be an absolute URI.. + /// + internal static string ValidateAbsoluteUriNotAbsolute { + get { + return ResourceManager.GetString("ValidateAbsoluteUriNotAbsolute", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to System.Uri type is expected.. + /// + internal static string ValidateAbsoluteUriWrongType { + get { + return ResourceManager.GetString("ValidateAbsoluteUriWrongType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Argument should be a valid UNC.. + /// + internal static string ValidateUncNotValidUnc { + get { + return ResourceManager.GetString("ValidateUncNotValidUnc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to System.Uri type is expected.. + /// + internal static string ValidateUncWrongType { + get { + return ResourceManager.GetString("ValidateUncWrongType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Please wait a few minutes to let frontdoor finish sync job. After that storage account can be accessed by tenant user.. + /// + internal static string WaitAfterArmSync { + get { + return ResourceManager.GetString("WaitAfterArmSync", resourceCulture); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.resx b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.resx new file mode 100644 index 000000000000..525b804d7848 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Resources.resx @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ACS Blob Service + + + Disabling Node '{0}' in Storage cluster '{1}'. + + + Are you sure you want to disable Node '{0}' in Storage cluster '{1}'? + + + Enabling Node '{0}' in Storage cluster '{1}'. + + + Are you sure you want to enable Node '{0}' in Storage cluster '{1}'? + + + Failed to get undeleted storage account via Account Id or one of its properties is invalid: Tenant Subscription Id, Tenant View Id, Tenant Resource Group Name, Location. + + + Failed to undelete storage account. + + + This role type is not supported: '{0}' + + + ACS Management Service + + + Operation is failed. Error code is: '{0}' + {0} is the error code. + + + If specified VersionedAccountName parameter, PartialAccountName, StorageAccountStatus or TenantSubscriptionId parameters must not be set. + + + Restarting role instance '{0}' with type '{1}'. + + + Are you sure you want to restart role instance '{0}' with type '{1}'. + + + Performing the operation set {0} {1}. + + + '{0}' to '{1}' + whilte space in the beginning can't be discarded, it's treated as seperator. + + + Are you sure you want to perform the operation "set {0}{1}"? + + + Retrieve properties of undeleted storage account to prepare for resource sync + + + Confirm + + + Specified SMB share will be removed + + + Starting Blob server instance '{0}'. + + + Are you sure you want to start Blob server role instance ‘{0}’. + + + Stopping Blob server instance '{0}'. + + + Are you sure you want to stop Blob server role instance ‘{0}’. + + + ACS Table Service + + + Performing the operation update the settings on ACS Role Instance '{0}' with type '{1}'. + + + Are you sure you want to perform the operation "update the settings on ACS Role Instance '{0}' with type '{1}'"? + + + Storage Account '{0}' + + + Storage Account With VersionedAccountName '{0}' + + + Resource Sync + + + Triger resource sync now. + + + Undelete + + + Argument should be an absolute URI. + + + System.Uri type is expected. + + + Argument should be a valid UNC. + + + System.Uri type is expected. + + + Please wait a few minutes to let frontdoor finish sync job. After that storage account can be accessed by tenant user. + + + The Azure profile is invalid, Make sure that you are in the Azure context with the Add-AzureEnvironment and Add-AzureAccount cmdlets. + + + Both the parameters Token, AdminUri and SubscriptionId are required. + + + Performing the operation set ACS Farm '{0}', {1}. + {0} is the farm name, {1} is the updated settings key/value pair. + + + Are you sure you want to perform the operation "set ACS Farm '{0}', {1}"? + + + Bad parameter set + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstance.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstance.cs new file mode 100644 index 000000000000..d173432242d9 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstance.cs @@ -0,0 +1,135 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-RoleInstance [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-RoleType] {enum} [[-InstanceId] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminRoleInstance)] + public sealed class GetAdminNodeRoleInstance : AdminCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// name of role + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public RoleType RoleType + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string InstanceId + { + get; + set; + } + + protected override void Execute() + { + object resultObject; + if (string.IsNullOrEmpty(InstanceId)) + { + switch (RoleType) + { + case RoleType.AccountContainerserver: + resultObject = Client.AccountContainerServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_=>new AccountContainerRoleInstanceResponse(_)); + break; + case RoleType.BlobFrontend: + resultObject = Client.BlobFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobFrontEndRoleInstanceResponse(_)); + break; + case RoleType.TableFrontend: + resultObject = Client.TableFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableFrontEndRoleInstanceResponse(_)); + break; + case RoleType.BlobServer: + resultObject = Client.BlobServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobServerRoleInstanceResponse(_)); + break; + case RoleType.TableServer: + resultObject = Client.TableServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableServerRoleInstanceResponse(_)); + break; + case RoleType.HealthMonitoringserver: + resultObject = Client.HealthMonitoringServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MonitoringServerRoleInstanceResponse(_)); + break; + case RoleType.MetricsServer: + resultObject = Client.MetricsServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MetricsServerRoleInstanceResponse(_)); + break; + case RoleType.TableMaster: + resultObject = Client.TableMasterInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableMasterRoleInstanceResponse(_)); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + } + else + { + switch (RoleType) + { + case RoleType.AccountContainerserver: + resultObject = new AccountContainerRoleInstanceResponse(Client.AccountContainerServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.BlobFrontend: + resultObject = new BlobFrontEndRoleInstanceResponse(Client.BlobFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.TableFrontend: + resultObject = new TableFrontEndRoleInstanceResponse(Client.TableFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.BlobServer: + resultObject = new BlobServerRoleInstanceResponse(Client.BlobServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.TableServer: + resultObject = new TableServerRoleInstanceResponse(Client.TableServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.HealthMonitoringserver: + resultObject = new MonitoringServerRoleInstanceResponse(Client.HealthMonitoringServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.MetricsServer: + resultObject = new MetricsServerRoleInstanceResponse(Client.MetricsServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + case RoleType.TableMaster: + resultObject = new TableMasterRoleInstanceResponse(Client.TableMasterInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + } + WriteObject(resultObject, true); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetricDefinitions.cs new file mode 100644 index 000000000000..f786ae62e365 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetricDefinitions.cs @@ -0,0 +1,103 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminRoleInstanceMetricDefinition)] + public sealed class GetRoleInstanceMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// name of role + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public RoleType RoleType + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string InstanceId + { + get; + set; + } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + MetricDefinitionsResult resultObject; + + switch (RoleType) + { + case RoleType.AccountContainerserver: + resultObject = Client.AccountContainerServerInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.BlobFrontend: + resultObject = Client.BlobFrontendInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableFrontend: + resultObject = Client.TableFrontendInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.BlobServer: + resultObject = Client.BlobServerInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableServer: + resultObject = Client.TableServerInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.HealthMonitoringserver: + resultObject = Client.HealthMonitoringServerInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.MetricsServer: + resultObject = Client.MetricsServerInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableMaster: + resultObject = Client.TableMasterInstances.GetMetricDefinitions(ResourceGroupName, FarmName, InstanceId, filter); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + + return resultObject; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetrics.cs new file mode 100644 index 000000000000..d5b409a7a0f5 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/GetRoleInstanceMetrics.cs @@ -0,0 +1,103 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + + +using System; +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminRoleInstanceMetric)] + public sealed class GetRoleInstanceMetrics : AdminMetricCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// name of role + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public RoleType RoleType + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string InstanceId + { + get; + set; + } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + MetricsResult resultObject; + switch (RoleType) + { + case RoleType.AccountContainerserver: + resultObject = Client.AccountContainerServerInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.BlobFrontend: + resultObject = Client.BlobFrontendInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableFrontend: + resultObject = Client.TableFrontendInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.BlobServer: + resultObject = Client.BlobServerInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableServer: + resultObject = Client.TableServerInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.HealthMonitoringserver: + resultObject = Client.HealthMonitoringServerInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.MetricsServer: + resultObject = Client.MetricsServerInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + case RoleType.TableMaster: + resultObject = Client.TableMasterInstances.GetMetrics(ResourceGroupName, FarmName, InstanceId, filter); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + return resultObject; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RestartRoleInstance.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RestartRoleInstance.cs new file mode 100644 index 000000000000..07ec665fd2c1 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RestartRoleInstance.cs @@ -0,0 +1,111 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using Microsoft.Azure; +using Microsoft.AzureStack.Commands.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Restart-RoleInstance [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-RoleType] {enum} [-InstanceId] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsLifecycle.Restart, Nouns.AdminRoleInstance, SupportsShouldProcess = true)] + public sealed class RestartRoleInstance : AdminCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName + { + get; + set; + } + + /// + /// name of role + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public RoleType RoleType + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNullOrEmpty] + public string InstanceId + { + get; + set; + } + + protected override void Execute() + { + if (ShouldProcess( + Resources.RestartRoleInstanceVerboseDescription.FormatInvariantCulture(InstanceId, RoleType), + Resources.RestartRoleInstanceVerboseWarning.FormatInvariantCulture(InstanceId, RoleType), + Resources.ShouldProcessCaption)) + { + AzureOperationResponse response; + switch (RoleType) + { + case RoleType.AccountContainerserver: + response = Client.AccountContainerServerInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.BlobFrontend: + response = Client.BlobFrontendInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.TableFrontend: + response = Client.TableFrontendInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.BlobServer: + response = Client.BlobServerInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.TableServer: + response = Client.TableServerInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.HealthMonitoringserver: + response = Client.HealthMonitoringServerInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.MetricsServer: + response = Client.MetricsServerInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + case RoleType.TableMaster: + response = Client.TableMasterInstances.Restart(ResourceGroupName, FarmName, InstanceId); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, Resources.OperationFailedErrorMessage, response.StatusCode)); + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RoleInstanceSettingsPullNow.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RoleInstanceSettingsPullNow.cs new file mode 100644 index 000000000000..61e81d37c046 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/RoleInstanceSettingsPullNow.cs @@ -0,0 +1,105 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Globalization; +using System.Management.Automation; +using Microsoft.AzureStack.Commands.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Update-RoleInstance [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-RoleType] {enum} [[-InstanceId] {string}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsData.Update, Nouns.AdminRoleInstance, SupportsShouldProcess = true)] + public sealed class RoleInstanceSettingsPullNow : AdminCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// name of role + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public RoleType RoleType { get; set; } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string InstanceId { get; set; } + + + protected override void Execute() + { + if (ShouldProcess( + Resources.UpdateRoleInstanceSettingDescription.FormatInvariantCulture(InstanceId, RoleType), + Resources.UpdateRoleInstanceSettingWarning.FormatInvariantCulture(InstanceId, RoleType), + Resources.ShouldProcessCaption)) + { + object resultObject; + + switch (RoleType) + { + case RoleType.AccountContainerserver: + resultObject = Client.AccountContainerServerInstances.SettingsPullNow(ResourceGroupName, + FarmName, InstanceId); + break; + case RoleType.BlobFrontend: + resultObject = Client.BlobFrontendInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + case RoleType.TableFrontend: + resultObject = Client.TableFrontendInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + case RoleType.BlobServer: + resultObject = Client.BlobServerInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + case RoleType.TableServer: + resultObject = Client.TableServerInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + case RoleType.HealthMonitoringserver: + resultObject = Client.HealthMonitoringServerInstances.SettingsPullNow(ResourceGroupName, + FarmName, InstanceId); + break; + case RoleType.MetricsServer: + resultObject = Client.MetricsServerInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + case RoleType.TableMaster: + resultObject = Client.TableMasterInstances.SettingsPullNow(ResourceGroupName, FarmName, + InstanceId); + break; + default: + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, + Resources.InvalidRoleTypeErrorMessageFormat, RoleType)); + } + WriteObject(resultObject, true); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StartBlobServerRoleInstance.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StartBlobServerRoleInstance.cs new file mode 100644 index 000000000000..9c3991b97858 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StartBlobServerRoleInstance.cs @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Start-BlobServerRoleInstance [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-InstanceId] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsLifecycle.Start, Nouns.AdminBlobServerRoleInstance, SupportsShouldProcess = true)] + public sealed class StartBlobServerRoleInstance : AdminCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNullOrEmpty] + public string InstanceId + { + get; + set; + } + + protected override void Execute() + { + if (ShouldProcess( + Resources.StartBlobServerRoleInstanceVerboseDescription.FormatInvariantCulture(InstanceId), + Resources.StartBlobServerRoleInstanceVerboseWarning.FormatInvariantCulture(InstanceId), + Resources.ShouldProcessCaption)) + { + var response = Client.BlobServerInstances.Start(ResourceGroupName, FarmName, InstanceId); + + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, Resources.OperationFailedErrorMessage, response.StatusCode)); + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StopBlobServerRoleInstance.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StopBlobServerRoleInstance.cs new file mode 100644 index 000000000000..4cea201af4fe --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/RoleInstance/StopBlobServerRoleInstance.cs @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Globalization; +using System.Management.Automation; +using System.Net; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Stop-BlobServerRoleInstance [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-InstanceId] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsLifecycle.Stop, Nouns.AdminBlobServerRoleInstance, SupportsShouldProcess = true)] + public sealed class StopBlobServerRoleInstance : AdminCmdlet + { + /// + /// farm identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNullOrEmpty] + public string FarmName + { + get; + set; + } + + /// + /// instance identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNullOrEmpty] + public string InstanceId + { + get; + set; + } + + protected override void Execute() + { + if (ShouldProcess( + Resources.StopBlobServerRoleInstanceVerboseDescription.FormatInvariantCulture(InstanceId), + Resources.StopBlobServerRoleInstanceVerboseWarning.FormatInvariantCulture(InstanceId), + Resources.ShouldProcessCaption)) + { + var response = Client.BlobServerInstances.Stop(ResourceGroupName, FarmName, InstanceId); + if (response.StatusCode != HttpStatusCode.OK) + { + throw new AdminException(string.Format(CultureInfo.InvariantCulture, + Resources.OperationFailedErrorMessage, response.StatusCode)); + } + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobService.cs new file mode 100644 index 000000000000..a9b2012e011d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobService.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-BlobService [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminBlobService)] + public sealed class GetBlobService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + + protected override void Execute() + { + BlobServiceGetResponse result = Client.BlobService.Get(ResourceGroupName, FarmName); + WriteObject(new BlobServiceResponse(result.Resource)); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetricDefinitions.cs new file mode 100644 index 000000000000..9ead00633ef7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetricDefinitions.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminBlobServiceMetricDefinition)] + public sealed class GetBlobServiceMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.BlobService.GetMetricDefinitions(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetrics.cs new file mode 100644 index 000000000000..d4aa9fd5dc5e --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetBlobServiceMetrics.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminBlobServiceMetric)] + public sealed class GetBlobServiceMetrics : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.BlobService.GetMetrics(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementService.cs new file mode 100644 index 000000000000..09bfa559c67d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementService.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-ManagementService [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminManagementService)] + public sealed class GetManagementService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + + protected override void Execute() + { + ManagementServiceGetResponse result = Client.ManagementService.Get(ResourceGroupName, FarmName); + WriteObject(new ManagementServiceResponse(result.Resource)); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetricDefinitions.cs new file mode 100644 index 000000000000..d7adb09560d4 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetricDefinitions.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminManagementServiceMetricDefinition)] + public sealed class GetManagementServiceMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.ManagementService.GetMetricDefinitions(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetrics.cs new file mode 100644 index 000000000000..3cfb4c677b6c --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetManagementServiceMetrics.cs @@ -0,0 +1,43 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminManagementServiceMetric)] + public sealed class GetManagementServiceMetrics : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.ManagementService.GetMetrics(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableService.cs new file mode 100644 index 000000000000..90a822b83378 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableService.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-TableService [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminTableService)] + public sealed class GetTableService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + + protected override void Execute() + { + TableServiceGetResponse result = Client.TableService.Get(ResourceGroupName, FarmName); + WriteObject(new TableServiceResponse(result.Resource)); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetricDefinitions.cs new file mode 100644 index 000000000000..853faae6cbdb --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetricDefinitions.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminTableServiceMetricDefinition)] + public sealed class GetTableServiceMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.TableService.GetMetricDefinitions(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetrics.cs new file mode 100644 index 000000000000..72334fea4e5d --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/GetTableServiceMetrics.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminTableServiceMetric)] + public sealed class GetTableServiceMetrics : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.TableService.GetMetrics(ResourceGroupName, FarmName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetBlobService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetBlobService.cs new file mode 100644 index 000000000000..83778a65cbd7 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetBlobService.cs @@ -0,0 +1,114 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Set, Nouns.AdminBlobService, SupportsShouldProcess = true)] + public sealed class SetBlobService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + + /// + /// CpuBasedKeepAliveThrottlingEnabled + /// + [Parameter] + [SettingField] + public bool? FrontEndCpuBasedKeepAliveThrottlingEnabled + { + get; + set; + } + + + /// + /// MemoryThrottlingEnabled + /// + [Parameter] + [SettingField] + public bool? FrontEndMemoryThrottlingEnabled + { + get; + set; + } + + /// + /// ContainerGcInterval + /// + [Parameter] + [SettingField] + public int? BlobSvcContainerGcInterval + { + get; + set; + } + + /// + /// ShallowGcInterval + /// + [Parameter] + [SettingField] + public int? BlobSvcShallowGcInterval + { + get; + set; + } + + /// + /// StreamMapMinContainerOccupancyPercent + /// + [Parameter] + [SettingField] + public int? BlobSvcStreamMapMinContainerOccupancyPercent + { + get; + set; + } + + protected override void Execute() + { + string confirmString; + BlobServiceWritableSettings settings = Tools.ToSettingsObject(this, out confirmString); + + if (ShouldProcess( + Resources.SetServiceDescription.FormatInvariantCulture(Resources.BlobService, confirmString), + Resources.SetServiceWarning.FormatInvariantCulture(Resources.BlobService, confirmString), + Resources.ShouldProcessCaption)) + { + BlobServiceGetResponse result = Client.BlobService.Patch(ResourceGroupName, FarmName, new BlobServicePatchParameters + { + BlobService = new BlobServiceRequest + { + Settings = settings + } + }); + WriteObject(new BlobServiceResponse(result.Resource)); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetManagementService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetManagementService.cs new file mode 100644 index 000000000000..2fa5d953035a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetManagementService.cs @@ -0,0 +1,71 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Set, Nouns.AdminManagementService, SupportsShouldProcess = true)] + public sealed class SetManagementService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// WacContainerGcFullScanIntervalInSeconds + /// + [Parameter] + [SettingField] + public int? WacContainerGcFullScanIntervalInSeconds { get; set; } + + /// + /// WacAccountGcFullScanIntervalInSeconds + /// + [Parameter] + [SettingField] + public int? WacAccountGcFullScanIntervalInSeconds { get; set; } + + protected override void Execute() + { + string confirmString; + ManagementServiceWritableSettings settings = Tools.ToSettingsObject(this, out confirmString); + if (ShouldProcess( + Resources.SetServiceDescription.FormatInvariantCulture(Resources.ManagementService, confirmString), + Resources.SetServiceWarning.FormatInvariantCulture(Resources.ManagementService, confirmString), + Resources.ShouldProcessCaption)) + { + ManagementServiceGetResponse result = Client.ManagementService.Patch(ResourceGroupName, FarmName, + new ManagementServicePatchParameters + { + ManagementService = new ManagementServiceRequest + { + Settings = settings + } + }); + WriteObject(new ManagementServiceResponse(result.Resource)); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetTableService.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetTableService.cs new file mode 100644 index 000000000000..d665d4893e15 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Service/SetTableService.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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Set, Nouns.AdminTableService, SupportsShouldProcess = true)] + public sealed class SetTableService : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// CpuBasedKeepAliveThrottlingEnabled + /// + [Parameter] + [SettingField] + public bool? FrontEndCpuBasedKeepAliveThrottlingEnabled { get; set; } + + /// + /// MemoryThrottlingEnabled + /// + [Parameter] + [SettingField] + public bool? FrontEndMemoryThrottlingEnabled { get; set; } + + protected override void Execute() + { + string confirmString; + TableServiceWritableSettings settings = Tools.ToSettingsObject(this, out confirmString); + if (ShouldProcess( + Resources.SetServiceDescription.FormatInvariantCulture(Resources.TableService, confirmString), + Resources.SetServiceWarning.FormatInvariantCulture(Resources.TableService, confirmString), + Resources.ShouldProcessCaption)) + { + TableServiceGetResponse result = Client.TableService.Patch(ResourceGroupName, FarmName, + new TableServicePatchParameters + { + TableService = new TableServiceRequest + { + Settings = settings + } + }); + WriteObject(new TableServiceResponse(result.Resource)); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/SettingFieldAttribute.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/SettingFieldAttribute.cs new file mode 100644 index 000000000000..124db76eaad2 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/SettingFieldAttribute.cs @@ -0,0 +1,27 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Setting Field Attribute + /// + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] + public sealed class SettingFieldAttribute : Attribute + { + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShare.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShare.cs new file mode 100644 index 000000000000..ee31b1cce63f --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShare.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. +// ---------------------------------------------------------------------------------- + +using System.Linq; +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// get shares + /// + /// SYNTAX + /// Get-Share [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-ShareName] {string} [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminShare)] + public sealed class GetAdminShare : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string FarmName + { + get; + set; + } + + /// + /// + [Parameter(ValueFromPipelineByPropertyName = true)] + [ValidateNotNullOrEmpty] + public string ShareName + { + get; + set; + } + + protected override void Execute() + { + if (string.IsNullOrEmpty(ShareName)) + { + var shares = Client.Shares.List(ResourceGroupName, FarmName); + + WriteObject(shares.Shares.Select(_=>new ShareResponse(_)), true); + } + else + { + var share = Client.Shares.Get(ResourceGroupName, FarmName, ShareName); + + WriteObject(new ShareResponse(share.Share)); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetricDefinitions.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetricDefinitions.cs new file mode 100644 index 000000000000..63d2a6bbd33a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetricDefinitions.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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-ShareMetricDefinition [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [-ShareName] {string} [[-MetricNames] {string[]}] [ {CommonParameters}] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminShareMetricDefinition)] + public sealed class GetShareMetricDefinitions : AdminMetricDefinitionCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string FarmName + { + get; + set; + } + + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true)] + [ValidateNotNull] + public string ShareName + { + get; + set; + } + + /// + /// + /// + /// + /// + protected override MetricDefinitionsResult GetMetricDefinitionsResult(string filter) + { + return Client.Shares.GetMetricDefinitions(ResourceGroupName, FarmName, ShareName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetrics.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetrics.cs new file mode 100644 index 000000000000..434a9f3b5505 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Share/GetShareMetrics.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminShareMetric)] + public sealed class GetShareMetric : AdminMetricCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// share name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 8)] + public string ShareName { get; set; } + + /// + /// + /// + /// + /// + protected override MetricsResult GetMetricsResult(string filter) + { + return Client.Shares.GetMetrics(ResourceGroupName, FarmName, ShareName, filter); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/GetStorageAccountWithAdminInfo.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/GetStorageAccountWithAdminInfo.cs new file mode 100644 index 000000000000..e846e9f4342f --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/GetStorageAccountWithAdminInfo.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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; +using System.Globalization; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Get-StorageAccountsWithAdminInfo [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [[-TenantSubscriptionId] {string}] [[-StorageAccountName] {string}] + /// [[-StorageAccountStatus] {int}] [[-AccountId] {long}] [-Summary]] + /// + /// + [Cmdlet(VerbsCommon.Get, Nouns.AdminStorageAccount, DefaultParameterSetName = ListAccountsParamSet)] + public sealed class GetStorageAccountsWithAdminInfo : AdminCmdlet + { + const string ListAccountsParamSet = "ListMultipleAccounts"; + const string GetSingleAccountParamSet = "GetSingleAccount"; + + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// Tenant Subscription Id + /// + [Parameter(Mandatory = false, Position = 5, ParameterSetName = ListAccountsParamSet)] + public string TenantSubscriptionId { get; set; } + + /// + /// Storage Account Name + /// + [Parameter(Mandatory = false, Position = 6, ParameterSetName = ListAccountsParamSet)] + public string PartialAccountName { get; set; } + + /// + /// Storage Account Status + /// + [Parameter(Mandatory = false, Position = 7, ParameterSetName = ListAccountsParamSet)] + public int? StorageAccountStatus { get; set; } + + /// + /// Storage Account AccountId + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 8, ParameterSetName = GetSingleAccountParamSet)] + public long AccountId { get; set; } + + /// + /// Only need return summary information if not specified + /// + [Parameter(Mandatory = false, Position = 9)] + public SwitchParameter Detail { get; set; } + + protected override void Execute() + { + List> filters = new List>(); + + switch (ParameterSetName) + { + case GetSingleAccountParamSet: + filters.Add(new KeyValuePair(StorageAccountSearchFilterParameter.VersionedAccountName, AccountId.ToString(CultureInfo.InvariantCulture))); + break; + case ListAccountsParamSet: + if (TenantSubscriptionId != null) + filters.Add(new KeyValuePair(StorageAccountSearchFilterParameter.TenantSubscriptionId, TenantSubscriptionId)); + if (PartialAccountName != null) + filters.Add(new KeyValuePair(StorageAccountSearchFilterParameter.PartialAccountName, PartialAccountName)); + if (StorageAccountStatus.HasValue == true) + filters.Add(new KeyValuePair(StorageAccountSearchFilterParameter.StorageAccountStatus, StorageAccountStatus.Value.ToString(CultureInfo.InvariantCulture))); + break; + } + string filter = Tools.GenerateStorageAccountsSearchFilter(filters); + var response = Client.StorageAccounts.List(ResourceGroupName, FarmName, filter, !Detail.IsPresent); + if (response.StatusCode == System.Net.HttpStatusCode.OK) + { + List adminViewList = new List(); + foreach (StorageAccountModel model in response.StorageAccounts) + { + adminViewList.Add(new StorageAccountResponse(model, FarmName)); + } + WriteObject(adminViewList, true); + } + else + WriteObject(response, true); + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/SyncStorageAccount.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/SyncStorageAccount.cs new file mode 100644 index 000000000000..7802373ad199 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/SyncStorageAccount.cs @@ -0,0 +1,98 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; +using System.Globalization; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Sync-StorageAccount [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-AccountName] {string} [-ResourceLocation] {string} [-TenantSubscriptionId] {string} + /// + /// + [Cmdlet(VerbsData.Sync, Nouns.AdminStorageAccount, SupportsShouldProcess = true)] + public sealed class SyncStorageAccount : AdminCmdlet + { + /// + /// Storage Account Name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string TenantAccountName { get; set; } + + /// + /// Tenant Subscription Id + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + [ValidateNotNull] + public string TenantSubscriptionId { get; set; } + + /// + /// Resource Location + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 6)] + [ValidateNotNull] + public string Location { get; set; } + + /// + /// Tenant Resource Group + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 7)] + [ValidateNotNull] + public string TenantResourceGroup { get; set; } + + /// + /// Specify storage account api version whic resource was created with + /// + [Parameter(Mandatory = false, Position = 8)] + public string StorageAccountApiVersion { get; set; } + + + internal static string DefaultStorageAccountApiVersion = "2015-06-15"; + internal static string SyncTargetOperation = "Create"; + + internal static string BuildSyncTargetId(string tenantSubscriptionId, string resourceGroupName, string accountName) + { + return "/subscriptions/" + tenantSubscriptionId + "/resourcegroups/" + resourceGroupName + "/providers/Microsoft.Storage/storageAccounts/" + accountName; + } + + protected override void Execute() + { + StorageAccountSyncRequest req = new StorageAccountSyncRequest(); + + if (StorageAccountApiVersion == null) + StorageAccountApiVersion = DefaultStorageAccountApiVersion; + req.ApiVersion = StorageAccountApiVersion; + req.TargetOperaton = SyncTargetOperation; + req.ResourceLocation = Location; + req.Id = BuildSyncTargetId(TenantSubscriptionId, TenantResourceGroup, TenantAccountName); + + WriteObject(req, true); + + if (ShouldProcess( + string.Format(CultureInfo.InvariantCulture, Resources.StorageAccount, req.Id), + string.Format(CultureInfo.InvariantCulture, Resources.SyncOperation))) + { + StorageAccountSyncResponse syncResponse = Client.StorageAccounts.Sync(TenantSubscriptionId, TenantResourceGroup, req); + WriteObject(syncResponse, true); + + WriteWarning(Resources.WaitAfterArmSync); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/UndeleteStorageAccount.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/UndeleteStorageAccount.cs new file mode 100644 index 000000000000..553f7d8262d0 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/StorageAccount/UndeleteStorageAccount.cs @@ -0,0 +1,103 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.AzureStack.Management.StorageAdmin; +using Microsoft.AzureStack.Management.StorageAdmin.Models; +using System.Globalization; +using System; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// SYNTAX + /// Undo-StorageAccountDeletion [-SubscriptionId] {string} [-Token] {string} [-AdminUri] {Uri} [-ResourceGroupName] {string} + /// [-SkipCertificateValidation] [-FarmName] {string} [[-AccountId] {long}] [[-NewAccountName] {string}] [-TenantSubscriptionId] {string} [-Sync] {bool} [-ResourceLocation] {string} + /// + /// + [Cmdlet(VerbsCommon.Undo, Nouns.AdminStorageAccountDeletion, SupportsShouldProcess = true)] + public sealed class UndeleteStorageAccount : AdminCmdlet + { + /// + /// Farm Identifier + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 4)] + [ValidateNotNull] + public string FarmName { get; set; } + + /// + /// Storage Account Name + /// + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, Position = 5)] + public long AccountId { get; set; } + + /// + /// Storage Account Name + /// + [Parameter(Mandatory = false, Position = 6)] + public string NewAccountName { get; set; } + + /// + /// Specify storage account api version whic resource was created with + /// + [Parameter(Mandatory = false, Position = 7)] + public string StorageAccountApiVersion { get; set; } + + protected override void Execute() + { + StorageAccountUndeleteParameters undeleteParam = new StorageAccountUndeleteParameters + { + NewAccountName = NewAccountName + }; + if (ShouldProcess( + string.Format(CultureInfo.InvariantCulture, Resources.StorageAccountAdminView, AccountId), + string.Format(CultureInfo.InvariantCulture, Resources.UndeleteOperation))) + { + var response = Client.StorageAccounts.Undelete(ResourceGroupName, FarmName, AccountId.ToString(CultureInfo.InvariantCulture), undeleteParam); + if (response.StatusCode != System.Net.HttpStatusCode.OK) + { + throw new ApplicationException(String.Format(CultureInfo.InvariantCulture, Resources.FailedToUndeleteAccount)); + } + + // get recovered account to set parameters for resource sync + WriteVerbose(Resources.RetrieveUndeletedStorageAccount); + StorageAccountListResponse accounts = Client.StorageAccounts.List(ResourceGroupName, FarmName, "{versionedaccountname eq '" + AccountId + "'}", true); + if (accounts.StatusCode != System.Net.HttpStatusCode.OK || + accounts.StorageAccounts.Count == 0 || + accounts.StorageAccounts[0].Properties == null || + accounts.StorageAccounts[0].Properties.TenantSubscriptionId.Equals(Guid.Empty) == true || + accounts.StorageAccounts[0].Properties.TenantViewId == null || + accounts.StorageAccounts[0].Properties.TenantResourceGroupName == null || + accounts.StorageAccounts[0].Location == null) + { + throw new ApplicationException(String.Format(CultureInfo.InvariantCulture, Resources.FailedToGetAccount)); + } + + // trigger resource sync + WriteVerbose(Resources.TriggerResourceSync); + StorageAccountSyncRequest req = new StorageAccountSyncRequest(); + if (StorageAccountApiVersion == null) + StorageAccountApiVersion = SyncStorageAccount.DefaultStorageAccountApiVersion; + req.ApiVersion = StorageAccountApiVersion; + req.TargetOperaton = SyncStorageAccount.SyncTargetOperation; + req.ResourceLocation = accounts.StorageAccounts[0].Location; + req.Id = accounts.StorageAccounts[0].Properties.TenantViewId; + + Client.StorageAccounts.Sync(accounts.StorageAccounts[0].Properties.TenantSubscriptionId.ToString(), accounts.StorageAccounts[0].Properties.TenantResourceGroupName, req); + + WriteWarning(Resources.WaitAfterArmSync); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Tools.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Tools.cs new file mode 100644 index 000000000000..38e91888c0f4 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Tools.cs @@ -0,0 +1,142 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Xml; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + internal static class Tools + { + private static readonly string filterParameterSeperator = " and "; + + private static readonly string filterParameterConditionEqual = " eq "; + + public static TSettings ToSettingsObject(TCmdlet cmd, out string confirmString) where TSettings: new() + { + List updatedSettingStrings = new List(); + TSettings ret = new TSettings(); + foreach (PropertyInfo propertyInfo in typeof (TCmdlet).GetProperties().Where(_=>_.GetCustomAttributes(typeof(SettingFieldAttribute)).Any())) + { + var settingValue = propertyInfo.GetValue(cmd); + if (settingValue != null) + { + PropertyInfo propertyInfoInSettings = typeof(TSettings).GetProperty(propertyInfo.Name, BindingFlags.Public | BindingFlags.Instance); + if (propertyInfoInSettings == null) + { + throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "Setting key '{0}' is not valid.", propertyInfo.Name)); + } + propertyInfoInSettings.SetValue(ret, settingValue); + updatedSettingStrings.Add(Resources.SetServiceSettingParameter.FormatInvariantCulture(propertyInfo.Name, settingValue)); + } + } + confirmString = string.Join("", updatedSettingStrings); + return ret; + } + + public static string GenerateFilter(string[] metricNames) + { + string filter = string.Empty; + + if (metricNames != null && metricNames.Any()) + { + List conditions = metricNames.Select(_ => ("name.value eq '" + _ + "'")).ToList(); + + if (conditions.Count > 1) + { + filter = conditions.Aggregate((a, b) => a + " or " + b); + } + else if (conditions.Count == 1) + { + filter = conditions[0]; + } + } + + return filter; + } + + public static string GenerateFilter(string[] metricNames, DateTime startTime, DateTime endTime, + TimeGrain timeGrain = TimeGrain.Daily) + { + List filters = new List(); + + if (metricNames != null && metricNames.Any()) + { + List conditions = metricNames.Select(_ => ("name.value eq '" + _ + "'")).ToList(); + + if (conditions.Count > 1) + { + string nameFilter = conditions.Aggregate((a, b) => a + " or " + b); + nameFilter = "(" + nameFilter + ")"; + filters.Add(nameFilter); + } + else if (conditions.Count == 1) + { + filters.Add(conditions[0]); + } + } + string startTimeFilter = string.Format(CultureInfo.InvariantCulture, "startTime eq '{0:O}'", startTime.ToUniversalTime()); + + filters.Add(startTimeFilter); + + string endTimeFilter = string.Format(CultureInfo.InvariantCulture, "endTime eq '{0:O}'", endTime.ToUniversalTime()); + + filters.Add(endTimeFilter); + + string timeGrainFilter; + + switch (timeGrain) + { + case TimeGrain.Hourly: + timeGrainFilter = XmlConvert.ToString(TimeSpan.FromHours(1)); + break; + case TimeGrain.Minutely: + timeGrainFilter = XmlConvert.ToString(TimeSpan.FromMinutes(1)); + break; + default: + timeGrainFilter = XmlConvert.ToString(TimeSpan.FromDays(1)); + break; + } + + timeGrainFilter = string.Format(CultureInfo.InvariantCulture, "timeGrain eq '{0}'", timeGrainFilter); + + filters.Add(timeGrainFilter); + + string filter = filters.Aggregate((a, b) => a + " and " + b); + + return filter; + } + + public static string GenerateStorageAccountsSearchFilter(List> filters) + { + string ret = string.Empty; + for (int i = 0; i < filters.Count; i++) + { + if (i != 0) + ret += filterParameterSeperator; + ret += filters[i].Key.ToString(); + ret += filterParameterConditionEqual; + ret += "'"; + ret += filters[i].Value; + ret += "'"; + } + return ret; + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateAbsoluteUri.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateAbsoluteUri.cs new file mode 100644 index 000000000000..4da10913e1ca --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateAbsoluteUri.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + + +using System; +using System.Management.Automation; + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + /// + /// Validation for URI parameters in cmdlets + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public sealed class ValidateAbsoluteUri : ValidateArgumentsAttribute + { + /// + /// Do the validation + /// + /// The args + /// The intrinsics + protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics) + { + if (arguments == null) + { + return; + } + + var uri = arguments as Uri; + + if (uri == null) + { + throw new ValidationMetadataException(Resources.ValidateAbsoluteUriWrongType); + } + + if (!uri.IsAbsoluteUri) + { + throw new ValidationMetadataException(Resources.ValidateAbsoluteUriNotAbsolute); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateUnc.cs b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateUnc.cs new file mode 100644 index 000000000000..5cb5ed7fac6a --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/Validation/ValidateUnc.cs @@ -0,0 +1,43 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; + + +namespace Microsoft.AzureStack.Commands.StorageAdmin +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ValidateUnc : ValidateArgumentsAttribute + { + protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics) + { + if (arguments == null) + { + return; + } + var uri = arguments as Uri; + + if (uri == null) + { + throw new ValidationMetadataException(Resources.ValidateUncWrongType); + } + + if (uri.IsUnc == false) + { + throw new ValidationMetadataException(Resources.ValidateUncWrongType); + } + } + } +} diff --git a/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config new file mode 100644 index 000000000000..a2089ea273b6 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/Commands.AzureStackStorage/packages.config @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/AzureStackStorage/NuGet.Config b/src/ResourceManager/AzureStackStorage/NuGet.Config new file mode 100644 index 000000000000..2de911013532 --- /dev/null +++ b/src/ResourceManager/AzureStackStorage/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index 58059cf3f21b..7aa2810c6413 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -114,7 +114,9 @@ NestedModules = @( '.\AzureRM.DataLakeAnalytics', '.\AzureRM.DataLakeStore', '.\AzureRM.Intune', - '.\AzureRM.RecoveryServices' + '.\AzureRM.RecoveryServices', + '.\AzureRM.AzureStackAdmin', + '.\AzureRM.AzureStackStorage' ) # Functions to export from this module