From 26cdd5b88e8e519772a2355a47d6027395866c6a Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Wed, 19 Nov 2014 17:45:04 -0800 Subject: [PATCH 01/32] Add powershell commands for the Azure stream analytics service --- src/AzurePowershell.sln | 15 +- src/ResourceManager.sln | 15 +- .../AzureResourceManager.psd1 | 6 +- .../Commands.StreamAnalytics.Test.csproj | 52 ++++ .../Properties/AssemblyInfo.cs | 36 +++ .../CloudExceptionExtensions.cs | 52 ++++ .../Commands.StreamAnalytics.csproj | 180 +++++++++++++ .../Commands.StreamAnalytics/Constants.cs | 31 +++ .../GetAzureStreamAnalyticsInputCommand.cs | 75 ++++++ .../NewAzureStreamAnalyticsInputCommand.cs | 77 ++++++ .../RemoveAzureStreamAnalyticsInputCommand.cs | 66 +++++ .../Job/GetAzureStreamAnalyticsJobCommand.cs | 80 ++++++ .../Job/NewAzureStreamAnalyticsJobCommand.cs | 56 ++++ .../RemoveAzureStreamAnalyticsJobCommand.cs | 58 ++++ .../StartAzureStreamAnalyticsJobCommand.cs | 58 ++++ .../Job/StopAzureStreamAnalyticsJobCommand.cs | 58 ++++ .../MSSharedLibKey.snk | Bin 0 -> 160 bytes ...zure.Commands.StreamAnalytics.dll-Help.xml | 4 + ...ure.Commands.StreamAnalytics.format.ps1xml | 51 ++++ .../Models/CreatePSInputParameter.cs | 29 ++ .../Models/CreatePSJobParameter.cs | 27 ++ .../Models/CreatePSOutputParameter.cs | 29 ++ .../Models/CreatePSTransformationParameter.cs | 29 ++ .../Models/InputFilterOptions.cs | 25 ++ .../Models/JobFilterOptions.cs | 25 ++ .../Models/JobParametersBase.cs | 24 ++ .../Models/OutputFilterOptions.cs | 25 ++ .../Models/PSInput.cs | 67 +++++ .../Commands.StreamAnalytics/Models/PSJob.cs | 121 +++++++++ .../Models/PSOutput.cs | 67 +++++ .../Models/PSQuota.cs | 65 +++++ .../Models/PSTransformation.cs | 67 +++++ .../Models/StreamAnalyticsClient.Inputs.cs | 188 +++++++++++++ .../Models/StreamAnalyticsClient.Jobs.cs | 247 ++++++++++++++++++ .../Models/StreamAnalyticsClient.Outputs.cs | 188 +++++++++++++ ...treamAnalyticsClient.SubscriptionQuotas.cs | 41 +++ .../StreamAnalyticsClient.Transformation.cs | 127 +++++++++ .../Models/StreamAnalyticsClient.cs | 52 ++++ .../Models/StreamAnalyticsClientExtensions.cs | 32 +++ .../GetAzureStreamAnalyticsOutputCommand.cs | 75 ++++++ .../NewAzureStreamAnalyticsOutputCommand.cs | 62 +++++ ...RemoveAzureStreamAnalyticsOutputCommand.cs | 66 +++++ .../Properties/AssemblyInfo.cs | 34 +++ .../Properties/Resources.Designer.cs | 228 ++++++++++++++++ .../Properties/Resources.resx | 164 ++++++++++++ .../StreamAnalyticsBaseCmdlet.cs | 85 ++++++ .../StreamAnalyticsCommonUtilities.cs | 108 ++++++++ ...reamAnalyticsResourceProviderBaseCmdlet.cs | 28 ++ .../GetAzureStreamAnalyticsQuotasCommand.cs | 53 ++++ ...ureStreamAnalyticsTransformationCommand.cs | 57 ++++ ...ureStreamAnalyticsTransformationCommand.cs | 62 +++++ .../Commands.StreamAnalytics/packages.config | 11 + 52 files changed, 3474 insertions(+), 4 deletions(-) create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/CloudExceptionExtensions.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Constants.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/MSSharedLibKey.snk create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSInputParameter.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSJobParameter.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSOutputParameter.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSTransformationParameter.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/InputFilterOptions.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobFilterOptions.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobParametersBase.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/OutputFilterOptions.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/AssemblyInfo.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config diff --git a/src/AzurePowershell.sln b/src/AzurePowershell.sln index d06e75409380..fcbd1995967c 100644 --- a/src/AzurePowershell.sln +++ b/src/AzurePowershell.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30501.0 +VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject @@ -147,6 +147,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.Test", "ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\Commands.RecoveryServices.Test.csproj", "{A415F75B-EB6A-49A6-934E-5BA71B83D6EB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics", "ResourceManager\StreamAnalytics\Commands.StreamAnalytics\Commands.StreamAnalytics.csproj", "{F49A314A-A235-47D3-A654-1EC19ACA366C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics.Test", "ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\Commands.StreamAnalytics.Test.csproj", "{7E6683BE-ECFF-4709-89EB-1325E9E70512}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -349,6 +353,14 @@ Global {A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Debug|Any CPU.Build.0 = Debug|Any CPU {A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {A415F75B-EB6A-49A6-934E-5BA71B83D6EB}.Release|Any CPU.Build.0 = Release|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.Build.0 = Release|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -378,5 +390,6 @@ Global {F4ABAD68-64A5-4B23-B09C-42559A7524DE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {FDB897BD-FCB4-44A1-8D66-AC99F22EC737} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {A415F75B-EB6A-49A6-934E-5BA71B83D6EB} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} + {7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal diff --git a/src/ResourceManager.sln b/src/ResourceManager.sln index 2d9218889c15..e9948ee08a2c 100644 --- a/src/ResourceManager.sln +++ b/src/ResourceManager.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30501.0 +VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject @@ -37,6 +37,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RedisCache", "Reso EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RedisCache.Test", "ResourceManager\RedisCache\Commands.RedisCache.Test\Commands.RedisCache.Test.csproj", "{4AE5705F-62CF-461D-B72E-DD9DCD9B3609}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics", "ResourceManager\StreamAnalytics\Commands.StreamAnalytics\Commands.StreamAnalytics.csproj", "{F49A314A-A235-47D3-A654-1EC19ACA366C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics.Test", "ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\Commands.StreamAnalytics.Test.csproj", "{7E6683BE-ECFF-4709-89EB-1325E9E70512}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -95,6 +99,14 @@ Global {4AE5705F-62CF-461D-B72E-DD9DCD9B3609}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AE5705F-62CF-461D-B72E-DD9DCD9B3609}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AE5705F-62CF-461D-B72E-DD9DCD9B3609}.Release|Any CPU.Build.0 = Release|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F49A314A-A235-47D3-A654-1EC19ACA366C}.Release|Any CPU.Build.0 = Release|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -105,5 +117,6 @@ Global {C1BDA476-A5CC-4394-914D-48B0EC31A710} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {D4EDAD6F-6A1D-4295-9A88-CD3F69EAD42B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {4AE5705F-62CF-461D-B72E-DD9DCD9B3609} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} + {7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index 76601dfd3418..1373d2110b45 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -63,7 +63,8 @@ FormatsToProcess = @( '.\Resources\Microsoft.WindowsAzure.Commands.Profile.format.ps1xml', '.\DataFactories\Microsoft.Azure.Commands.DataFactories.format.ps1xml', '.\RedisCache\Microsoft.Azure.Commands.RedisCache.format.ps1xml', - '.\Batch\Microsoft.Azure.Commands.Batch.format.ps1xml' + '.\Batch\Microsoft.Azure.Commands.Batch.format.ps1xml', + '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml' ) # Modules to import as nested modules of the module specified in ModuleToProcess @@ -74,7 +75,8 @@ NestedModules = @( '.\Sql\Microsoft.Azure.Commands.Sql.dll', '.\DataFactories\Microsoft.Azure.Commands.DataFactories.dll', '.\RedisCache\Microsoft.Azure.Commands.RedisCache.dll', - '.\Batch\Microsoft.Azure.Commands.Batch.dll' + '.\Batch\Microsoft.Azure.Commands.Batch.dll', + '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.dll' ) # Functions to export from this module diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj new file mode 100644 index 000000000000..cf958254e897 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {7E6683BE-ECFF-4709-89EB-1325E9E70512} + Library + Properties + Commands.StreamAnalytics.Test + Commands.StreamAnalytics.Test + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..15333c3ce642 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +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("Commands.StreamAnalytics.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Commands.StreamAnalytics.Test")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("2b11c8f1-4b25-4809-b496-ea94e96d5c78")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/CloudExceptionExtensions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/CloudExceptionExtensions.cs new file mode 100644 index 000000000000..d34a67ae7da5 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/CloudExceptionExtensions.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.Collections.Generic; +using System.Globalization; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.WindowsAzure; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + internal static class CloudExceptionExtensions + { + public static CloudException CreateFormattedException(this CloudException cloudException) + { + return new CloudException( + string.Format( + CultureInfo.InvariantCulture, + Resources.FormattedCloudExceptionMessageTemplate, + cloudException.Response.StatusCode, + cloudException.ErrorCode, + cloudException.ErrorMessage, + cloudException.GetRequestId(), + DateTime.UtcNow)); + } + + public static string GetRequestId(this CloudException exception) + { + IEnumerable strings; + + if (exception.Response != null + && exception.Response.Headers != null + && exception.Response.Headers.TryGetValue("x-ms-request-id", out strings)) + { + return string.Join(";", strings); + } + + return string.Empty; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj new file mode 100644 index 000000000000..29ed8a516eae --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -0,0 +1,180 @@ + + + + + Debug + AnyCPU + {F49A314A-A235-47D3-A654-1EC19ACA366C} + Library + Properties + Microsoft.Azure.Commands.StreamAnalytics + Microsoft.Azure.Commands.StreamAnalytics + v4.5 + 512 + + ..\..\..\ + true + /assemblyCompareMode:StrongNameIgnoringVersion + + + true + full + false + ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\StreamAnalytics + DEBUG;TRACE + prompt + 4 + true + true + false + + + ..\..\..\Package\Release\ResourceManager\AzureResourceManager\StreamAnalytics + TRACE;SIGN + true + pdbonly + AnyCPU + bin\Release\Microsoft.Azure.Commands.Resources.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.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll + + + False + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + + + + + + + + + + ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll + + + False + ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.dll + + + False + ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.NetFramework.dll + + + False + ..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + False + ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + + + + + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} + Commands.Common.Storage + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {c60342b1-47d3-4a0e-8081-9b97ce60b7af} + Commands.Profile + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + + + Always + + + + + + + Always + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Constants.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Constants.cs new file mode 100644 index 000000000000..2e36f7d0f2e1 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Constants.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 System; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + internal static class Constants + { + public const string StreamAnalyticsJob = "AzureStreamAnalyticsJob"; + + public const string StreamAnalyticsInput = "AzureStreamAnalyticsInput"; + + public const string StreamAnalyticsOutput = "AzureStreamAnalyticsOutput"; + + public const string StreamAnalyticsTransformation = "AzureStreamAnalyticsTransformation"; + + public const string StreamAnalyticsQuota = "AzureStreamAnalyticsQuota"; + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs new file mode 100644 index 000000000000..f8f973e41bc9 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs @@ -0,0 +1,75 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsInput), OutputType(typeof(List), typeof(PSInput))] + public class GetAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics input name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name == null || string.IsNullOrWhiteSpace(Name)) + { + Name = string.Empty; + } + + InputFilterOptions filterOptions = new InputFilterOptions() + { + Name = Name, + JobName = JobName, + ResourceGroupName = ResourceGroupName + }; + + List inputs = StreamAnalyticsClient.FilterPSInputs(filterOptions); + + if (inputs != null) + { + if (inputs.Count == 1 && Name != null) + { + WriteObject(inputs[0]); + } + else + { + WriteObject(inputs, true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs new file mode 100644 index 000000000000..c36bf8bc5ab7 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.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. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsInput), OutputType(typeof(PSInput))] + public class NewAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics input name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics input JSON file path.")] + [ValidateNotNullOrEmpty] + public string File { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (File != null && string.IsNullOrWhiteSpace(File)) + { + throw new PSArgumentNullException("File"); + } + + string rawJsonContent = StreamAnalyticsClient.ReadJsonFileContent(this.TryResolvePath(File)); + + Name = ResolveResourceName(rawJsonContent, Name, "Input"); + + CreatePSInputParameter parameter = new CreatePSInputParameter + { + ResourceGroupName = ResourceGroupName, + JobName = JobName, + InputName = Name, + RawJsonContent = rawJsonContent, + Force = Force.IsPresent, + ConfirmAction = ConfirmAction + }; + + WriteObject(StreamAnalyticsClient.CreatePSInput(parameter)); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs new file mode 100644 index 000000000000..aad3e4842335 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsInput)] + public class RemoveAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics input name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + + // TODO: change to async call + HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSInput(ResourceGroupName, JobName, Name); + if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.InputNotFound, Name, JobName, ResourceGroupName)); + } + else + { + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs new file mode 100644 index 000000000000..692dcde5506b --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.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 System.Collections.Generic; +using System.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsJob), OutputType(typeof(List), typeof(PSJob))] + public class GetAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The switch to specify whether the job entity should be expanded.")] + [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The switch to specify whether the job entity should be expanded.")] + public SwitchParameter NoExpand { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ParameterSetName == SingleStreamAnalyticsObject) + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + } + + string propertiesToExpand = "inputs,transformation,outputs"; + if (NoExpand.IsPresent) + { + propertiesToExpand = string.Empty; + } + + JobFilterOptions filterOptions = new JobFilterOptions + { + JobName = Name, + ResourceGroupName = ResourceGroupName, + PropertiesToExpand = propertiesToExpand + }; + + List jobs = StreamAnalyticsClient.FilterPSJobs(filterOptions); + + if (jobs != null) + { + if (jobs.Count == 1 && Name != null) + { + WriteObject(jobs[0]); + } + else + { + WriteObject(jobs, true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs new file mode 100644 index 000000000000..ed5dbf3173a0 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs @@ -0,0 +1,56 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsJob), OutputType(typeof(PSJob))] + public class NewAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, HelpMessage = "The stream analytics job JSON file path.")] + [ValidateNotNullOrEmpty] + public string File { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + string rawJsonContent = StreamAnalyticsClient.ReadJsonFileContent(this.TryResolvePath(File)); + + Name = ResolveResourceName(rawJsonContent, Name, "Job"); + + CreatePSJobParameter parameter = new CreatePSJobParameter + { + ResourceGroupName = ResourceGroupName, + JobName = Name, + RawJsonContent = rawJsonContent, + Force = Force.IsPresent, + ConfirmAction = ConfirmAction + }; + + WriteObject(StreamAnalyticsClient.CreatePSJob(parameter)); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs new file mode 100644 index 000000000000..27c659710724 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.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.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsJob)] + public class RemoveAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + JobParametersBase parameter = new JobParametersBase() + { + ResourceGroupName = ResourceGroupName, + JobName = Name + }; + + // TODO: change to async call + HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSJob(parameter); + if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.JobNotFound, Name, ResourceGroupName)); + } + else + { + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs new file mode 100644 index 000000000000..7b2517105bf7 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.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.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsLifecycle.Start, Constants.StreamAnalyticsJob)] + public class StartAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + JobParametersBase parameter = new JobParametersBase() + { + ResourceGroupName = ResourceGroupName, + JobName = Name + }; + + // TODO: change to async call + HttpStatusCode statusCode = StreamAnalyticsClient.StartPSJob(parameter); + if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.JobNotFound, Name, ResourceGroupName)); + } + else + { + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs new file mode 100644 index 000000000000..e2a9580baff6 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.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.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsLifecycle.Stop, Constants.StreamAnalyticsJob)] + public class StopAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + JobParametersBase parameter = new JobParametersBase() + { + ResourceGroupName = ResourceGroupName, + JobName = Name + }; + + // TODO: change to async call + HttpStatusCode statusCode = StreamAnalyticsClient.StopPSJob(parameter); + if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.JobNotFound, Name, ResourceGroupName)); + } + else + { + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/MSSharedLibKey.snk b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ + + + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml new file mode 100644 index 000000000000..5a6c54089ee5 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml @@ -0,0 +1,51 @@ + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob + + + + + + + + JobName + + + + ResourceGroupName + + + + Location + + + + CreatedDate + + + + ProvisioningState + + + + JobState + + + + Tags + + + + PropertiesInJson + + + + + + + + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSInputParameter.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSInputParameter.cs new file mode 100644 index 000000000000..111c3841649f --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSInputParameter.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Azure.Commands.StreamAnalytics.Models +{ + public class CreatePSInputParameter : JobParametersBase + { + public string InputName { get; set; } + + public string RawJsonContent { get; set; } + + public bool Force { get; set; } + + public Action ConfirmAction { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSJobParameter.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSJobParameter.cs new file mode 100644 index 000000000000..258dc06b9718 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSJobParameter.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.Azure.Commands.StreamAnalytics.Models +{ + public class CreatePSJobParameter : JobParametersBase + { + public string RawJsonContent { get; set; } + + public bool Force { get; set; } + + public Action ConfirmAction { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSOutputParameter.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSOutputParameter.cs new file mode 100644 index 000000000000..55530987b647 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSOutputParameter.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Azure.Commands.StreamAnalytics.Models +{ + public class CreatePSOutputParameter : JobParametersBase + { + public string OutputName { get; set; } + + public string RawJsonContent { get; set; } + + public bool Force { get; set; } + + public Action ConfirmAction { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSTransformationParameter.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSTransformationParameter.cs new file mode 100644 index 000000000000..48d4b872b635 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/CreatePSTransformationParameter.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Azure.Commands.StreamAnalytics.Models +{ + public class CreatePSTransformationParameter : JobParametersBase + { + public string TransformationName { get; set; } + + public string RawJsonContent { get; set; } + + public bool Force { get; set; } + + public Action ConfirmAction { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/InputFilterOptions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/InputFilterOptions.cs new file mode 100644 index 000000000000..c06ecb6e50d1 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/InputFilterOptions.cs @@ -0,0 +1,25 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class InputFilterOptions + { + public string Name { get; set; } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobFilterOptions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobFilterOptions.cs new file mode 100644 index 000000000000..c097cd272c3a --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobFilterOptions.cs @@ -0,0 +1,25 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class JobFilterOptions + { + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + + public string PropertiesToExpand { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobParametersBase.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobParametersBase.cs new file mode 100644 index 000000000000..18eb5530db21 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/JobParametersBase.cs @@ -0,0 +1,24 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class JobParametersBase + { + public string ResourceGroupName { get; set; } + + public string JobName { get; set; } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/OutputFilterOptions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/OutputFilterOptions.cs new file mode 100644 index 000000000000..0ab55309dbe5 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/OutputFilterOptions.cs @@ -0,0 +1,25 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class OutputFilterOptions + { + public string Name { get; set; } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs new file mode 100644 index 000000000000..b164b6cdfddf --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.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. +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Azure.Management.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class PSInput + { + private Input input; + + public PSInput() + { + input = new Input(); + } + + public PSInput(Input input) + { + if (input == null) + { + throw new ArgumentNullException("input"); + } + + this.input = input; + } + + public string Name + { + get + { + return input.Name; + } + set + { + input.Name = value; + } + } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + + public InputProperties Properties + { + get + { + return input.InputProperties; + } + set + { + input.InputProperties = value; + } + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs new file mode 100644 index 000000000000..35b653a2628f --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs @@ -0,0 +1,121 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Azure.Management.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class PSJob + { + private Job job; + + public PSJob() + { + job = new Job(); + } + + public PSJob(Job job) + { + if (job == null) + { + throw new ArgumentNullException("job"); + } + + this.job = job; + } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + + public string Location + { + get + { + return job.Location; + } + set + { + job.Location = value; + } + } + + public DateTime? CreatedDate + { + get + { + return job.Properties.CreatedDate; + } + set + { + job.Properties.CreatedDate = value; + } + } + + public string ProvisioningState + { + get + { + return job.Properties.ProvisioningState; + } + set + { + job.Properties.ProvisioningState = value; + } + } + + public string JobState + { + get + { + return job.Properties.JobState; + } + set + { + job.Properties.JobState = value; + } + } + + public IDictionary Tags + { + get + { + return job.Tags; + } + set + { + job.Tags = value; + } + } + + public JobProperties Properties + { + get + { + return job.Properties; + } + set + { + job.Properties = value; + } + } + + public string PropertiesInJson + { + get { return job.Properties.ToFormattedString(); } + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs new file mode 100644 index 000000000000..4e3426626e87 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.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. +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Azure.Management.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class PSOutput + { + private Output output; + + public PSOutput() + { + output = new Output(); + } + + public PSOutput(Output output) + { + if (output == null) + { + throw new ArgumentNullException("output"); + } + + this.output = output; + } + + public string Name + { + get + { + return output.Name; + } + set + { + output.Name = value; + } + } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + + public OutputProperties Properties + { + get + { + return output.OutputProperties; + } + set + { + output.OutputProperties = value; + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs new file mode 100644 index 000000000000..6939b89613b2 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.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. +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Azure.Management.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class PSQuota + { + private SubscriptionQuotas subscriptionQuotas; + + public PSQuota() + { + subscriptionQuotas = new SubscriptionQuotas(); + } + + public PSQuota(SubscriptionQuotas subscriptionQuotas) + { + if (subscriptionQuotas == null) + { + throw new ArgumentNullException("subscriptionQuotas"); + } + + this.subscriptionQuotas = subscriptionQuotas; + } + + public string Name + { + get + { + return subscriptionQuotas.Name; + } + set + { + subscriptionQuotas.Name = value; + } + } + + public string Location { get; set; } + + public SubscriptionQuotasProperties Properties + { + get + { + return subscriptionQuotas.Properties; + } + set + { + subscriptionQuotas.Properties = value; + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs new file mode 100644 index 000000000000..b2844b0756f4 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.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. +// ---------------------------------------------------------------------------------- + +using System; +using Microsoft.Azure.Management.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public class PSTransformation + { + private Transformation transformation; + + public PSTransformation() + { + transformation = new Transformation(); + } + + public PSTransformation(Transformation transformation) + { + if (transformation == null) + { + throw new ArgumentNullException("transformation"); + } + + this.transformation = transformation; + } + + public string Name + { + get + { + return transformation.Name; + } + set + { + transformation.Name = value; + } + } + + public string JobName { get; set; } + + public string ResourceGroupName { get; set; } + + public TransformationProperties Properties + { + get + { + return transformation.TransformationProperties; + } + set + { + transformation.TransformationProperties = value; + } + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs new file mode 100644 index 000000000000..a2c380bee0bf --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs @@ -0,0 +1,188 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.Azure.Management.StreamAnalytics; +using Microsoft.Azure.Management.StreamAnalytics.Models; +using Microsoft.WindowsAzure; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public virtual PSInput GetInput(string resourceGroupName, string jobName, string name) + { + var response = StreamAnalyticsManagementClient.Input.Get( + resourceGroupName, jobName, name); + + return new PSInput(response.Input) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }; + } + + public virtual List ListInputs(string resourceGroupName, string jobName) + { + List inputs = new List(); + + var response = StreamAnalyticsManagementClient.Input.ListInputInJob(resourceGroupName, jobName); + + if (response != null && response.Value != null) + { + foreach (var input in response.Value) + { + inputs.Add(new PSInput(input) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }); + } + } + + return inputs; + } + + public virtual List FilterPSInputs(InputFilterOptions filterOptions) + { + if (filterOptions == null) + { + throw new ArgumentNullException("filterOptions"); + } + + if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) + { + throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty); + } + + if (string.IsNullOrWhiteSpace(filterOptions.JobName)) + { + throw new ArgumentException(Resources.JobNameCannotBeEmpty); + } + + List inputs = new List(); + + if (!string.IsNullOrWhiteSpace(filterOptions.Name)) + { + inputs.Add(GetInput(filterOptions.ResourceGroupName, filterOptions.JobName, filterOptions.Name)); + } + else + { + inputs.AddRange(ListInputs(filterOptions.ResourceGroupName, filterOptions.JobName)); + } + + return inputs; + } + + protected virtual Input CreateOrUpdatePSInput(string resourceGroupName, string jobName, string inputName, string rawJsonContent) + { + if (string.IsNullOrWhiteSpace(rawJsonContent)) + { + throw new ArgumentNullException("rawJsonContent"); + } + + // If create failed, the current behavior is to throw + var response = StreamAnalyticsManagementClient.Input.CreateOrUpdateWithRawJsonContent( + resourceGroupName, + jobName, + inputName, + new InputCreateOrUpdateWithRawJsonContentParameters() { Content = rawJsonContent }); + + return response.Input; + } + + public virtual PSInput CreatePSInput(CreatePSInputParameter parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + PSInput input = null; + Action createInput = () => + { + input = + new PSInput(CreateOrUpdatePSInput(parameter.ResourceGroupName, + parameter.JobName, + parameter.InputName, + parameter.RawJsonContent)) + { + ResourceGroupName = parameter.ResourceGroupName, + JobName = parameter.JobName + }; + }; + + if (parameter.Force) + { + // If user decides to overwrite anyway, then there is no need to check if the linked service exists or not. + createInput(); + } + else + { + bool inputExists = CheckInputExists(parameter.ResourceGroupName, parameter.JobName, parameter.InputName); + + parameter.ConfirmAction( + !inputExists, + string.Format( + CultureInfo.InvariantCulture, + Resources.InputExists, + parameter.InputName, + parameter.JobName, + parameter.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.InputCreating, + parameter.InputName, + parameter.JobName, + parameter.ResourceGroupName), + parameter.InputName, + createInput); + } + + return input; + } + + public virtual HttpStatusCode RemovePSInput(string resourceGroupName, string jobName, string inputName) + { + OperationResponse response = StreamAnalyticsManagementClient.Input.Delete(resourceGroupName, jobName, inputName); + + return response.StatusCode; + } + + private bool CheckInputExists(string resourceGroupName, string jobName, string inputName) + { + try + { + PSInput input = GetInput(resourceGroupName, jobName, inputName); + return true; + } + catch (CloudException e) + { + //Get throws Exception message with NotFound Status + if (e.Response.StatusCode == HttpStatusCode.NotFound) + { + return false; + } + else + { + throw; + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs new file mode 100644 index 000000000000..78e705321d7c --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs @@ -0,0 +1,247 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.Azure.Management.StreamAnalytics; +using Microsoft.Azure.Management.StreamAnalytics.Models; +using Microsoft.WindowsAzure; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public virtual PSJob GetJob(string resourceGroupName, string jobName, string propertiesToExpand) + { + JobGetParameters parameters = new JobGetParameters(propertiesToExpand); + var response = StreamAnalyticsManagementClient.Job.Get( + resourceGroupName, jobName, parameters); + + return new PSJob(response.Job) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }; + } + + public virtual List ListJobs(string resourceGroupName, string propertiesToExpand) + { + List jobs = new List(); + JobListParameters parameters = new JobListParameters(propertiesToExpand); + var response = StreamAnalyticsManagementClient.Job.ListJobsInResourceGroup(resourceGroupName, parameters); + + if (response != null && response.Value != null) + { + foreach (var job in response.Value) + { + jobs.Add(new PSJob(job) + { + ResourceGroupName = resourceGroupName, + JobName = job.Name + }); + } + } + + return jobs; + } + + public virtual List ListJobs(string propertiesToExpand) + { + List jobs = new List(); + JobListParameters parameters = new JobListParameters(propertiesToExpand); + var response = StreamAnalyticsManagementClient.Job.ListJobsInSubscription(parameters); + + if (response != null && response.Value != null) + { + foreach (var job in response.Value) + { + jobs.Add(new PSJob(job) + { + JobName = job.Name + }); + } + } + + return jobs; + } + + public virtual List FilterPSJobs(JobFilterOptions filterOptions) + { + if (filterOptions == null) + { + throw new ArgumentNullException("filterOptions"); + } + + List jobs = new List(); + + if (!string.IsNullOrWhiteSpace(filterOptions.JobName)) + { + if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) + { + throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty); + } + + jobs.Add(GetJob(filterOptions.ResourceGroupName, filterOptions.JobName, + filterOptions.PropertiesToExpand)); + } + else if (!string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) + { + jobs.AddRange(ListJobs(filterOptions.ResourceGroupName, filterOptions.PropertiesToExpand)); + } + else + { + jobs.AddRange(ListJobs(filterOptions.PropertiesToExpand)); + } + + return jobs; + } + + public virtual PSJob CreateOrUpdatePSJob(string resourceGroupName, string jobName, string rawJsonContent) + { + if (string.IsNullOrWhiteSpace(rawJsonContent)) + { + throw new ArgumentNullException("rawJsonContent"); + } + + // If create failed, the current behavior is to throw + var response = + StreamAnalyticsManagementClient.Job.CreateOrUpdateWithRawJsonContent( + resourceGroupName, + jobName, + new JobCreateOrUpdateWithRawJsonContentParameters() { Content = rawJsonContent }); + + return new PSJob(response.Job) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }; + } + + public virtual PSJob CreatePSJob(CreatePSJobParameter parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + PSJob job = null; + Action createJob = () => + { + job = CreateOrUpdatePSJob(parameter.ResourceGroupName, parameter.JobName, parameter.RawJsonContent); + }; + + if (parameter.Force) + { + // If user decides to overwrite anyway, then there is no need to check if the linked service exists or not. + createJob(); + } + else + { + bool jobExists = CheckJobExists(parameter.ResourceGroupName, parameter.JobName); + + parameter.ConfirmAction( + !jobExists, + string.Format( + CultureInfo.InvariantCulture, + Resources.JobExists, + parameter.JobName, + parameter.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.JobCreating, + parameter.JobName, + parameter.ResourceGroupName), + parameter.JobName, + createJob); + } + + return job; + } + + public virtual HttpStatusCode StartPSJob(string resourceGroupName, string jobName) + { + OperationResponse response = StreamAnalyticsManagementClient.Job.Start(resourceGroupName, jobName); + + return response.StatusCode; + } + + public virtual HttpStatusCode StartPSJob(JobParametersBase parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + return StartPSJob(parameter.ResourceGroupName, parameter.JobName); + } + + public virtual HttpStatusCode StopPSJob(string resourceGroupName, string jobName) + { + OperationResponse response = StreamAnalyticsManagementClient.Job.Stop(resourceGroupName, jobName); + + return response.StatusCode; + } + + public virtual HttpStatusCode StopPSJob(JobParametersBase parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + return StopPSJob(parameter.ResourceGroupName, parameter.JobName); + } + + public virtual HttpStatusCode RemovePSJob(string resourceGroupName, string jobName) + { + OperationResponse response = StreamAnalyticsManagementClient.Job.Delete(resourceGroupName, jobName); + + return response.StatusCode; + } + + public virtual HttpStatusCode RemovePSJob(JobParametersBase parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + return RemovePSJob(parameter.ResourceGroupName, parameter.JobName); + } + + private bool CheckJobExists(string resourceGroupName, string jobName) + { + try + { + PSJob job = GetJob(resourceGroupName, jobName, string.Empty); + return true; + } + catch (CloudException e) + { + //Get throws Exception message with NotFound Status + if (e.Response.StatusCode == HttpStatusCode.NotFound) + { + return false; + } + else + { + throw; + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs new file mode 100644 index 000000000000..0fe282f75deb --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs @@ -0,0 +1,188 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.Azure.Management.StreamAnalytics; +using Microsoft.Azure.Management.StreamAnalytics.Models; +using Microsoft.WindowsAzure; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public virtual PSOutput GetOutput(string resourceGroupName, string jobName, string name) + { + var response = StreamAnalyticsManagementClient.Output.Get( + resourceGroupName, jobName, name); + + return new PSOutput(response.Output) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }; + } + + public virtual List ListOutputs(string resourceGroupName, string jobName) + { + List outputs = new List(); + + var response = StreamAnalyticsManagementClient.Output.ListOutputInJob(resourceGroupName, jobName); + + if (response != null && response.Value != null) + { + foreach (var output in response.Value) + { + outputs.Add(new PSOutput(output) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }); + } + } + + return outputs; + } + + public virtual List FilterPSOutputs(OutputFilterOptions filterOptions) + { + if (filterOptions == null) + { + throw new ArgumentNullException("filterOptions"); + } + + if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) + { + throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty); + } + + if (string.IsNullOrWhiteSpace(filterOptions.JobName)) + { + throw new ArgumentException(Resources.JobNameCannotBeEmpty); + } + + List outputs = new List(); + + if (!string.IsNullOrWhiteSpace(filterOptions.Name)) + { + outputs.Add(GetOutput(filterOptions.ResourceGroupName, filterOptions.JobName, filterOptions.Name)); + } + else + { + outputs.AddRange(ListOutputs(filterOptions.ResourceGroupName, filterOptions.JobName)); + } + + return outputs; + } + + protected virtual Output CreateOrUpdatePSOutput(string resourceGroupName, string jobName, string outputName, string rawJsonContent) + { + if (string.IsNullOrWhiteSpace(rawJsonContent)) + { + throw new ArgumentNullException("rawJsonContent"); + } + + // If create failed, the current behavior is to throw + var response = StreamAnalyticsManagementClient.Output.CreateOrUpdateWithRawJsonContent( + resourceGroupName, + jobName, + outputName, + new OutputCreateOrUpdateWithRawJsonContentParameters() { Content = rawJsonContent }); + + return response.Output; + } + + public virtual PSOutput CreatePSOutput(CreatePSOutputParameter parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + PSOutput output = null; + Action createOutput = () => + { + output = + new PSOutput(CreateOrUpdatePSOutput(parameter.ResourceGroupName, + parameter.JobName, + parameter.OutputName, + parameter.RawJsonContent)) + { + ResourceGroupName = parameter.ResourceGroupName, + JobName = parameter.JobName + }; + }; + + if (parameter.Force) + { + // If user decides to overwrite anyway, then there is no need to check if the linked service exists or not. + createOutput(); + } + else + { + bool outputExists = CheckOutputExists(parameter.ResourceGroupName, parameter.JobName, parameter.OutputName); + + parameter.ConfirmAction( + !outputExists, + string.Format( + CultureInfo.InvariantCulture, + Resources.OutputExists, + parameter.OutputName, + parameter.JobName, + parameter.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.OutputCreating, + parameter.OutputName, + parameter.JobName, + parameter.ResourceGroupName), + parameter.OutputName, + createOutput); + } + + return output; + } + + public virtual HttpStatusCode RemovePSOutput(string resourceGroupName, string jobName, string outputName) + { + OperationResponse response = StreamAnalyticsManagementClient.Output.Delete(resourceGroupName, jobName, outputName); + + return response.StatusCode; + } + + private bool CheckOutputExists(string resourceGroupName, string jobName, string outputName) + { + try + { + PSOutput output = GetOutput(resourceGroupName, jobName, outputName); + return true; + } + catch (CloudException e) + { + //Get throws Exception message with NotFound Status + if (e.Response.StatusCode == HttpStatusCode.NotFound) + { + return false; + } + else + { + throw; + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs new file mode 100644 index 000000000000..c31bc97944ef --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs @@ -0,0 +1,41 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Azure.Management.StreamAnalytics; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public virtual List GetQuotas(string location) + { + List quotas = new List(); + var response = StreamAnalyticsManagementClient.Subscription.GetQuotas(location); + + if (response != null && response.Value != null) + { + foreach (var quota in response.Value) + { + quotas.Add(new PSQuota(quota) + { + Location = location + }); + } + } + + return quotas; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs new file mode 100644 index 000000000000..9fe3c81c8557 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs @@ -0,0 +1,127 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Net; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.Azure.Management.StreamAnalytics; +using Microsoft.Azure.Management.StreamAnalytics.Models; +using Microsoft.WindowsAzure; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public virtual PSTransformation GetTransformation(string resourceGroupName, string jobName, string transformationName) + { + var response = StreamAnalyticsManagementClient.Transformation.Get(resourceGroupName, jobName, transformationName); + + return new PSTransformation(response.Transformation) + { + ResourceGroupName = resourceGroupName, + JobName = jobName + }; + } + + protected virtual Transformation CreateOrUpdatePSTransformation(string resourceGroupName, string jobName, string transformationName, string rawJsonContent) + { + if (string.IsNullOrWhiteSpace(rawJsonContent)) + { + throw new ArgumentNullException("rawJsonContent"); + } + + // If create failed, the current behavior is to throw + var response = StreamAnalyticsManagementClient.Transformation.CreateOrUpdateWithRawJsonContent( + resourceGroupName, + jobName, + transformationName, + new TransformationCreateOrUpdateWithRawJsonContentParameters() { Content = rawJsonContent }); + + return response.Transformation; + } + + public virtual PSTransformation CreatePSTransformation(CreatePSTransformationParameter parameter) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + PSTransformation transformation = null; + Action createTransformation = () => + { + transformation = + new PSTransformation(CreateOrUpdatePSTransformation(parameter.ResourceGroupName, + parameter.JobName, + parameter.TransformationName, + parameter.RawJsonContent)) + { + ResourceGroupName = parameter.ResourceGroupName, + JobName = parameter.JobName + }; + }; + + if (parameter.Force) + { + // If user decides to overwrite anyway, then there is no need to check if the linked service exists or not. + createTransformation(); + } + else + { + bool transformationExists = CheckTransformationExists(parameter.ResourceGroupName, parameter.JobName, parameter.TransformationName); + + parameter.ConfirmAction( + !transformationExists, + string.Format( + CultureInfo.InvariantCulture, + Resources.TransformationExists, + parameter.TransformationName, + parameter.JobName, + parameter.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.TransformationCreating, + parameter.TransformationName, + parameter.JobName, + parameter.ResourceGroupName), + parameter.TransformationName, + createTransformation); + } + + return transformation; + } + + private bool CheckTransformationExists(string resourceGroupName, string jobName, string transformationName) + { + try + { + PSTransformation transformation = GetTransformation(resourceGroupName, jobName, transformationName); + return true; + } + catch (CloudException e) + { + //Get throws Exception message with NotFound Status + if (e.Response.StatusCode == HttpStatusCode.NotFound) + { + return false; + } + else + { + throw; + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.cs new file mode 100644 index 000000000000..1cfb6e5bc089 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.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.IO; +using Microsoft.Azure.Management.StreamAnalytics; +using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.WindowsAzure.Commands.Common.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics.Models +{ + public partial class StreamAnalyticsClient + { + public IStreamAnalyticsManagementClient StreamAnalyticsManagementClient { get; private set; } + + public StreamAnalyticsClient(AzureContext context) + { + StreamAnalyticsManagementClient = AzureSession.ClientFactory.CreateClient( + context, AzureEnvironment.Endpoint.ResourceManager); + } + + /// + /// Parameterless constructor for Mocking. + /// + public StreamAnalyticsClient() + { + } + + public virtual string ReadJsonFileContent(string path) + { + if (!File.Exists(path)) + { + throw new FileNotFoundException(path); + } + + using (TextReader reader = new StreamReader(path)) + { + return reader.ReadToEnd(); + } + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs new file mode 100644 index 000000000000..91b7ced587f0 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.StreamAnalytics.Models; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + internal static class StreamAnalyticsClientExtensions + { + public static string ToFormattedString(this JobProperties properties) + { + return JsonConvert.SerializeObject(properties, Formatting.Indented); + } + + public static string ToFormattedString(T objectToSerialize) + { + return JsonConvert.SerializeObject(objectToSerialize, Formatting.Indented); + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs new file mode 100644 index 000000000000..b9d99f65685e --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs @@ -0,0 +1,75 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsOutput), OutputType(typeof(List), typeof(PSOutput))] + public class GetAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics output name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name == null || string.IsNullOrWhiteSpace(Name)) + { + Name = string.Empty; + } + + OutputFilterOptions filterOptions = new OutputFilterOptions() + { + Name = Name, + JobName = JobName, + ResourceGroupName = ResourceGroupName + }; + + List outputs = StreamAnalyticsClient.FilterPSOutputs(filterOptions); + + if (outputs != null) + { + if (outputs.Count == 1 && Name != null) + { + WriteObject(outputs[0]); + } + else + { + WriteObject(outputs, true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs new file mode 100644 index 000000000000..ab38d322eb3d --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.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 System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsOutput), OutputType(typeof(PSOutput))] + public class NewAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics output name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics output JSON file path.")] + [ValidateNotNullOrEmpty] + public string File { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + string rawJsonContent = StreamAnalyticsClient.ReadJsonFileContent(this.TryResolvePath(File)); + + Name = ResolveResourceName(rawJsonContent, Name, "Output"); + + CreatePSOutputParameter parameter = new CreatePSOutputParameter + { + ResourceGroupName = ResourceGroupName, + JobName = JobName, + OutputName = Name, + RawJsonContent = rawJsonContent, + Force = Force.IsPresent, + ConfirmAction = ConfirmAction + }; + + WriteObject(StreamAnalyticsClient.CreatePSOutput(parameter)); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs new file mode 100644 index 000000000000..55566fe96891 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsOutput)] + public class RemoveAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics output name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + + // TODO: change to async call + HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSOutput(ResourceGroupName, JobName, Name); + if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.OutputNotFound, Name, JobName, ResourceGroupName)); + } + else + { + WriteObject(true); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/AssemblyInfo.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..ab2f34f6f059 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// 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.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - StreamAnalytics Manager")] +[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("9188beb8-68c3-404a-91e2-6f287f162a52")] +[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)] +[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)] +#if SIGN +[assembly: InternalsVisibleTo("Microsoft.Azure.Commands.StreamAnalytics.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +#else +[assembly: InternalsVisibleTo("Microsoft.Azure.Commands.StreamAnalytics.Test")] +#endif \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..31bd7c8de92f --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs @@ -0,0 +1,228 @@ +//------------------------------------------------------------------------------ +// +// 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.Azure.Commands.StreamAnalytics.Properties { + 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.Azure.Commands.StreamAnalytics.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)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to {0} name provided using -Name switch: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}'. + /// + internal static string ExtractedNameFromJsonMismatchWarning { + get { + return ResourceManager.GetString("ExtractedNameFromJsonMismatchWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HTTP Status Code: {0} + ///Error Code: {1} + ///Error Message: {2} + ///Request Id: {3} + ///Timestamp (Utc):{4}. + /// + internal static string FormattedCloudExceptionMessageTemplate { + get { + return ResourceManager.GetString("FormattedCloudExceptionMessageTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating input '{0}' in stream analytics job {1} in resource group '{2}'.. + /// + internal static string InputCreating { + get { + return ResourceManager.GetString("InputCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An input with the name {0} in the stream analytics job {1} in the resource group {2} already exists. + ///Continuing execution may overwrite the exisiting one. + ///Are you sure you want to continue?. + /// + internal static string InputExists { + get { + return ResourceManager.GetString("InputExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Input '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. + /// + internal static string InputNotFound { + get { + return ResourceManager.GetString("InputNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again.. + /// + internal static string InvalidJson { + get { + return ResourceManager.GetString("InvalidJson", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating job '{0}' in resource group '{1}'.. + /// + internal static string JobCreating { + get { + return ResourceManager.GetString("JobCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A job with the name {0} in the resource group {1} already exists. + ///Continuing execution may overwrite the exisiting one. + ///Are you sure you want to continue?. + /// + internal static string JobExists { + get { + return ResourceManager.GetString("JobExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stream analytics job name cannot be null.. + /// + internal static string JobNameCannotBeEmpty { + get { + return ResourceManager.GetString("JobNameCannotBeEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Job '{0}' does not exist in the resource group '{1}'.. + /// + internal static string JobNotFound { + get { + return ResourceManager.GetString("JobNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating output '{0}' in stream analytics job {1} in resource group '{2}'.. + /// + internal static string OutputCreating { + get { + return ResourceManager.GetString("OutputCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An output with the name {0} in the stream analytics job {1} in the resource group {2} already exists. + ///Continuing execution may overwrite the exisiting one. + ///Are you sure you want to continue?. + /// + internal static string OutputExists { + get { + return ResourceManager.GetString("OutputExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Output '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. + /// + internal static string OutputNotFound { + get { + return ResourceManager.GetString("OutputNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource group name cannot be null.. + /// + internal static string ResourceGroupNameCannotBeEmpty { + get { + return ResourceManager.GetString("ResourceGroupNameCannotBeEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating transformation '{0}' in stream analytics job {1} in resource group '{2}'.. + /// + internal static string TransformationCreating { + get { + return ResourceManager.GetString("TransformationCreating", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to An transformation with the name {0} in the stream analytics job {1} in the resource group {2} already exists. + ///Continuing execution may overwrite the exisiting one. + ///Are you sure you want to continue?. + /// + internal static string TransformationExists { + get { + return ResourceManager.GetString("TransformationExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Transformation '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. + /// + internal static string TransformationNotFound { + get { + return ResourceManager.GetString("TransformationNotFound", resourceCulture); + } + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx new file mode 100644 index 000000000000..cc238f39004f --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + HTTP Status Code: {0} +Error Code: {1} +Error Message: {2} +Request Id: {3} +Timestamp (Utc):{4} + + + Resource group name cannot be null. + + + Stream analytics job name cannot be null. + + + Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again. + + + {0} name provided using -Name switch: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}' + + + A job with the name {0} in the resource group {1} already exists. +Continuing execution may overwrite the exisiting one. +Are you sure you want to continue? + + + An input with the name {0} in the stream analytics job {1} in the resource group {2} already exists. +Continuing execution may overwrite the exisiting one. +Are you sure you want to continue? + + + An output with the name {0} in the stream analytics job {1} in the resource group {2} already exists. +Continuing execution may overwrite the exisiting one. +Are you sure you want to continue? + + + An transformation with the name {0} in the stream analytics job {1} in the resource group {2} already exists. +Continuing execution may overwrite the exisiting one. +Are you sure you want to continue? + + + Creating job '{0}' in resource group '{1}'. + + + Creating input '{0}' in stream analytics job {1} in resource group '{2}'. + + + Creating output '{0}' in stream analytics job {1} in resource group '{2}'. + + + Creating transformation '{0}' in stream analytics job {1} in resource group '{2}'. + + + Job '{0}' does not exist in the resource group '{1}'. + + + Input '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'. + + + Output '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'. + + + Transformation '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'. + + \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs new file mode 100644 index 000000000000..b5d4f19320fe --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs @@ -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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Management.Automation; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Common; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + public abstract class StreamAnalyticsBaseCmdlet : AzurePSCmdlet + { + private StreamAnalyticsClient streamAnalyticsClient; + + protected const string StreamAnalyticsObjectsList = "For a list of Stream Analytics Objects"; + protected const string SingleStreamAnalyticsObject = "For a single stream analytics Object"; + + internal StreamAnalyticsClient StreamAnalyticsClient + { + get + { + if (this.streamAnalyticsClient == null) + { + this.streamAnalyticsClient = new StreamAnalyticsClient(CurrentContext); + } + return this.streamAnalyticsClient; + } + set + { + this.streamAnalyticsClient = value; + } + } + + protected override void WriteExceptionError(Exception exception) + { + // Override the default error message into a formatted message which contains Request Id + CloudException cloudException = exception as CloudException; + if (cloudException != null) + { + exception = cloudException.CreateFormattedException(); + } + + base.WriteExceptionError(exception); + } + + protected string ResolveResourceName(string rawJsonContent, string nameFromCmdletContext, string resourceType) + { + string nameExtractedFromJson = StreamAnalyticsCommonUtilities.ExtractNameFromJson(rawJsonContent, resourceType); + + // Read the name from the JSON content if user didn't provide name with -Name parameter + string resolvedResourceName = string.IsNullOrWhiteSpace(nameFromCmdletContext) + ? nameExtractedFromJson + : nameFromCmdletContext; + + // Show a message that if names do not match, name specified with -Name parameter will be used. + if (string.Compare(resolvedResourceName, nameExtractedFromJson, StringComparison.OrdinalIgnoreCase) != 0) + { + WriteVerbose(string.Format( + CultureInfo.InvariantCulture, + Resources.ExtractedNameFromJsonMismatchWarning, + resourceType, + resolvedResourceName, + nameExtractedFromJson)); + } + + return resolvedResourceName; + } + } +} diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs new file mode 100644 index 000000000000..fdced9f8821a --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + public static class StreamAnalyticsCommonUtilities + { + public static string ExtractNameFromJson(string jsonText, string resourceType) + { + Dictionary jsonKeyValuePairs; + + try + { + jsonKeyValuePairs = JsonUtilities.DeserializeJson(jsonText, true); + } + catch (Exception exception) + { + throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, Resources.InvalidJson, exception.Message, resourceType)); + } + + const string NameTagInJson = "Name"; + + foreach (var key in jsonKeyValuePairs.Keys) + { + if (string.Compare(NameTagInJson, key, StringComparison.OrdinalIgnoreCase) == 0) + { + return (string)jsonKeyValuePairs[key]; + } + } + + return string.Empty; + } + + public static Dictionary ExtractTagsFromJson(string jsonText) + { + Dictionary jsonKeyValuePairs = JsonUtilities.DeserializeJson(jsonText); + const string TagsKeyInJson = "tags"; + + foreach (var key in jsonKeyValuePairs.Keys) + { + if (string.Compare(TagsKeyInJson, key, StringComparison.OrdinalIgnoreCase) == 0) + { + var tags = (jsonKeyValuePairs[key] as Dictionary).ToDictionary( + p => p.Key, + p => (string)p.Value); + + return tags; + } + } + + return null; + } + + public static Dictionary ToDictionary(this Hashtable hashTable) + { + return hashTable.Cast().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString()); + } + + public static bool TagsAreEqual(IDictionary first, IDictionary second) + { + bool equal = false; + if (first.Count == second.Count) + { + equal = true; + foreach (var pair in first) + { + string value; + if (second.TryGetValue(pair.Key, out value)) + { + if (!value.Equals(pair.Value)) + { + equal = false; + break; + } + } + else + { + // Require key be present. + equal = false; + break; + } + } + } + + return equal; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs new file mode 100644 index 000000000000..17501ba370c9 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.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 System.Management.Automation; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + public abstract class StreamAnalyticsResourceProviderBaseCmdlet : StreamAnalyticsBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs new file mode 100644 index 000000000000..6f38a44481cd --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs @@ -0,0 +1,53 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsQuota), OutputType(typeof(List), typeof(PSQuota))] + public class GetAzureStreamAnalyticsQuotasCommand : StreamAnalyticsBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The location of the azure stream analytics quota.")] + [ValidateNotNullOrEmpty] + public string Location { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (Location != null && string.IsNullOrWhiteSpace(Location)) + { + throw new PSArgumentNullException("Location"); + } + + List quotas = StreamAnalyticsClient.GetQuotas(Location); + + if (quotas != null) + { + if (quotas.Count == 1 && Location != null) + { + WriteObject(quotas[0]); + } + else + { + WriteObject(quotas, true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs new file mode 100644 index 000000000000..bad48c655892 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.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 System.Collections.Generic; +using System.Management.Automation; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsTransformation), OutputType(typeof(List), typeof(PSTransformation))] + public class GetAzureStreamAnalyticsTransformationCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The azure stream analytics transformation name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + + PSTransformation transformation = StreamAnalyticsClient.GetTransformation(ResourceGroupName, JobName, Name); + WriteObject(transformation); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs new file mode 100644 index 000000000000..bab9cdbc220d --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.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 System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsTransformation), OutputType(typeof(PSTransformation))] + public class NewAzureStreamAnalyticsTransformationCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The stream analytics transformation name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics transformation JSON file path.")] + [ValidateNotNullOrEmpty] + public string File { get; set; } + + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + string rawJsonContent = StreamAnalyticsClient.ReadJsonFileContent(this.TryResolvePath(File)); + + Name = ResolveResourceName(rawJsonContent, Name, "Transformation"); + + CreatePSTransformationParameter parameter = new CreatePSTransformationParameter + { + ResourceGroupName = ResourceGroupName, + JobName = JobName, + TransformationName = Name, + RawJsonContent = rawJsonContent, + Force = Force.IsPresent, + ConfirmAction = ConfirmAction + }; + + WriteObject(StreamAnalyticsClient.CreatePSTransformation(parameter)); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config new file mode 100644 index 000000000000..a32bb794b5f8 --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file From cb88f42604e671effa291775fbb02d2aa63fce45 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Wed, 19 Nov 2014 19:40:14 -0800 Subject: [PATCH 02/32] Fixes and improvements --- .../Commands.StreamAnalytics.csproj | 8 ++++---- .../Commands.StreamAnalytics/Models/PSInput.cs | 4 ++-- .../Commands.StreamAnalytics/Models/PSOutput.cs | 4 ++-- .../Models/PSTransformation.cs | 4 ++-- .../Models/StreamAnalyticsClient.Inputs.cs | 8 ++++---- .../Models/StreamAnalyticsClient.Jobs.cs | 14 +++++++------- .../Models/StreamAnalyticsClient.Outputs.cs | 8 ++++---- .../StreamAnalyticsClient.SubscriptionQuotas.cs | 2 +- .../Models/StreamAnalyticsClient.Transformation.cs | 4 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index 29ed8a516eae..ce84d7931b04 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -48,6 +48,10 @@ false + + False + ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll + @@ -67,9 +71,6 @@ - - ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll - False ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.dll @@ -162,7 +163,6 @@ Always - ResXFileCodeGenerator diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs index b164b6cdfddf..7af6ce385aaf 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs @@ -56,11 +56,11 @@ public InputProperties Properties { get { - return input.InputProperties; + return input.Properties; } set { - input.InputProperties = value; + input.Properties = value; } } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs index 4e3426626e87..329ea5d6b7cb 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs @@ -56,11 +56,11 @@ public OutputProperties Properties { get { - return output.OutputProperties; + return output.Properties; } set { - output.OutputProperties = value; + output.Properties = value; } } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs index b2844b0756f4..d47fbc2e8058 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs @@ -56,11 +56,11 @@ public TransformationProperties Properties { get { - return transformation.TransformationProperties; + return transformation.Properties; } set { - transformation.TransformationProperties = value; + transformation.Properties = value; } } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs index a2c380bee0bf..239c39193399 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs @@ -27,7 +27,7 @@ public partial class StreamAnalyticsClient { public virtual PSInput GetInput(string resourceGroupName, string jobName, string name) { - var response = StreamAnalyticsManagementClient.Input.Get( + var response = StreamAnalyticsManagementClient.Inputs.Get( resourceGroupName, jobName, name); return new PSInput(response.Input) @@ -41,7 +41,7 @@ public virtual List ListInputs(string resourceGroupName, string jobName { List inputs = new List(); - var response = StreamAnalyticsManagementClient.Input.ListInputInJob(resourceGroupName, jobName); + var response = StreamAnalyticsManagementClient.Inputs.ListInputInJob(resourceGroupName, jobName); if (response != null && response.Value != null) { @@ -97,7 +97,7 @@ protected virtual Input CreateOrUpdatePSInput(string resourceGroupName, string j } // If create failed, the current behavior is to throw - var response = StreamAnalyticsManagementClient.Input.CreateOrUpdateWithRawJsonContent( + var response = StreamAnalyticsManagementClient.Inputs.CreateOrUpdateWithRawJsonContent( resourceGroupName, jobName, inputName, @@ -159,7 +159,7 @@ public virtual PSInput CreatePSInput(CreatePSInputParameter parameter) public virtual HttpStatusCode RemovePSInput(string resourceGroupName, string jobName, string inputName) { - OperationResponse response = StreamAnalyticsManagementClient.Input.Delete(resourceGroupName, jobName, inputName); + OperationResponse response = StreamAnalyticsManagementClient.Inputs.Delete(resourceGroupName, jobName, inputName); return response.StatusCode; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs index 78e705321d7c..e7188c17481c 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs @@ -28,7 +28,7 @@ public partial class StreamAnalyticsClient public virtual PSJob GetJob(string resourceGroupName, string jobName, string propertiesToExpand) { JobGetParameters parameters = new JobGetParameters(propertiesToExpand); - var response = StreamAnalyticsManagementClient.Job.Get( + var response = StreamAnalyticsManagementClient.StreamingJobs.Get( resourceGroupName, jobName, parameters); return new PSJob(response.Job) @@ -42,7 +42,7 @@ public virtual List ListJobs(string resourceGroupName, string propertiesT { List jobs = new List(); JobListParameters parameters = new JobListParameters(propertiesToExpand); - var response = StreamAnalyticsManagementClient.Job.ListJobsInResourceGroup(resourceGroupName, parameters); + var response = StreamAnalyticsManagementClient.StreamingJobs.ListJobsInResourceGroup(resourceGroupName, parameters); if (response != null && response.Value != null) { @@ -63,7 +63,7 @@ public virtual List ListJobs(string propertiesToExpand) { List jobs = new List(); JobListParameters parameters = new JobListParameters(propertiesToExpand); - var response = StreamAnalyticsManagementClient.Job.ListJobsInSubscription(parameters); + var response = StreamAnalyticsManagementClient.StreamingJobs.ListJobsInSubscription(parameters); if (response != null && response.Value != null) { @@ -119,7 +119,7 @@ public virtual PSJob CreateOrUpdatePSJob(string resourceGroupName, string jobNam // If create failed, the current behavior is to throw var response = - StreamAnalyticsManagementClient.Job.CreateOrUpdateWithRawJsonContent( + StreamAnalyticsManagementClient.StreamingJobs.CreateOrUpdateWithRawJsonContent( resourceGroupName, jobName, new JobCreateOrUpdateWithRawJsonContentParameters() { Content = rawJsonContent }); @@ -174,7 +174,7 @@ public virtual PSJob CreatePSJob(CreatePSJobParameter parameter) public virtual HttpStatusCode StartPSJob(string resourceGroupName, string jobName) { - OperationResponse response = StreamAnalyticsManagementClient.Job.Start(resourceGroupName, jobName); + OperationResponse response = StreamAnalyticsManagementClient.StreamingJobs.Start(resourceGroupName, jobName); return response.StatusCode; } @@ -191,7 +191,7 @@ public virtual HttpStatusCode StartPSJob(JobParametersBase parameter) public virtual HttpStatusCode StopPSJob(string resourceGroupName, string jobName) { - OperationResponse response = StreamAnalyticsManagementClient.Job.Stop(resourceGroupName, jobName); + OperationResponse response = StreamAnalyticsManagementClient.StreamingJobs.Stop(resourceGroupName, jobName); return response.StatusCode; } @@ -208,7 +208,7 @@ public virtual HttpStatusCode StopPSJob(JobParametersBase parameter) public virtual HttpStatusCode RemovePSJob(string resourceGroupName, string jobName) { - OperationResponse response = StreamAnalyticsManagementClient.Job.Delete(resourceGroupName, jobName); + OperationResponse response = StreamAnalyticsManagementClient.StreamingJobs.Delete(resourceGroupName, jobName); return response.StatusCode; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs index 0fe282f75deb..1b3e79981b9e 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs @@ -27,7 +27,7 @@ public partial class StreamAnalyticsClient { public virtual PSOutput GetOutput(string resourceGroupName, string jobName, string name) { - var response = StreamAnalyticsManagementClient.Output.Get( + var response = StreamAnalyticsManagementClient.Outputs.Get( resourceGroupName, jobName, name); return new PSOutput(response.Output) @@ -41,7 +41,7 @@ public virtual List ListOutputs(string resourceGroupName, string jobNa { List outputs = new List(); - var response = StreamAnalyticsManagementClient.Output.ListOutputInJob(resourceGroupName, jobName); + var response = StreamAnalyticsManagementClient.Outputs.ListOutputInJob(resourceGroupName, jobName); if (response != null && response.Value != null) { @@ -97,7 +97,7 @@ protected virtual Output CreateOrUpdatePSOutput(string resourceGroupName, string } // If create failed, the current behavior is to throw - var response = StreamAnalyticsManagementClient.Output.CreateOrUpdateWithRawJsonContent( + var response = StreamAnalyticsManagementClient.Outputs.CreateOrUpdateWithRawJsonContent( resourceGroupName, jobName, outputName, @@ -159,7 +159,7 @@ public virtual PSOutput CreatePSOutput(CreatePSOutputParameter parameter) public virtual HttpStatusCode RemovePSOutput(string resourceGroupName, string jobName, string outputName) { - OperationResponse response = StreamAnalyticsManagementClient.Output.Delete(resourceGroupName, jobName, outputName); + OperationResponse response = StreamAnalyticsManagementClient.Outputs.Delete(resourceGroupName, jobName, outputName); return response.StatusCode; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs index c31bc97944ef..4d59cf11aa1d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.SubscriptionQuotas.cs @@ -22,7 +22,7 @@ public partial class StreamAnalyticsClient public virtual List GetQuotas(string location) { List quotas = new List(); - var response = StreamAnalyticsManagementClient.Subscription.GetQuotas(location); + var response = StreamAnalyticsManagementClient.Subscriptions.GetQuotas(location); if (response != null && response.Value != null) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs index 9fe3c81c8557..ce08eca5de0d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Transformation.cs @@ -26,7 +26,7 @@ public partial class StreamAnalyticsClient { public virtual PSTransformation GetTransformation(string resourceGroupName, string jobName, string transformationName) { - var response = StreamAnalyticsManagementClient.Transformation.Get(resourceGroupName, jobName, transformationName); + var response = StreamAnalyticsManagementClient.Transformations.Get(resourceGroupName, jobName, transformationName); return new PSTransformation(response.Transformation) { @@ -43,7 +43,7 @@ protected virtual Transformation CreateOrUpdatePSTransformation(string resourceG } // If create failed, the current behavior is to throw - var response = StreamAnalyticsManagementClient.Transformation.CreateOrUpdateWithRawJsonContent( + var response = StreamAnalyticsManagementClient.Transformations.CreateOrUpdateWithRawJsonContent( resourceGroupName, jobName, transformationName, From 642670efd1df9043e79a901cec38a0b69fb64249 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 20 Nov 2014 09:31:15 -0800 Subject: [PATCH 03/32] Fix ResourceGroupName --- .../Models/StreamAnalyticsClient.Jobs.cs | 1 + .../StreamAnalyticsCommonUtilities.cs | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs index e7188c17481c..e3a8413864ea 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs @@ -71,6 +71,7 @@ public virtual List ListJobs(string propertiesToExpand) { jobs.Add(new PSJob(job) { + ResourceGroupName = StreamAnalyticsCommonUtilities.ExtractResourceGroupFromId(job.Id), JobName = job.Name }); } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs index fdced9f8821a..d056463bd636 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsCommonUtilities.cs @@ -104,5 +104,29 @@ public static bool TagsAreEqual(IDictionary first, IDictionary Date: Thu, 20 Nov 2014 10:30:50 -0800 Subject: [PATCH 04/32] Fix the parameter set --- .../Input/GetAzureStreamAnalyticsInputCommand.cs | 6 ++---- .../Input/NewAzureStreamAnalyticsInputCommand.cs | 10 ++++------ .../Input/RemoveAzureStreamAnalyticsInputCommand.cs | 6 ++---- .../Job/GetAzureStreamAnalyticsJobCommand.cs | 9 ++++++++- .../Job/NewAzureStreamAnalyticsJobCommand.cs | 7 +++---- .../Job/RemoveAzureStreamAnalyticsJobCommand.cs | 3 +-- .../Job/StartAzureStreamAnalyticsJobCommand.cs | 3 +-- .../Job/StopAzureStreamAnalyticsJobCommand.cs | 3 +-- .../Output/GetAzureStreamAnalyticsOutputCommand.cs | 6 ++---- .../Output/NewAzureStreamAnalyticsOutputCommand.cs | 10 ++++------ .../Output/RemoveAzureStreamAnalyticsOutputCommand.cs | 6 ++---- .../StreamAnalyticsResourceProviderBaseCmdlet.cs | 5 +---- .../GetAzureStreamAnalyticsQuotasCommand.cs | 3 +-- .../GetAzureStreamAnalyticsTransformationCommand.cs | 6 ++---- .../NewAzureStreamAnalyticsTransformationCommand.cs | 10 ++++------ 15 files changed, 38 insertions(+), 55 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs index f8f973e41bc9..a8758fd75341 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs @@ -22,13 +22,11 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsInput), OutputType(typeof(List), typeof(PSInput))] public class GetAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics input name.")] + [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics input name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs index c36bf8bc5ab7..701210099dbb 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs @@ -22,21 +22,19 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsInput), OutputType(typeof(PSInput))] public class NewAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics input name.")] + [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics input name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics input JSON file path.")] + [Parameter(Position = 3, Mandatory = true, HelpMessage = "The stream analytics input JSON file path.")] [ValidateNotNullOrEmpty] public string File { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] public SwitchParameter Force { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs index aad3e4842335..36f14cd4e2e8 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs @@ -23,13 +23,11 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsInput)] public class RemoveAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics input name.")] + [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics input name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs index 692dcde5506b..65b08b00ca7a 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs @@ -20,8 +20,15 @@ namespace Microsoft.Azure.Commands.StreamAnalytics { [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsJob), OutputType(typeof(List), typeof(PSJob))] - public class GetAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet + public class GetAzureStreamAnalyticsJobCommand : StreamAnalyticsBaseCmdlet { + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs index ed5dbf3173a0..bbd98e2c54ba 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs @@ -22,16 +22,15 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsJob), OutputType(typeof(PSJob))] public class NewAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, HelpMessage = "The stream analytics job JSON file path.")] + [Parameter(Position = 2, Mandatory = true, HelpMessage = "The stream analytics job JSON file path.")] [ValidateNotNullOrEmpty] public string File { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] public SwitchParameter Force { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs index 27c659710724..95c68d237838 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs @@ -24,8 +24,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsJob)] public class RemoveAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs index 7b2517105bf7..50f8764737c8 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs @@ -24,8 +24,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsLifecycle.Start, Constants.StreamAnalyticsJob)] public class StartAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs index e2a9580baff6..29d0a61bf87b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs @@ -24,8 +24,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsLifecycle.Stop, Constants.StreamAnalyticsJob)] public class StopAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs index b9d99f65685e..5b0442bda577 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs @@ -22,13 +22,11 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsOutput), OutputType(typeof(List), typeof(PSOutput))] public class GetAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics output name.")] + [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics output name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs index ab38d322eb3d..75b4ab0c92ec 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs @@ -22,21 +22,19 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsOutput), OutputType(typeof(PSOutput))] public class NewAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics output name.")] + [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics output name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics output JSON file path.")] + [Parameter(Position = 3, Mandatory = true, HelpMessage = "The stream analytics output JSON file path.")] [ValidateNotNullOrEmpty] public string File { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] public SwitchParameter Force { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs index 55566fe96891..7e1c00d9f699 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs @@ -23,13 +23,11 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Remove, Constants.StreamAnalyticsOutput)] public class RemoveAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics output name.")] + [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics output name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs index 17501ba370c9..9c7ab9f957d2 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsResourceProviderBaseCmdlet.cs @@ -18,10 +18,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics { public abstract class StreamAnalyticsResourceProviderBaseCmdlet : StreamAnalyticsBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The resource group name.")] - [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The resource group name.")] + [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs index 6f38a44481cd..78c64c67a444 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs @@ -22,8 +22,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsQuota), OutputType(typeof(List), typeof(PSQuota))] public class GetAzureStreamAnalyticsQuotasCommand : StreamAnalyticsBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The location of the azure stream analytics quota.")] + [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the azure stream analytics quota.")] [ValidateNotNullOrEmpty] public string Location { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs index bad48c655892..55257706ff16 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs @@ -22,13 +22,11 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsTransformation), OutputType(typeof(List), typeof(PSTransformation))] public class GetAzureStreamAnalyticsTransformationCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The azure stream analytics transformation name.")] + [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics transformation name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs index bab9cdbc220d..af9476664984 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs @@ -22,21 +22,19 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsTransformation), OutputType(typeof(PSTransformation))] public class NewAzureStreamAnalyticsTransformationCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string JobName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, - HelpMessage = "The stream analytics transformation name.")] + [Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics transformation name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 3, Mandatory = true, HelpMessage = "The stream analytics transformation JSON file path.")] + [Parameter(Position = 3, Mandatory = true, HelpMessage = "The stream analytics transformation JSON file path.")] [ValidateNotNullOrEmpty] public string File { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] public SwitchParameter Force { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] From 437bd1af587e7c3b12591abfbab9674fb44f52a3 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 20 Nov 2014 11:20:44 -0800 Subject: [PATCH 05/32] Fix all the confirmation behavior --- .../RemoveAzureStreamAnalyticsInputCommand.cs | 24 ++++++++- .../RemoveAzureStreamAnalyticsJobCommand.cs | 22 +++++++- .../StartAzureStreamAnalyticsJobCommand.cs | 1 - .../Job/StopAzureStreamAnalyticsJobCommand.cs | 1 - .../Models/StreamAnalyticsClient.Inputs.cs | 4 +- ...RemoveAzureStreamAnalyticsOutputCommand.cs | 24 ++++++++- .../Properties/Resources.Designer.cs | 54 +++++++++++++++++++ .../Properties/Resources.resx | 18 +++++++ 8 files changed, 141 insertions(+), 7 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs index 36f14cd4e2e8..c9c6db5f6919 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/RemoveAzureStreamAnalyticsInputCommand.cs @@ -31,6 +31,9 @@ public class RemoveAzureStreamAnalyticsInputCommand : StreamAnalyticsResourcePro [ValidateNotNullOrEmpty] public string Name { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] public override void ExecuteCmdlet() { @@ -49,7 +52,26 @@ public override void ExecuteCmdlet() throw new PSArgumentNullException("Name"); } - // TODO: change to async call + this.ConfirmAction( + this.Force.IsPresent, + string.Format( + CultureInfo.InvariantCulture, + Resources.InputRemovalConfirmationMessage, + this.Name, + this.JobName, + this.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.InputRemoving, + this.Name, + this.JobName, + this.ResourceGroupName), + this.Name, + this.ExecuteDelete); + } + + private void ExecuteDelete() + { HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSInput(ResourceGroupName, JobName, Name); if (statusCode == HttpStatusCode.NoContent) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs index 95c68d237838..948e4e4b372b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/RemoveAzureStreamAnalyticsJobCommand.cs @@ -28,6 +28,9 @@ public class RemoveAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProvi [ValidateNotNullOrEmpty] public string Name { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] public override void ExecuteCmdlet() { @@ -36,13 +39,30 @@ public override void ExecuteCmdlet() throw new PSArgumentNullException("ResourceGroupName"); } + this.ConfirmAction( + this.Force.IsPresent, + string.Format( + CultureInfo.InvariantCulture, + Resources.JobRemovalConfirmationMessage, + this.Name, + this.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.JobRemoving, + this.Name, + this.ResourceGroupName), + this.Name, + this.ExecuteDelete); + } + + private void ExecuteDelete() + { JobParametersBase parameter = new JobParametersBase() { ResourceGroupName = ResourceGroupName, JobName = Name }; - // TODO: change to async call HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSJob(parameter); if (statusCode == HttpStatusCode.NoContent) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs index 50f8764737c8..1160a46986b3 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StartAzureStreamAnalyticsJobCommand.cs @@ -42,7 +42,6 @@ public override void ExecuteCmdlet() JobName = Name }; - // TODO: change to async call HttpStatusCode statusCode = StreamAnalyticsClient.StartPSJob(parameter); if (statusCode == HttpStatusCode.NoContent) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs index 29d0a61bf87b..2b8e527ad6cc 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/StopAzureStreamAnalyticsJobCommand.cs @@ -42,7 +42,6 @@ public override void ExecuteCmdlet() JobName = Name }; - // TODO: change to async call HttpStatusCode statusCode = StreamAnalyticsClient.StopPSJob(parameter); if (statusCode == HttpStatusCode.NoContent) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs index 239c39193399..46687cee2e77 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs @@ -116,8 +116,8 @@ public virtual PSInput CreatePSInput(CreatePSInputParameter parameter) PSInput input = null; Action createInput = () => { - input = - new PSInput(CreateOrUpdatePSInput(parameter.ResourceGroupName, + input = new PSInput( + CreateOrUpdatePSInput(parameter.ResourceGroupName, parameter.JobName, parameter.InputName, parameter.RawJsonContent)) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs index 7e1c00d9f699..debefdbd8ac5 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/RemoveAzureStreamAnalyticsOutputCommand.cs @@ -31,6 +31,9 @@ public class RemoveAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourcePr [ValidateNotNullOrEmpty] public string Name { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")] + public SwitchParameter Force { get; set; } + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] public override void ExecuteCmdlet() { @@ -49,7 +52,26 @@ public override void ExecuteCmdlet() throw new PSArgumentNullException("Name"); } - // TODO: change to async call + this.ConfirmAction( + this.Force.IsPresent, + string.Format( + CultureInfo.InvariantCulture, + Resources.OutputRemovalConfirmationMessage, + this.Name, + this.JobName, + this.ResourceGroupName), + string.Format( + CultureInfo.InvariantCulture, + Resources.OutputRemoving, + this.Name, + this.JobName, + this.ResourceGroupName), + this.Name, + this.ExecuteDelete); + } + + private void ExecuteDelete() + { HttpStatusCode statusCode = StreamAnalyticsClient.RemovePSOutput(ResourceGroupName, JobName, Name); if (statusCode == HttpStatusCode.NoContent) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs index 31bd7c8de92f..6019b2b213c4 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs @@ -111,6 +111,24 @@ internal static string InputNotFound { } } + /// + /// Looks up a localized string similar to Are you sure you want to remove the stream analytics input '{0}' in the stream analytics job {1} in the resource group '{2}'?. + /// + internal static string InputRemovalConfirmationMessage { + get { + return ResourceManager.GetString("InputRemovalConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the stream analytics input '{0}' in the stream analytics job {1} in the resource group '{2}'.. + /// + internal static string InputRemoving { + get { + return ResourceManager.GetString("InputRemoving", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again.. /// @@ -158,6 +176,24 @@ internal static string JobNotFound { } } + /// + /// Looks up a localized string similar to Are you sure you want to remove the stream analytics job '{0}' in the resource group '{1}'?. + /// + internal static string JobRemovalConfirmationMessage { + get { + return ResourceManager.GetString("JobRemovalConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the stream analytics '{0}' in the resource group '{1}'.. + /// + internal static string JobRemoving { + get { + return ResourceManager.GetString("JobRemoving", resourceCulture); + } + } + /// /// Looks up a localized string similar to Creating output '{0}' in stream analytics job {1} in resource group '{2}'.. /// @@ -187,6 +223,24 @@ internal static string OutputNotFound { } } + /// + /// Looks up a localized string similar to Are you sure you want to remove the stream analytics output '{0}' in the stream analytics job {1} in the resource group '{2}'?. + /// + internal static string OutputRemovalConfirmationMessage { + get { + return ResourceManager.GetString("OutputRemovalConfirmationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing the stream analytics output '{0}' in the stream analytics job {1} in the resource group '{2}'.. + /// + internal static string OutputRemoving { + get { + return ResourceManager.GetString("OutputRemoving", resourceCulture); + } + } + /// /// Looks up a localized string similar to Resource group name cannot be null.. /// diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx index cc238f39004f..f5c731f68515 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx @@ -161,4 +161,22 @@ Are you sure you want to continue? Transformation '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'. + + Are you sure you want to remove the stream analytics job '{0}' in the resource group '{1}'? + + + Removing the stream analytics '{0}' in the resource group '{1}'. + + + Are you sure you want to remove the stream analytics input '{0}' in the stream analytics job {1} in the resource group '{2}'? + + + Removing the stream analytics input '{0}' in the stream analytics job {1} in the resource group '{2}'. + + + Are you sure you want to remove the stream analytics output '{0}' in the stream analytics job {1} in the resource group '{2}'? + + + Removing the stream analytics output '{0}' in the stream analytics job {1} in the resource group '{2}'. + \ No newline at end of file From 64df8e1db6033f64f112ea35e3d1fef852fcdbba Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 20 Nov 2014 12:11:33 -0800 Subject: [PATCH 06/32] Add Test-AzureStreamAnalyticsInput and Test-AzureStreamAnalyticsOutput --- .../Commands.StreamAnalytics.csproj | 2 + .../TestAzureStreamAnalyticsInputCommand.cs | 67 +++++++++++++++++++ .../Models/StreamAnalyticsClient.Inputs.cs | 7 ++ .../Models/StreamAnalyticsClient.Outputs.cs | 7 ++ .../TestAzureStreamAnalyticsOutputCommand.cs | 67 +++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/TestAzureStreamAnalyticsInputCommand.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/TestAzureStreamAnalyticsOutputCommand.cs diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index ce84d7931b04..1a8ea15f6751 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -108,6 +108,7 @@ + @@ -138,6 +139,7 @@ + True diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/TestAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/TestAzureStreamAnalyticsInputCommand.cs new file mode 100644 index 000000000000..4a211c744cbf --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/TestAzureStreamAnalyticsInputCommand.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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsDiagnostic.Test, Constants.StreamAnalyticsInput)] + public class TestAzureStreamAnalyticsInputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics input name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + + HttpStatusCode statusCode = StreamAnalyticsClient.TestPSInput(ResourceGroupName, JobName, Name); + if (statusCode == HttpStatusCode.OK) + { + WriteObject(true); + } + else if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.InputNotFound, Name, JobName, ResourceGroupName)); + } + else + { + WriteObject(false); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs index 46687cee2e77..25ce86b28dba 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Inputs.cs @@ -164,6 +164,13 @@ public virtual HttpStatusCode RemovePSInput(string resourceGroupName, string job return response.StatusCode; } + public virtual HttpStatusCode TestPSInput(string resourceGroupName, string jobName, string inputName) + { + OperationResponse response = StreamAnalyticsManagementClient.Inputs.TestConnection(resourceGroupName, jobName, inputName); + + return response.StatusCode; + } + private bool CheckInputExists(string resourceGroupName, string jobName, string inputName) { try diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs index 1b3e79981b9e..4bfd0dd7cd72 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Outputs.cs @@ -163,6 +163,13 @@ public virtual HttpStatusCode RemovePSOutput(string resourceGroupName, string jo return response.StatusCode; } + + public virtual HttpStatusCode TestPSOutput(string resourceGroupName, string jobName, string outputName) + { + OperationResponse response = StreamAnalyticsManagementClient.Outputs.TestConnection(resourceGroupName, jobName, outputName); + + return response.StatusCode; + } private bool CheckOutputExists(string resourceGroupName, string jobName, string outputName) { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/TestAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/TestAzureStreamAnalyticsOutputCommand.cs new file mode 100644 index 000000000000..8f87c768895b --- /dev/null +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/TestAzureStreamAnalyticsOutputCommand.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. +// ---------------------------------------------------------------------------------- + +using System.Globalization; +using System.Management.Automation; +using System.Net; +using System.Security.Permissions; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; + +namespace Microsoft.Azure.Commands.StreamAnalytics +{ + [Cmdlet(VerbsDiagnostic.Test, Constants.StreamAnalyticsOutput)] + public class TestAzureStreamAnalyticsOutputCommand : StreamAnalyticsResourceProviderBaseCmdlet + { + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] + [ValidateNotNullOrEmpty] + public string JobName { get; set; } + + [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics output name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] + public override void ExecuteCmdlet() + { + if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) + { + throw new PSArgumentNullException("ResourceGroupName"); + } + + if (JobName != null && string.IsNullOrWhiteSpace(JobName)) + { + throw new PSArgumentNullException("JobName"); + } + + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new PSArgumentNullException("Name"); + } + + HttpStatusCode statusCode = StreamAnalyticsClient.TestPSOutput(ResourceGroupName, JobName, Name); + if (statusCode == HttpStatusCode.OK) + { + WriteObject(true); + } + else if (statusCode == HttpStatusCode.NoContent) + { + WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.OutputNotFound, Name, JobName, ResourceGroupName)); + } + else + { + WriteObject(false); + } + } + } +} \ No newline at end of file From f29b4e0e47da8063d10792bb63cbd6ba756921be Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 20 Nov 2014 14:28:41 -0800 Subject: [PATCH 07/32] Improve all the response content --- ...ure.Commands.StreamAnalytics.format.ps1xml | 124 ++++++++++++++++++ .../Models/PSInput.cs | 5 + .../Commands.StreamAnalytics/Models/PSJob.cs | 12 ++ .../Models/PSOutput.cs | 5 + .../Models/PSQuota.cs | 24 ++++ .../Models/PSTransformation.cs | 5 + .../Models/StreamAnalyticsClientExtensions.cs | 2 +- .../GetAzureStreamAnalyticsQuotasCommand.cs | 2 + 8 files changed, 178 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml index 5a6c54089ee5..c62f05a2f246 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml @@ -18,6 +18,10 @@ ResourceGroupName + + + JobId + Location @@ -47,5 +51,125 @@ + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSInput + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSInput + + + + + + + + Name + + + + JobName + + + + ResourceGroupName + + + + PropertiesInJson + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSOutput + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSOutput + + + + + + + + Name + + + + JobName + + + + ResourceGroupName + + + + PropertiesInJson + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSQuota + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSQuota + + + + + + + + Name + + + + Location + + + + CurrentCount + + + + MaxCount + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSTransformation + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSTransformation + + + + + + + + Name + + + + JobName + + + + ResourceGroupName + + + + PropertiesInJson + + + + + + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs index 7af6ce385aaf..ab330ed22c6a 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs @@ -63,5 +63,10 @@ public InputProperties Properties input.Properties = value; } } + + public string PropertiesInJson + { + get { return input.Properties.ToFormattedString(); } + } } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs index 35b653a2628f..e5a46fae886d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs @@ -41,6 +41,18 @@ public PSJob(Job job) public string ResourceGroupName { get; set; } + public string JobId + { + get + { + return job.Properties.JobId; + } + set + { + job.Properties.JobId = value; + } + } + public string Location { get diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs index 329ea5d6b7cb..f6b118f2a17e 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs @@ -63,5 +63,10 @@ public OutputProperties Properties output.Properties = value; } } + + public string PropertiesInJson + { + get { return output.Properties.ToFormattedString(); } + } } } \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs index 6939b89613b2..18bd1b9b01c6 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs @@ -50,6 +50,30 @@ public string Name public string Location { get; set; } + public int CurrentCount + { + get + { + return subscriptionQuotas.Properties.CurrentCount; + } + set + { + subscriptionQuotas.Properties.CurrentCount = value; + } + } + + public int MaxCount + { + get + { + return subscriptionQuotas.Properties.MaxCount; + } + set + { + subscriptionQuotas.Properties.MaxCount = value; + } + } + public SubscriptionQuotasProperties Properties { get diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs index d47fbc2e8058..abb32135ebb6 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs @@ -63,5 +63,10 @@ public TransformationProperties Properties transformation.Properties = value; } } + + public string PropertiesInJson + { + get { return transformation.Properties.ToFormattedString(); } + } } } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs index 91b7ced587f0..44b47d390293 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClientExtensions.cs @@ -24,7 +24,7 @@ public static string ToFormattedString(this JobProperties properties) return JsonConvert.SerializeObject(properties, Formatting.Indented); } - public static string ToFormattedString(T objectToSerialize) + public static string ToFormattedString(this T objectToSerialize) { return JsonConvert.SerializeObject(objectToSerialize, Formatting.Indented); } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs index 78c64c67a444..736b058c579f 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs @@ -24,6 +24,8 @@ public class GetAzureStreamAnalyticsQuotasCommand : StreamAnalyticsBaseCmdlet { [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the azure stream analytics quota.")] [ValidateNotNullOrEmpty] + [ValidateSet("East US", "East US 2", "North Central US", "North Europe", "West Europe", "Brazil South", "West US", "Central US", "South Central US", + "Japan East", "Japan West", "East Asia", "Southeast Asia", IgnoreCase = true)] public string Location { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] From f5f80a547743b4c7f9e4107383771f825b986eea Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 20 Nov 2014 15:52:12 -0800 Subject: [PATCH 08/32] Remove static check about the regions --- .../Subscription/GetAzureStreamAnalyticsQuotasCommand.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs index 736b058c579f..78c64c67a444 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs @@ -24,8 +24,6 @@ public class GetAzureStreamAnalyticsQuotasCommand : StreamAnalyticsBaseCmdlet { [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the azure stream analytics quota.")] [ValidateNotNullOrEmpty] - [ValidateSet("East US", "East US 2", "North Central US", "North Europe", "West Europe", "Brazil South", "West US", "Central US", "South Central US", - "Japan East", "Japan West", "East Asia", "Southeast Asia", IgnoreCase = true)] public string Location { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] From 6d1fe653f056ebcedba45c50909b6a6062c8f0e7 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 21 Nov 2014 12:05:44 -0800 Subject: [PATCH 09/32] Add setup and fix the job name --- setup/azurecmdfiles.wxi | 110 ++++++++++++++++++ .../Job/NewAzureStreamAnalyticsJobCommand.cs | 2 +- .../Commands.StreamAnalytics/Models/PSJob.cs | 12 +- .../Models/StreamAnalyticsClient.Jobs.cs | 9 +- 4 files changed, 125 insertions(+), 8 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index a32a2abc0bf9..e69f18ac6a9b 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -398,6 +398,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1114,9 +1191,15 @@ + + + + + + @@ -2108,6 +2191,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2341,7 +2449,9 @@ + + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs index bbd98e2c54ba..b21e24b0aaa2 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsJob), OutputType(typeof(PSJob))] public class NewAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs index e5a46fae886d..1144eb2211d2 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs @@ -37,7 +37,17 @@ public PSJob(Job job) this.job = job; } - public string JobName { get; set; } + public string JobName + { + get + { + return job.Name; + } + set + { + job.Name = value; + } + } public string ResourceGroupName { get; set; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs index e3a8413864ea..28b59993a17e 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/StreamAnalyticsClient.Jobs.cs @@ -33,8 +33,7 @@ public virtual PSJob GetJob(string resourceGroupName, string jobName, string pro return new PSJob(response.Job) { - ResourceGroupName = resourceGroupName, - JobName = jobName + ResourceGroupName = resourceGroupName }; } @@ -50,8 +49,7 @@ public virtual List ListJobs(string resourceGroupName, string propertiesT { jobs.Add(new PSJob(job) { - ResourceGroupName = resourceGroupName, - JobName = job.Name + ResourceGroupName = resourceGroupName }); } } @@ -71,8 +69,7 @@ public virtual List ListJobs(string propertiesToExpand) { jobs.Add(new PSJob(job) { - ResourceGroupName = StreamAnalyticsCommonUtilities.ExtractResourceGroupFromId(job.Id), - JobName = job.Name + ResourceGroupName = StreamAnalyticsCommonUtilities.ExtractResourceGroupFromId(job.Id) }); } } From 12d4b4fe755be74dbe4745d9f9ee96411684de49 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 21 Nov 2014 12:45:52 -0800 Subject: [PATCH 10/32] Fix the missing name in json file scenario --- .../NewAzureStreamAnalyticsInputCommand.cs | 7 +++++ .../Job/NewAzureStreamAnalyticsJobCommand.cs | 9 ++++++- .../NewAzureStreamAnalyticsOutputCommand.cs | 7 +++++ .../Properties/Resources.Designer.cs | 27 +++++++++++++++++++ .../Properties/Resources.resx | 9 +++++++ ...ureStreamAnalyticsTransformationCommand.cs | 7 +++++ 6 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs index 701210099dbb..5cbb2591021a 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/NewAzureStreamAnalyticsInputCommand.cs @@ -12,9 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; using System.Management.Automation; using System.Security.Permissions; using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.StreamAnalytics @@ -59,6 +61,11 @@ public override void ExecuteCmdlet() Name = ResolveResourceName(rawJsonContent, Name, "Input"); + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new ArgumentException(Resources.InputNameCannotBeEmpty); + } + CreatePSInputParameter parameter = new CreatePSInputParameter { ResourceGroupName = ResourceGroupName, diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs index b21e24b0aaa2..11e2ae076ab6 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/NewAzureStreamAnalyticsJobCommand.cs @@ -12,9 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; using System.Management.Automation; using System.Security.Permissions; using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.StreamAnalytics @@ -22,7 +24,7 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.New, Constants.StreamAnalyticsJob), OutputType(typeof(PSJob))] public class NewAzureStreamAnalyticsJobCommand : StreamAnalyticsResourceProviderBaseCmdlet { - [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] + [Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } @@ -40,6 +42,11 @@ public override void ExecuteCmdlet() Name = ResolveResourceName(rawJsonContent, Name, "Job"); + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new ArgumentException(Resources.JobNameCannotBeEmpty); + } + CreatePSJobParameter parameter = new CreatePSJobParameter { ResourceGroupName = ResourceGroupName, diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs index 75b4ab0c92ec..3e23cdc197e5 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/NewAzureStreamAnalyticsOutputCommand.cs @@ -12,9 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; using System.Management.Automation; using System.Security.Permissions; using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.StreamAnalytics @@ -44,6 +46,11 @@ public override void ExecuteCmdlet() Name = ResolveResourceName(rawJsonContent, Name, "Output"); + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new ArgumentException(Resources.OutputNameCannotBeEmpty); + } + CreatePSOutputParameter parameter = new CreatePSOutputParameter { ResourceGroupName = ResourceGroupName, diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs index 6019b2b213c4..053974cadeee 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs @@ -102,6 +102,15 @@ internal static string InputExists { } } + /// + /// Looks up a localized string similar to Stream analytics input name cannot be null.. + /// + internal static string InputNameCannotBeEmpty { + get { + return ResourceManager.GetString("InputNameCannotBeEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to Input '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. /// @@ -214,6 +223,15 @@ internal static string OutputExists { } } + /// + /// Looks up a localized string similar to Stream analytics output name cannot be null.. + /// + internal static string OutputNameCannotBeEmpty { + get { + return ResourceManager.GetString("OutputNameCannotBeEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to Output '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. /// @@ -270,6 +288,15 @@ internal static string TransformationExists { } } + /// + /// Looks up a localized string similar to Stream analytics transformation name cannot be null.. + /// + internal static string TransformationNameCannotBeEmpty { + get { + return ResourceManager.GetString("TransformationNameCannotBeEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to Transformation '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.. /// diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx index f5c731f68515..8218f961d248 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx @@ -111,6 +111,15 @@ Timestamp (Utc):{4} Stream analytics job name cannot be null. + + Stream analytics input name cannot be null. + + + Stream analytics output name cannot be null. + + + Stream analytics transformation name cannot be null. + Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again. diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs index af9476664984..2e6018278b22 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/NewAzureStreamAnalyticsTransformationCommand.cs @@ -12,9 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; using System.Management.Automation; using System.Security.Permissions; using Microsoft.Azure.Commands.StreamAnalytics.Models; +using Microsoft.Azure.Commands.StreamAnalytics.Properties; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.StreamAnalytics @@ -44,6 +46,11 @@ public override void ExecuteCmdlet() Name = ResolveResourceName(rawJsonContent, Name, "Transformation"); + if (Name != null && string.IsNullOrWhiteSpace(Name)) + { + throw new ArgumentException(Resources.TransformationNameCannotBeEmpty); + } + CreatePSTransformationParameter parameter = new CreatePSTransformationParameter { ResourceGroupName = ResourceGroupName, From 5547a9f7e70bef4c2bf0244aaf42d352b7cc1933 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 21 Nov 2014 14:43:34 -0800 Subject: [PATCH 11/32] Change set to internal --- .../Commands.StreamAnalytics/Models/PSInput.cs | 4 ++-- .../Commands.StreamAnalytics/Models/PSJob.cs | 14 +++++++------- .../Commands.StreamAnalytics/Models/PSOutput.cs | 4 ++-- .../Commands.StreamAnalytics/Models/PSQuota.cs | 8 ++++---- .../Models/PSTransformation.cs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs index ab330ed22c6a..5841ffd65482 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSInput.cs @@ -42,7 +42,7 @@ public string Name { return input.Name; } - set + internal set { input.Name = value; } @@ -58,7 +58,7 @@ public InputProperties Properties { return input.Properties; } - set + internal set { input.Properties = value; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs index 1144eb2211d2..dd2dccc52dab 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSJob.cs @@ -57,7 +57,7 @@ public string JobId { return job.Properties.JobId; } - set + internal set { job.Properties.JobId = value; } @@ -69,7 +69,7 @@ public string Location { return job.Location; } - set + internal set { job.Location = value; } @@ -81,7 +81,7 @@ public DateTime? CreatedDate { return job.Properties.CreatedDate; } - set + internal set { job.Properties.CreatedDate = value; } @@ -93,7 +93,7 @@ public string ProvisioningState { return job.Properties.ProvisioningState; } - set + internal set { job.Properties.ProvisioningState = value; } @@ -105,7 +105,7 @@ public string JobState { return job.Properties.JobState; } - set + internal set { job.Properties.JobState = value; } @@ -117,7 +117,7 @@ public IDictionary Tags { return job.Tags; } - set + internal set { job.Tags = value; } @@ -129,7 +129,7 @@ public JobProperties Properties { return job.Properties; } - set + internal set { job.Properties = value; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs index f6b118f2a17e..4c66a9ebea8b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSOutput.cs @@ -42,7 +42,7 @@ public string Name { return output.Name; } - set + internal set { output.Name = value; } @@ -58,7 +58,7 @@ public OutputProperties Properties { return output.Properties; } - set + internal set { output.Properties = value; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs index 18bd1b9b01c6..c34936ae9904 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSQuota.cs @@ -42,7 +42,7 @@ public string Name { return subscriptionQuotas.Name; } - set + internal set { subscriptionQuotas.Name = value; } @@ -56,7 +56,7 @@ public int CurrentCount { return subscriptionQuotas.Properties.CurrentCount; } - set + internal set { subscriptionQuotas.Properties.CurrentCount = value; } @@ -68,7 +68,7 @@ public int MaxCount { return subscriptionQuotas.Properties.MaxCount; } - set + internal set { subscriptionQuotas.Properties.MaxCount = value; } @@ -80,7 +80,7 @@ public SubscriptionQuotasProperties Properties { return subscriptionQuotas.Properties; } - set + internal set { subscriptionQuotas.Properties = value; } diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs index abb32135ebb6..9f5fd43c31c9 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Models/PSTransformation.cs @@ -42,7 +42,7 @@ public string Name { return transformation.Name; } - set + internal set { transformation.Name = value; } @@ -58,7 +58,7 @@ public TransformationProperties Properties { return transformation.Properties; } - set + internal set { transformation.Properties = value; } From cbf1d034f680f05f26764699685cefdfc6654612 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Tue, 25 Nov 2014 13:15:51 -0800 Subject: [PATCH 12/32] Bug Fixes --- .../Job/GetAzureStreamAnalyticsJobCommand.cs | 17 ++++++----------- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Resources.resx | 2 +- .../StreamAnalyticsBaseCmdlet.cs | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs index 65b08b00ca7a..d6860717d25b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs @@ -22,38 +22,33 @@ namespace Microsoft.Azure.Commands.StreamAnalytics [Cmdlet(VerbsCommon.Get, Constants.StreamAnalyticsJob), OutputType(typeof(List), typeof(PSJob))] public class GetAzureStreamAnalyticsJobCommand : StreamAnalyticsBaseCmdlet { - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, + [Parameter(ParameterSetName = StreamAnalyticsObjectsInResourceGroup, Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")] - [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, + [Parameter(ParameterSetName = StreamAnalyticsObjectsInSubscription, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")] [ValidateNotNullOrEmpty] public string ResourceGroupName { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, + [Parameter(ParameterSetName = StreamAnalyticsObjectsInResourceGroup, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The azure stream analytics job name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = SingleStreamAnalyticsObject, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, + [Parameter(ParameterSetName = StreamAnalyticsObjectsInResourceGroup, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The switch to specify whether the job entity should be expanded.")] - [Parameter(ParameterSetName = StreamAnalyticsObjectsList, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, + [Parameter(ParameterSetName = StreamAnalyticsObjectsInSubscription, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The switch to specify whether the job entity should be expanded.")] public SwitchParameter NoExpand { get; set; } [EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)] public override void ExecuteCmdlet() { - if (ParameterSetName == SingleStreamAnalyticsObject) + if (ParameterSetName == StreamAnalyticsObjectsInResourceGroup) { if (ResourceGroupName != null && string.IsNullOrWhiteSpace(ResourceGroupName)) { throw new PSArgumentNullException("ResourceGroupName"); } - - if (Name != null && string.IsNullOrWhiteSpace(Name)) - { - throw new PSArgumentNullException("Name"); - } } string propertiesToExpand = "inputs,transformation,outputs"; diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs index 053974cadeee..0b6601208fb8 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.Designer.cs @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Looks up a localized string similar to {0} name provided using -Name switch: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}'. + /// Looks up a localized string similar to {0} name provided using -Name: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}'. /// internal static string ExtractedNameFromJsonMismatchWarning { get { diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx index 8218f961d248..2e5faad5144f 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Properties/Resources.resx @@ -124,7 +124,7 @@ Timestamp (Utc):{4} Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again. - {0} name provided using -Name switch: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}' + {0} name provided using -Name: '{1}' in cmdlet doesn't match with {0} name: '{2}' in JSON file. {0} will be created with name: '{1}' A job with the name {0} in the resource group {1} already exists. diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs index b5d4f19320fe..15ff43063f60 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs @@ -28,8 +28,8 @@ public abstract class StreamAnalyticsBaseCmdlet : AzurePSCmdlet { private StreamAnalyticsClient streamAnalyticsClient; - protected const string StreamAnalyticsObjectsList = "For a list of Stream Analytics Objects"; - protected const string SingleStreamAnalyticsObject = "For a single stream analytics Object"; + protected const string StreamAnalyticsObjectsInSubscription = "For stream analytics objects in the given subscription"; + protected const string StreamAnalyticsObjectsInResourceGroup = "For stream analytics objects in the given resource group"; internal StreamAnalyticsClient StreamAnalyticsClient { From 21cec05144fac65a521c0dc64c3b4799d2d2e18e Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Tue, 25 Nov 2014 13:18:27 -0800 Subject: [PATCH 13/32] Bug fixes --- .../Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs index 15ff43063f60..4ebfdefe498d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/StreamAnalyticsBaseCmdlet.cs @@ -68,8 +68,8 @@ protected string ResolveResourceName(string rawJsonContent, string nameFromCmdle ? nameExtractedFromJson : nameFromCmdletContext; - // Show a message that if names do not match, name specified with -Name parameter will be used. - if (string.Compare(resolvedResourceName, nameExtractedFromJson, StringComparison.OrdinalIgnoreCase) != 0) + // Show a message that if name from json is not null or empty and names do not match, name specified with -Name parameter will be used. + if (!string.IsNullOrEmpty(nameExtractedFromJson) && string.Compare(resolvedResourceName, nameExtractedFromJson, StringComparison.OrdinalIgnoreCase) != 0) { WriteVerbose(string.Format( CultureInfo.InvariantCulture, From 0fb5c23a40c4c1d336e7538722c0938bb5824e04 Mon Sep 17 00:00:00 2001 From: arturocantu Date: Wed, 26 Nov 2014 18:18:57 -0800 Subject: [PATCH 14/32] Adding E2E Scenario --- .../Commands.StreamAnalytics.Test.csproj | 155 ++ .../ScenarioTests/EndToEndTests.cs | 29 + .../ScenarioTests/EndToEndTests.ps1 | 100 + .../StreamAnalyticsScenarioTestsBase.cs | 104 + .../TestStreamingAnalyticsE2E.json | 2051 +++++++++++++++++ .../packages.config | 23 + 6 files changed, 2462 insertions(+) create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/EndToEndTests.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/EndToEndTests.ps1 create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/StreamAnalyticsScenarioTestsBase.cs create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/SessionRecords/Microsoft.Azure.Commands.StreamAnalytics.Test.EndToEndTests/TestStreamingAnalyticsE2E.json create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/packages.config diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index cf958254e897..c5ed1b3a520e 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -11,6 +11,8 @@ Commands.StreamAnalytics.Test v4.5 512 + ..\..\..\ + true true @@ -30,18 +32,171 @@ 4 + + ..\..\..\packages\Microsoft.Azure.Gallery.2.2.0-preview\lib\net40\Microsoft.Azure.Gallery.dll + True + + + ..\..\..\packages\Microsoft.Azure.Management.Authorization.0.11.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll + + + ..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.11.4-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll + + + ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll + + + ..\..\..\packages\Microsoft.Azure.Monitoring.2.2.0-preview\lib\net40\Microsoft.Azure.Monitoring.dll + True + + + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.7.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + True + + + False + ..\..\..\packages\Hydra.HttpRecorder.1.0.5417.13285-prerelease\lib\net45\Microsoft.Azure.Utilities.HttpRecorder.dll + + + ..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.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 + + + False + ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.dll + + + ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.NetFramework.dll + True + + + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.3.1.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll + + + False + ..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + False + ..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll + + + False + ..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll + + + ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + True + + + + + + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll + + + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + + + + False + ..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll + + + ..\..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll + + + + + {c1bda476-a5cc-4394-914d-48b0ec31a710} + Commands.ScenarioTests.Common + + + {65c3a86a-716d-4e7d-ab67-1db00b3bf72d} + Commands.Common.Storage + + + {3b48a77b-5956-4a62-9081-92ba04b02b27} + Commands.Common.Test + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {bc420543-c04e-4bf3-96e1-cd81b823bdd7} + Commands.Test.Utilities + + + {9577252e-0a6b-4d61-86e8-95f7f309a987} + Commands.StreamAnalytics + + + + + + + Designer + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + Get-AzureStreamAnalyticsQuota + + + + Gets information about the Streaming Unit quota of a specified region. + + + + + + Get + AzureStreamAnalyticsQuota + + + + + + + + + Get-AzureStreamAnalyticsQuota + + Location + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + Location + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + System.Collections.Generic.List`1[[Microsoft.Azure.Commands.StreamAnalytics.Models.PSQuota, Microsoft.Azure.Commands.StreamAnalytics, Version=0.8.11.0, Culture=neutral, PublicKeyToken=null]] + Microsoft.Azure.Commands.StreamAnalytics.Models.PSQuota + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureStreamAnalyticsTransformation + + + Gets information about a specific transformation defined on Stream Analytics job. + + + + + Get + AzureStreamAnalyticsTransformation + + + + + + + + + Get-AzureStreamAnalyticsTransformation + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + System.Collections.Generic.List`1[[Microsoft.Azure.Commands.StreamAnalytics.Models.PSTransformation, Microsoft.Azure.Commands.StreamAnalytics, Version=0.8.11.0, Culture=neutral, PublicKeyToken=null]] + Microsoft.Azure.Commands.StreamAnalytics.Models.PSTransformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureStreamAnalyticsOutput + + + Lists all of the outputs that are defined in a specified Stream Analytics job or gets information about a specific output. + + + + + Get + AzureStreamAnalyticsOutput + + + + + + + + + Get-AzureStreamAnalyticsOutput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + System.Collections.Generic.List`1[[Microsoft.Azure.Commands.StreamAnalytics.Models.PSOutput, Microsoft.Azure.Commands.StreamAnalytics, Version=0.8.11.0, Culture=neutral, PublicKeyToken=null]] + Microsoft.Azure.Commands.StreamAnalytics.Models.PSOutput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureStreamAnalyticsInput + + + Lists all of the inputs that are defined in a specified Stream Analytics job or gets information about a specific input. + + + + + Get + AzureStreamAnalyticsInput + + + + + + + + + Get-AzureStreamAnalyticsInput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + System.Collections.Generic.List`1[[Microsoft.Azure.Commands.StreamAnalytics.Models.PSInput, Microsoft.Azure.Commands.StreamAnalytics, Version=0.8.11.0, Culture=neutral, PublicKeyToken=null]] + Microsoft.Azure.Commands.StreamAnalytics.Models.PSInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureStreamAnalyticsJob + + + Lists all Stream Analytics jobs defined in the Azure subscription or specified resource group or gets job information about a specific job within a resource group. + + + + + Get + AzureStreamAnalyticsJob + + + + + + + + + Get-AzureStreamAnalyticsJob + + NoExpand + + + + + + PipelineVariable + + Not Specified + + string + + + + Get-AzureStreamAnalyticsJob + + ResourceGroupName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + Name + + + + + string + + string + + + + + + NoExpand + + + + + SwitchParameter + + SwitchParameter + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + System.Collections.Generic.List`1[[Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob, Microsoft.Azure.Commands.StreamAnalytics, Version=0.8.11.0, Culture=neutral, PublicKeyToken=null]] + Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureStreamAnalyticsOutput + + + + Creates a new output within a Stream Analytics job or updates an existing output. + The name of the output can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify an output that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing output. + If you specify -Force parameter and specify an existing output name, the output will be replaced without confirmation. + + + + + + New + AzureStreamAnalyticsOutput + + + + + + + + + New-AzureStreamAnalyticsOutput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + File + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + File + + + + + string + + string + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSOutput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureStreamAnalyticsTransformation + + + + Creates a new transformation within a Stream Analytics job or updates the existing transformation. + The name of the transformation can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify a transformation that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing transformation. + If you specify -Force parameter and specify an existing transformation name, the transformation will be replaced without confirmation. + + + + + + New + AzureStreamAnalyticsTransformation + + + + + + + + + New-AzureStreamAnalyticsTransformation + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + File + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + File + + + + + string + + string + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSTransformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureStreamAnalyticsInput + + + + Creates a new input within a Stream Analytics job or updates an existing specified input. + The name of the input can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify an input that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing input. + If you specify -Force parameter and specify an existing input name, the input will be replaced without confirmation. + + + + + + New + AzureStreamAnalyticsInput + + + + + + + + + New-AzureStreamAnalyticsInput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + File + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + File + + + + + string + + string + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureStreamAnalyticsJob + + + + Creates a new Stream Analytics job in Microsoft Azure or updates the definition of an existing specified job. + The name of the job can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify a job name that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing job. + If you specify -Force parameter and specify an existing job name, the job definition will be replaced without confirmation. + + + + + + New + AzureStreamAnalyticsJob + + + + + + + + + New-AzureStreamAnalyticsJob + + ResourceGroupName + + + + string + + + Name + + + + string + + + File + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + File + + + + + string + + string + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureStreamAnalyticsOutput + + + + Asynchronously deletes a specific output from a Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the output will be deleted without confirmation. + + + + + + Remove + AzureStreamAnalyticsOutput + + + + + + + + + Remove-AzureStreamAnalyticsOutput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureStreamAnalyticsJob + + + + Asynchronously deletes a specific Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the job will be deleted without confirmation. + + + + + + Remove + AzureStreamAnalyticsJob + + + + + + + + + Remove-AzureStreamAnalyticsJob + + ResourceGroupName + + + + string + + + Name + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureStreamAnalyticsInput + + + + Asynchronously deletes a specific input from a Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the input will be deleted without confirmation. + + + + + + Remove + AzureStreamAnalyticsInput + + + + + + + + + Remove-AzureStreamAnalyticsInput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + Force + + + + + + PipelineVariable + + Not Specified + + string + + + + + + + Force + + + + + SwitchParameter + + SwitchParameter + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Start-AzureStreamAnalyticsJob + + + Asynchronously deploys and starts a Stream Analytics job in Microsoft Azure. + + + + + Start + AzureStreamAnalyticsJob + + + + + + + + + Start-AzureStreamAnalyticsJob + + ResourceGroupName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stop-AzureStreamAnalyticsJob + + + Asynchronously stops a Stream Analytics job from running in Microsoft Azure and de-allocates resources that were that were being used. The job definition and meta-data will remain available within your subscription through both the Azure Portal and Management APIs, such that the job can be edited and restarted. You will not be charged for a job in the Stopped state. + + + + + Stop + AzureStreamAnalyticsJob + + + + + + + + + Stop-AzureStreamAnalyticsJob + + ResourceGroupName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test-AzureStreamAnalyticsOutput + + + Tests the ability of Stream Analytics to connect to a specified output. + + + + + Test + AzureStreamAnalyticsOutput + + + + + + + + + Test-AzureStreamAnalyticsOutput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test-AzureStreamAnalyticsInput + + + Tests the ability of Stream Analytics to connect to a specified input. + + + + + Test + AzureStreamAnalyticsInput + + + + + + + + + Test-AzureStreamAnalyticsInput + + ResourceGroupName + + + + string + + + JobName + + + + string + + + Name + + + + string + + + PipelineVariable + + Not Specified + + string + + + + + + + JobName + + + + + string + + string + + + + + + Name + + + + + string + + string + + + + + + PipelineVariable + + Not Specified + + + string + + string + + + + + + ResourceGroupName + + + + + string + + string + + + + + + + + + + + + + + + + + + + + + + + + + System.Object + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 887bf76592494dfc2bb975ad92ca6b9315eafef6 Mon Sep 17 00:00:00 2001 From: arturocantu Date: Thu, 4 Dec 2014 15:20:21 -0800 Subject: [PATCH 23/32] Test code clean up --- .../Commands.StreamAnalytics.Test.csproj | 12 +++++------- .../Commands.StreamAnalytics.Test/packages.config | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index c5ed1b3a520e..694a8014a95b 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -13,6 +13,7 @@ 512 ..\..\..\ true + 7f789c0b true @@ -39,9 +40,6 @@ ..\..\..\packages\Microsoft.Azure.Management.Authorization.0.11.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll - - ..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.11.4-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll - ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll @@ -57,9 +55,6 @@ False ..\..\..\packages\Hydra.HttpRecorder.1.0.5417.13285-prerelease\lib\net45\Microsoft.Azure.Utilities.HttpRecorder.dll - - ..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -191,12 +186,15 @@ + + xcopy "$(SolutionDir)Package\$(ConfigurationName)\*.*" $(TargetDir) /Y /E + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + @@ -19,7 +20,7 @@ - + The Get-AzureStreamAnalyticsQuota cmdlet gets information about the Streaming Unit quota of a specified region. @@ -121,6 +122,32 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsQuota -Location "West US" + + + Description + ----------- + This command returns information about Streaming Unit quota and usage in the West US region. + + + + + + + + + + + @@ -146,7 +173,7 @@ - + The Get-AzureStreamAnalyticsTransformation cmdlet gets information about a specific transformation defined on Stream Analytics job. @@ -288,11 +315,37 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsTransformation -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name StreamingJob + + + Description + ----------- + This command returns information about the transformation called StreamingJob on the job StreamingJob. + + + + + + + + + + + - + New-AzureStreamAnalyticsTransformation @@ -313,7 +366,7 @@ - + The Get-AzureStreamAnalyticsOutput cmdlet lists all of the outputs that are defined in a specified Stream Analytics job or gets information about a specific output. @@ -455,11 +508,71 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob + + + Description + ----------- + This command returns information about the outputs defined on the job StreamingJob. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name Output + + + Description + ----------- + This command returns information about the output named Output defined on the job StreamingJob. + + + + + + + + + + + - + New-AzureStreamAnalyticsOutput + + + + Remove-AzureStreamAnalyticsOutput + + + + Test-AzureStreamAnalyticsOutput @@ -480,7 +593,7 @@ - + The Get-AzureStreamAnalyticsInput cmdlet lists all of the inputs that are defined in a specified Stream Analytics job or gets information about a specific input. @@ -622,11 +735,71 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob + + + Description + ----------- + This command returns information about all the inputs defined on the job StreamingJob. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name EntryStream + + + Description + ----------- + This command returns information about the input named EntryStream defined on the job StreamingJob. + + + + + + + + + + + - + New-AzureStreamAnalyticsInput + + + + Remove-AzureStreamAnalyticsInput + + + + Test-AzureStreamAnalyticsInput @@ -647,7 +820,7 @@ - + The Get-AzureStreamAnalyticsJob cmdlet lists all Stream Analytics jobs defined in the Azure subscription or specified resource group or gets job information about a specific job within a resource group. @@ -798,11 +971,101 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsJob + + + Description + ----------- + This command returns information about all the Stream Analytics jobs in the Azure subscription. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US + + + Description + ----------- + This command returns information about all the Stream Analytics jobs in the resource group StreamAnalytics-Default-West-US. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 3 -------------------------- + + + C:\PS> + + + Get-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -Name StreamingJob + + + Description + ----------- + This command returns information about the Stream Analytics job StreamingJob in the resource group StreamAnalytics-Default-West-US. + + + + + + + + + + + - + New-AzureStreamAnalyticsJob + + + + Remove-AzureStreamAnalyticsJob + + + + Start-AzureStreamAnalyticsJob + + + + Stop-AzureStreamAnalyticsJob @@ -828,7 +1091,12 @@ - + + The New-AzureStreamAnalyticsOutput cmdlet creates a new output within a Stream Analytics job or updates an existing output. + The name of the output can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify an output that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing output. + If you specify -Force parameter and specify an existing output name, the output will be replaced without confirmation. + @@ -1008,11 +1276,71 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\Output.json" -JobName StreamingJob -Name output + + + Description + ----------- + This command creates a new output called "output" in the job StreamingJob. If an existing output with this name is already defined, the cmdlet will ask whether or not to replace it. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\Output.json" -JobName StreamingJob -Name output -Force + + + Description + ----------- + This command replaces the definition for "output" in the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsOutput + + + + Remove-AzureStreamAnalyticsOutput + + + + Test-AzureStreamAnalyticsOutput @@ -1038,7 +1366,12 @@ - + + The New-AzureStreamAnalyticsTransformation cmdlet creates a new transformation within a Stream Analytics job or updates the existing transformation. + The name of the transformation can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify a transformation that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing transformation. + If you specify -Force parameter and specify an existing transformation name, the transformation will be replaced without confirmation. + @@ -1218,11 +1551,63 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsTransformation -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\Transformation.json" -JobName StreamingJob -Name StreamingJobTransform + + + Description + ----------- + This command creates a new transformation called StreamingJobTransform in the job StreamingJob. If an existing transformation is already defined with this name, the cmdlet will ask whether or not to replace it. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsTransformation -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\Transformation.json" -JobName StreamingJob -Name StreamingJobTransform -Force + + + Description + ----------- + This command replaces the definition of StreamingJobTransform in the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsTransformation @@ -1248,7 +1633,12 @@ - + + The New-AzureStreamAnalyticsInput cmdlet creates a new input within a Stream Analytics job or updates an existing specified input. + The name of the input can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify an input that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing input. + If you specify -Force parameter and specify an existing input name, the input will be replaced without confirmation. + @@ -1428,11 +1818,97 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -File "C:\Input.json" + + + Description + ----------- + This command creates a new input from the file Input.json. If an existing input with the name specified in the input definition file is already defined, the cmdlet will ask whether or not to replace it. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -File "C:\Input.json" -Name EntryStream + + + Description + ----------- + This command creates a new input on the job called EntryStream. If an existing input with this name is already defined, the cmdlet will ask whether or not to replace it. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 3 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -File "C:\Input.json" -Name EntryStream -Force + + + Description + ----------- + This command replaces the definition of the existing input source called EntryStream with the definition from file. + + + + + + + + + + + - + Get-AzureStreamAnalyticsInput + + + + Remove-AzureStreamAnalyticsInput + + + + Test-AzureStreamAnalyticsInput @@ -1458,7 +1934,12 @@ - + + The New-AzureStreamAnalyticsJob cmdlet creates a new Stream Analytics job in Microsoft Azure or updates the definition of an existing specified job. + The name of the job can be specified in the .JSON file or on the command line. If both are specified, the name on command line will be used instead of the name in the file. + If you specify a job name that already exists and do not specify -Force parameter, the cmdlet will ask whether or not to replace the existing job. + If you specify -Force parameter and specify an existing job name, the job definition will be replaced without confirmation. + @@ -1618,11 +2099,75 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\JobDefinition.json" + + + Description + ----------- + This command creates a new job from the definition in JobDefinition.json. If an existing job with the name specified in the job definition file is already defined, the cmdlet will ask whether or not to replace it. + + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + + C:\PS> + + + New-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -File "C:\JobDefinition.json" -Name StreamingJob -Force + + + Description + ----------- + This command replaces the job definition for StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsJob + + + + Remove-AzureStreamAnalyticsJob + + + + Start-AzureStreamAnalyticsJob + + + + Stop-AzureStreamAnalyticsJob @@ -1646,7 +2191,10 @@ - + + The Remove-AzureStreamAnalyticsOutput cmdlet asynchronously deletes a specific output from a Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the output will be deleted without confirmation. + @@ -1804,11 +2352,45 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Remove-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name Output + + + Description + ----------- + This command removes the output Output in the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsOutput + + + + New-AzureStreamAnalyticsOutput + + + + Test-AzureStreamAnalyticsOutput @@ -1832,7 +2414,10 @@ - + + The Remove-AzureStreamAnalyticsJob cmdlet asynchronously deletes a specific Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the job will be deleted without confirmation. + @@ -1970,11 +2555,49 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Remove-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -Name StreamingJob + + + Description + ----------- + This command removes the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsJob + + + + New-AzureStreamAnalyticsJob + + + + Start-AzureStreamAnalyticsJob + + + + Stop-AzureStreamAnalyticsJob @@ -2181,7 +2804,7 @@ - + The Start-AzureStreamAnalyticsJob cmdlet asynchronously deploys and starts a Stream Analytics job in Microsoft Azure. @@ -2300,11 +2923,49 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Start-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -Name StreamingJob + + + Description + ----------- + This command starts the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsJob + + + + New-AzureStreamAnalyticsJob + + + + Remove-AzureStreamAnalyticsJob + + + + Stop-AzureStreamAnalyticsJob @@ -2325,7 +2986,7 @@ - + The Stop-AzureStreamAnalyticsJob cmdlet asynchronously stops a Stream Analytics job from running in Microsoft Azure and de-allocates resources that were that were being used. The job definition and meta-data will remain available within your subscription through both the Azure Portal and Management APIs, such that the job can be edited and restarted. You will not be charged for a job in the Stopped state. @@ -2444,11 +3105,49 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Stop-AzureStreamAnalyticsJob -ResourceGroupName StreamAnalytics-Default-West-US -Name StreamingJob + + + Description + ----------- + This command stops the job StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsJob + + + + New-AzureStreamAnalyticsJob + + + + Remove-AzureStreamAnalyticsJob + + + + Start-AzureStreamAnalyticsJob @@ -2469,7 +3168,7 @@ - + The Test-AzureStreamAnalyticsOutput cmdlet tests the ability of Stream Analytics to connect to a specified output. @@ -2608,11 +3307,45 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Test-AzureStreamAnalyticsOutput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name Output + + + Description + ----------- + This tests the connection status of the output Output in StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsOuput + + + + New-AzureStreamAnalyticsOuput + + + + Remove-AzureStreamAnalyticsOuput @@ -2633,7 +3366,7 @@ - + The Test-AzureStreamAnalyticsInput cmdlet tests the ability of Stream Analytics to connect to a specified input. @@ -2772,11 +3505,45 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Test-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name EntryStream + + + Description + ----------- + This tests the connection status of the input EntryStream in StreamingJob. + + + + + + + + + + + - + Get-AzureStreamAnalyticsInput + + + + New-AzureStreamAnalyticsInput + + + + Remove-AzureStreamAnalyticsInput From f8e6cc4d565a4f4a873df90a21625ca4285899ab Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Thu, 4 Dec 2014 18:10:48 -0800 Subject: [PATCH 25/32] Fix helper content --- ...zure.Commands.StreamAnalytics.dll-Help.xml | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml index 9d76386146ac..ab498a9cf706 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml @@ -2602,6 +2602,7 @@ + @@ -2621,7 +2622,10 @@ - + + The Remove-AzureStreamAnalyticsInput cmdlet asynchronously deletes a specific input from a Stream Analytics job in Microsoft Azure. + If you specify -Force parameter the input will be deleted without confirmation. + @@ -2779,11 +2783,45 @@ + + + + -------------------------- EXAMPLE 1 -------------------------- + + + C:\PS> + + + Remove-AzureStreamAnalyticsInput -ResourceGroupName StreamAnalytics-Default-West-US -JobName StreamingJob -Name EventStream + + + Description + ----------- + This command removes the input EventStream from StreamingJob + + + + + + + + + + + - + New-AzureStreamAnalyticsInput + + + + Get-AzureStreamAnalyticsInput + + + + Test-AzureStreamAnalyticsInput From 94fe45d4889ac1a6dfa2813b18ab911221d809be Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 5 Dec 2014 10:10:13 -0800 Subject: [PATCH 26/32] Try to fix the bug --- src/AzurePowershell.sln | 2 +- src/ResourceManager.sln | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzurePowershell.sln b/src/AzurePowershell.sln index fcbd1995967c..d69164d019de 100644 --- a/src/AzurePowershell.sln +++ b/src/AzurePowershell.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject diff --git a/src/ResourceManager.sln b/src/ResourceManager.sln index e9948ee08a2c..aca639123545 100644 --- a/src/ResourceManager.sln +++ b/src/ResourceManager.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject From 7e13a84ebef38009d8546d9d0ee413df2bb6cef8 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 5 Dec 2014 12:03:19 -0800 Subject: [PATCH 27/32] Fix comments --- .../Commands.Resources/AzureResourceManager.psd1 | 2 +- .../Properties/AssemblyInfo.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index 1373d2110b45..b20cbdd8a995 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -64,7 +64,7 @@ FormatsToProcess = @( '.\DataFactories\Microsoft.Azure.Commands.DataFactories.format.ps1xml', '.\RedisCache\Microsoft.Azure.Commands.RedisCache.format.ps1xml', '.\Batch\Microsoft.Azure.Commands.Batch.format.ps1xml', - '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml' + '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml' ) # Modules to import as nested modules of the module specified in ModuleToProcess diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs index 15333c3ce642..6ad2d553c38d 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // 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("Commands.StreamAnalytics.Test")] +[assembly: AssemblyTitle("Microsoft.Azure.Commands.StreamAnalytics.Test")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Commands.StreamAnalytics.Test")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyProduct("Microsoft.Azure.Commands.StreamAnalytics.Test")] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)] +[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)] From b6bdc0de0f2f1dc112cab4395fb43090641c4578 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 5 Dec 2014 12:40:01 -0800 Subject: [PATCH 28/32] Fix comments --- .../Input/GetAzureStreamAnalyticsInputCommand.cs | 14 +------------- .../Job/GetAzureStreamAnalyticsJobCommand.cs | 14 +------------- .../Output/GetAzureStreamAnalyticsOutputCommand.cs | 14 +------------- .../GetAzureStreamAnalyticsQuotasCommand.cs | 14 +------------- ...GetAzureStreamAnalyticsTransformationCommand.cs | 3 +-- 5 files changed, 5 insertions(+), 54 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs index a8758fd75341..5e9e2ea7dff0 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Input/GetAzureStreamAnalyticsInputCommand.cs @@ -55,19 +55,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName }; - List inputs = StreamAnalyticsClient.FilterPSInputs(filterOptions); - - if (inputs != null) - { - if (inputs.Count == 1 && Name != null) - { - WriteObject(inputs[0]); - } - else - { - WriteObject(inputs, true); - } - } + WriteObject(StreamAnalyticsClient.FilterPSInputs(filterOptions), true); } } } \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs index 22e5a17981c0..4421edf2da72 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Job/GetAzureStreamAnalyticsJobCommand.cs @@ -62,19 +62,7 @@ public override void ExecuteCmdlet() PropertiesToExpand = propertiesToExpand }; - List jobs = StreamAnalyticsClient.FilterPSJobs(filterOptions); - - if (jobs != null) - { - if (jobs.Count == 1 && Name != null) - { - WriteObject(jobs[0]); - } - else - { - WriteObject(jobs, true); - } - } + WriteObject(StreamAnalyticsClient.FilterPSJobs(filterOptions), true); } } } \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs index 5b0442bda577..359f09a44969 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Output/GetAzureStreamAnalyticsOutputCommand.cs @@ -55,19 +55,7 @@ public override void ExecuteCmdlet() ResourceGroupName = ResourceGroupName }; - List outputs = StreamAnalyticsClient.FilterPSOutputs(filterOptions); - - if (outputs != null) - { - if (outputs.Count == 1 && Name != null) - { - WriteObject(outputs[0]); - } - else - { - WriteObject(outputs, true); - } - } + WriteObject(StreamAnalyticsClient.FilterPSOutputs(filterOptions), true); } } } \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs index 78c64c67a444..a98bcd5a7e23 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Subscription/GetAzureStreamAnalyticsQuotasCommand.cs @@ -34,19 +34,7 @@ public override void ExecuteCmdlet() throw new PSArgumentNullException("Location"); } - List quotas = StreamAnalyticsClient.GetQuotas(Location); - - if (quotas != null) - { - if (quotas.Count == 1 && Location != null) - { - WriteObject(quotas[0]); - } - else - { - WriteObject(quotas, true); - } - } + WriteObject(StreamAnalyticsClient.GetQuotas(Location), true); } } } \ No newline at end of file diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs index 55257706ff16..032d0cda2c61 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Transformation/GetAzureStreamAnalyticsTransformationCommand.cs @@ -48,8 +48,7 @@ public override void ExecuteCmdlet() throw new PSArgumentNullException("Name"); } - PSTransformation transformation = StreamAnalyticsClient.GetTransformation(ResourceGroupName, JobName, Name); - WriteObject(transformation); + WriteObject(StreamAnalyticsClient.GetTransformation(ResourceGroupName, JobName, Name)); } } } \ No newline at end of file From eb12baf643008474243b91cd7bd79ca4d4cc8d9f Mon Sep 17 00:00:00 2001 From: arturocantu Date: Fri, 5 Dec 2014 13:02:23 -0800 Subject: [PATCH 29/32] Test fixes --- .../Commands.StreamAnalytics.Test.csproj | 18 +++++++++++++----- .../MSSharedLibKey.snk | Bin 0 -> 160 bytes 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/MSSharedLibKey.snk diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index 694a8014a95b..2f48783dc71a 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -1,10 +1,11 @@  - + Debug AnyCPU {7E6683BE-ECFF-4709-89EB-1325E9E70512} + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties Commands.StreamAnalytics.Test @@ -25,12 +26,18 @@ 4 - pdbonly - true + true + MSSharedLibKey.snk + true + true + false bin\Release\ - TRACE + TRACE;SIGN + true + pdbonly + AnyCPU prompt - 4 + false @@ -159,6 +166,7 @@ + Designer diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/MSSharedLibKey.snk b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ Date: Fri, 5 Dec 2014 14:08:42 -0800 Subject: [PATCH 30/32] try to fix the issue --- setup/azurecmdfiles.wxi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index e69f18ac6a9b..1ad5dcbd7201 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -1191,15 +1191,9 @@ - - - - - - @@ -2449,9 +2443,7 @@ - - From d0dd0d9a8d3b58c225fd83f5df4982d863f3b913 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 5 Dec 2014 14:14:43 -0800 Subject: [PATCH 31/32] revert --- setup/azurecmdfiles.wxi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 1ad5dcbd7201..e69f18ac6a9b 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -1191,9 +1191,15 @@ + + + + + + @@ -2443,7 +2449,9 @@ + + From 81353158fd1a05466c7f16810e326f860ef63320 Mon Sep 17 00:00:00 2001 From: qunshuzhang Date: Fri, 5 Dec 2014 14:27:53 -0800 Subject: [PATCH 32/32] Try to fix the build issue --- AzurePowershell.Test.targets | 6 ++++++ build.proj | 2 +- .../Resources/Commands.Resources/Commands.Resources.csproj | 4 ++++ .../Commands.StreamAnalytics.Test.csproj | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index f31479edbba2..efe88235c84e 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -14,6 +14,7 @@ .\src\ServiceManagement\Services\Commands.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Test.dll .\src\ResourceManager\Resources\Commands.Resources.Test\bin\Debug\Microsoft.Azure.Commands.Resources.Test.dll .\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll + .\src\ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.StreamAnalytics.Test.dll .\src\ResourceManager\Batch\Commands.Batch.Test\bin\Debug\Microsoft.Azure.Commands.Batch.Test.dll .\src\ServiceManagement\Compute\Commands.ServiceManagement.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Test.dll .\src\ServiceManagement\Compute\Commands.ServiceManagement.Extensions.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.Test.dll @@ -69,6 +70,11 @@ ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" /> + + + + - + diff --git a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj index eebaf66df062..836fc4356341 100644 --- a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj +++ b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj @@ -234,6 +234,10 @@ {2493a8f7-1949-4f29-8d53-9d459046c3b8} Commands.Tags + + {F49A314A-A235-47D3-A654-1EC19ACA366C} + Commands.StreamAnalytics + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj index 2f48783dc71a..8040e1151acc 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj @@ -8,8 +8,8 @@ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties - Commands.StreamAnalytics.Test - Commands.StreamAnalytics.Test + Microsoft.Azure.Commands.StreamAnalytics.Test + Microsoft.Azure.Commands.StreamAnalytics.Test v4.5 512 ..\..\..\