Add powershell commands for the Azure stream analytics service

This commit is contained in:
qunshuzhang 2014-11-19 17:45:04 -08:00
Родитель e06a22c22f
Коммит 26cdd5b88e
52 изменённых файлов: 3474 добавлений и 4 удалений

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

@ -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

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

@ -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

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

@ -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

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

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7E6683BE-ECFF-4709-89EB-1325E9E70512}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Commands.StreamAnalytics.Test</RootNamespace>
<AssemblyName>Commands.StreamAnalytics.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

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

@ -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")]

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

@ -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<string> 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;
}
}
}

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

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F49A314A-A235-47D3-A654-1EC19ACA366C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.Commands.StreamAnalytics</RootNamespace>
<AssemblyName>Microsoft.Azure.Commands.StreamAnalytics</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<CodeAnalysisAdditionalOptions>/assemblyCompareMode:StrongNameIgnoringVersion</CodeAnalysisAdditionalOptions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Package\Debug\ResourceManager\AzureResourceManager\StreamAnalytics</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\Package\Release\ResourceManager\AzureResourceManager\StreamAnalytics</OutputPath>
<DefineConstants>TRACE;SIGN</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>bin\Release\Microsoft.Azure.Commands.Resources.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules</CodeAnalysisRuleDirectories>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Azure.Management.StreamAnalytics">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Common.NetFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.0\lib\net45\Microsoft.WindowsAzure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\Commands.Common.Storage\Commands.Common.Storage.csproj">
<Project>{65c3a86a-716d-4e7d-ab67-1db00b3bf72d}</Project>
<Name>Commands.Common.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\Commands.Profile\Commands.Profile.csproj">
<Project>{c60342b1-47d3-4a0e-8081-9b97ce60b7af}</Project>
<Name>Commands.Profile</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="CloudExceptionExtensions.cs" />
<Compile Include="Constants.cs" />
<Compile Include="Input\GetAzureStreamAnalyticsInputCommand.cs" />
<Compile Include="Input\NewAzureStreamAnalyticsInputCommand.cs" />
<Compile Include="Input\RemoveAzureStreamAnalyticsInputCommand.cs" />
<Compile Include="Job\GetAzureStreamAnalyticsJobCommand.cs" />
<Compile Include="Job\NewAzureStreamAnalyticsJobCommand.cs" />
<Compile Include="Job\RemoveAzureStreamAnalyticsJobCommand.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Job\StartAzureStreamAnalyticsJobCommand.cs" />
<Compile Include="Job\StopAzureStreamAnalyticsJobCommand.cs" />
<Compile Include="Models\CreatePSInputParameter.cs" />
<Compile Include="Models\CreatePSJobParameter.cs" />
<Compile Include="Models\CreatePSOutputParameter.cs" />
<Compile Include="Models\CreatePSTransformationParameter.cs" />
<Compile Include="Models\InputFilterOptions.cs" />
<Compile Include="Models\JobParametersBase.cs" />
<Compile Include="Models\OutputFilterOptions.cs" />
<Compile Include="Models\PSInput.cs" />
<Compile Include="Models\PSJob.cs" />
<Compile Include="Models\PSOutput.cs" />
<Compile Include="Models\PSQuota.cs" />
<Compile Include="Models\PSTransformation.cs" />
<Compile Include="Models\StreamAnalyticsClient.cs" />
<Compile Include="Models\StreamAnalyticsClient.Inputs.cs" />
<Compile Include="Models\StreamAnalyticsClient.Jobs.cs" />
<Compile Include="Models\JobFilterOptions.cs" />
<Compile Include="Models\StreamAnalyticsClient.Outputs.cs" />
<Compile Include="Models\StreamAnalyticsClient.SubscriptionQuotas.cs" />
<Compile Include="Models\StreamAnalyticsClient.Transformation.cs" />
<Compile Include="Models\StreamAnalyticsClientExtensions.cs" />
<Compile Include="Output\GetAzureStreamAnalyticsOutputCommand.cs" />
<Compile Include="Output\NewAzureStreamAnalyticsOutputCommand.cs" />
<Compile Include="Output\RemoveAzureStreamAnalyticsOutputCommand.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="StreamAnalyticsBaseCmdlet.cs" />
<Compile Include="StreamAnalyticsCommonUtilities.cs" />
<Compile Include="StreamAnalyticsResourceProviderBaseCmdlet.cs" />
<Compile Include="Subscription\GetAzureStreamAnalyticsQuotasCommand.cs" />
<Compile Include="Transformation\GetAzureStreamAnalyticsTransformationCommand.cs" />
<Compile Include="Transformation\NewAzureStreamAnalyticsTransformationCommand.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Microsoft.Azure.Commands.StreamAnalytics.dll-Help.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="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=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
</Project>

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

@ -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";
}
}

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

@ -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<PSInput>), 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<PSInput> inputs = StreamAnalyticsClient.FilterPSInputs(filterOptions);
if (inputs != null)
{
if (inputs.Count == 1 && Name != null)
{
WriteObject(inputs[0]);
}
else
{
WriteObject(inputs, true);
}
}
}
}
}

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

@ -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));
}
}
}

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

@ -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);
}
}
}
}

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

@ -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<PSJob>), 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<PSJob> jobs = StreamAnalyticsClient.FilterPSJobs(filterOptions);
if (jobs != null)
{
if (jobs.Count == 1 && Name != null)
{
WriteObject(jobs[0]);
}
else
{
WriteObject(jobs, true);
}
}
}
}
}

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

@ -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));
}
}
}

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

@ -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);
}
}
}
}

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

@ -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);
}
}
}
}

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

@ -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);
}
}
}
}

Двоичный файл не отображается.

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<helpItems xmlns="http://msh" schema="maml">
<!--a place holder-->
</helpItems>

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

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<ViewDefinitions>
<View>
<Name>Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.Commands.StreamAnalytics.Models.PSJob</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
<ListEntry>
<ListItems>
<ListItem>
<Label>JobName</Label>
<PropertyName>JobName</PropertyName>
</ListItem>
<ListItem>
<Label>ResourceGroupName</Label>
<PropertyName>ResourceGroupName</PropertyName>
</ListItem>
<ListItem>
<Label>Location</Label>
<PropertyName>Location</PropertyName>
</ListItem>
<ListItem>
<Label>CreatedDate</Label>
<PropertyName>CreatedDate</PropertyName>
</ListItem>
<ListItem>
<Label>ProvisioningState</Label>
<PropertyName>ProvisioningState</PropertyName>
</ListItem>
<ListItem>
<Label>JobState</Label>
<PropertyName>JobState</PropertyName>
</ListItem>
<ListItem>
<Label>Tags</Label>
<PropertyName>Tags</PropertyName>
</ListItem>
<ListItem>
<Label>Properties</Label>
<PropertyName>PropertiesInJson</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
</ListControl>
</View>
</ViewDefinitions>
</Configuration>

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

@ -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<bool, string, string, string, Action> ConfirmAction { get; set; }
}
}

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

@ -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<bool, string, string, string, Action> ConfirmAction { get; set; }
}
}

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

@ -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<bool, string, string, string, Action> ConfirmAction { get; set; }
}
}

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

@ -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<bool, string, string, string, Action> ConfirmAction { get; set; }
}
}

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

@ -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; }
}
}

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

@ -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; }
}
}

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

@ -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; }
}
}

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

@ -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; }
}
}

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

@ -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;
}
}
}
}

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

@ -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<string, string> 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(); }
}
}
}

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

@ -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;
}
}
}
}

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

@ -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;
}
}
}
}

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

@ -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;
}
}
}
}

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

@ -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<PSInput> ListInputs(string resourceGroupName, string jobName)
{
List<PSInput> inputs = new List<PSInput>();
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<PSInput> 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<PSInput> inputs = new List<PSInput>();
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;
}
}
}
}
}

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

@ -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<PSJob> ListJobs(string resourceGroupName, string propertiesToExpand)
{
List<PSJob> jobs = new List<PSJob>();
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<PSJob> ListJobs(string propertiesToExpand)
{
List<PSJob> jobs = new List<PSJob>();
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<PSJob> FilterPSJobs(JobFilterOptions filterOptions)
{
if (filterOptions == null)
{
throw new ArgumentNullException("filterOptions");
}
List<PSJob> jobs = new List<PSJob>();
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;
}
}
}
}
}

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

@ -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<PSOutput> ListOutputs(string resourceGroupName, string jobName)
{
List<PSOutput> outputs = new List<PSOutput>();
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<PSOutput> 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<PSOutput> outputs = new List<PSOutput>();
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;
}
}
}
}
}

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

@ -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<PSQuota> GetQuotas(string location)
{
List<PSQuota> quotas = new List<PSQuota>();
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;
}
}
}

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

@ -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;
}
}
}
}
}

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

@ -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<StreamAnalyticsManagementClient>(
context, AzureEnvironment.Endpoint.ResourceManager);
}
/// <summary>
/// Parameterless constructor for Mocking.
/// </summary>
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();
}
}
}
}

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

@ -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>(T objectToSerialize)
{
return JsonConvert.SerializeObject(objectToSerialize, Formatting.Indented);
}
}
}

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

@ -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<PSOutput>), 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<PSOutput> outputs = StreamAnalyticsClient.FilterPSOutputs(filterOptions);
if (outputs != null)
{
if (outputs.Count == 1 && Name != null)
{
WriteObject(outputs[0]);
}
else
{
WriteObject(outputs, true);
}
}
}
}
}

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

@ -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));
}
}
}

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

@ -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);
}
}
}
}

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

@ -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

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

@ -0,0 +1,228 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Azure.Commands.StreamAnalytics.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to {0} name provided using -Name switch: &apos;{1}&apos; in cmdlet doesn&apos;t match with {0} name: &apos;{2}&apos; in JSON file. {0} will be created with name: &apos;{1}&apos;.
/// </summary>
internal static string ExtractedNameFromJsonMismatchWarning {
get {
return ResourceManager.GetString("ExtractedNameFromJsonMismatchWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to HTTP Status Code: {0}
///Error Code: {1}
///Error Message: {2}
///Request Id: {3}
///Timestamp (Utc):{4}.
/// </summary>
internal static string FormattedCloudExceptionMessageTemplate {
get {
return ResourceManager.GetString("FormattedCloudExceptionMessageTemplate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Creating input &apos;{0}&apos; in stream analytics job {1} in resource group &apos;{2}&apos;..
/// </summary>
internal static string InputCreating {
get {
return ResourceManager.GetString("InputCreating", resourceCulture);
}
}
/// <summary>
/// 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?.
/// </summary>
internal static string InputExists {
get {
return ResourceManager.GetString("InputExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Input &apos;{0}&apos; does not exist in the stream analytics job {1} in the resource group &apos;{2}&apos;..
/// </summary>
internal static string InputNotFound {
get {
return ResourceManager.GetString("InputNotFound", resourceCulture);
}
}
/// <summary>
/// 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..
/// </summary>
internal static string InvalidJson {
get {
return ResourceManager.GetString("InvalidJson", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Creating job &apos;{0}&apos; in resource group &apos;{1}&apos;..
/// </summary>
internal static string JobCreating {
get {
return ResourceManager.GetString("JobCreating", resourceCulture);
}
}
/// <summary>
/// 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?.
/// </summary>
internal static string JobExists {
get {
return ResourceManager.GetString("JobExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Stream analytics job name cannot be null..
/// </summary>
internal static string JobNameCannotBeEmpty {
get {
return ResourceManager.GetString("JobNameCannotBeEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Job &apos;{0}&apos; does not exist in the resource group &apos;{1}&apos;..
/// </summary>
internal static string JobNotFound {
get {
return ResourceManager.GetString("JobNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Creating output &apos;{0}&apos; in stream analytics job {1} in resource group &apos;{2}&apos;..
/// </summary>
internal static string OutputCreating {
get {
return ResourceManager.GetString("OutputCreating", resourceCulture);
}
}
/// <summary>
/// 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?.
/// </summary>
internal static string OutputExists {
get {
return ResourceManager.GetString("OutputExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Output &apos;{0}&apos; does not exist in the stream analytics job {1} in the resource group &apos;{2}&apos;..
/// </summary>
internal static string OutputNotFound {
get {
return ResourceManager.GetString("OutputNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Resource group name cannot be null..
/// </summary>
internal static string ResourceGroupNameCannotBeEmpty {
get {
return ResourceManager.GetString("ResourceGroupNameCannotBeEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Creating transformation &apos;{0}&apos; in stream analytics job {1} in resource group &apos;{2}&apos;..
/// </summary>
internal static string TransformationCreating {
get {
return ResourceManager.GetString("TransformationCreating", resourceCulture);
}
}
/// <summary>
/// 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?.
/// </summary>
internal static string TransformationExists {
get {
return ResourceManager.GetString("TransformationExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Transformation &apos;{0}&apos; does not exist in the stream analytics job {1} in the resource group &apos;{2}&apos;..
/// </summary>
internal static string TransformationNotFound {
get {
return ResourceManager.GetString("TransformationNotFound", resourceCulture);
}
}
}
}

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

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="FormattedCloudExceptionMessageTemplate" xml:space="preserve">
<value>HTTP Status Code: {0}
Error Code: {1}
Error Message: {2}
Request Id: {3}
Timestamp (Utc):{4}</value>
</data>
<data name="ResourceGroupNameCannotBeEmpty" xml:space="preserve">
<value>Resource group name cannot be null.</value>
</data>
<data name="JobNameCannotBeEmpty" xml:space="preserve">
<value>Stream analytics job name cannot be null.</value>
</data>
<data name="InvalidJson" xml:space="preserve">
<value>Failed to parse input JSON file. {0}. Please correct the error in the JSON file and re-deploy {1} again.</value>
</data>
<data name="ExtractedNameFromJsonMismatchWarning" xml:space="preserve">
<value>{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}'</value>
</data>
<data name="JobExists" xml:space="preserve">
<value>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?</value>
</data>
<data name="InputExists" xml:space="preserve">
<value>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?</value>
</data>
<data name="OutputExists" xml:space="preserve">
<value>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?</value>
</data>
<data name="TransformationExists" xml:space="preserve">
<value>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?</value>
</data>
<data name="JobCreating" xml:space="preserve">
<value>Creating job '{0}' in resource group '{1}'.</value>
</data>
<data name="InputCreating" xml:space="preserve">
<value>Creating input '{0}' in stream analytics job {1} in resource group '{2}'.</value>
</data>
<data name="OutputCreating" xml:space="preserve">
<value>Creating output '{0}' in stream analytics job {1} in resource group '{2}'.</value>
</data>
<data name="TransformationCreating" xml:space="preserve">
<value>Creating transformation '{0}' in stream analytics job {1} in resource group '{2}'.</value>
</data>
<data name="JobNotFound" xml:space="preserve">
<value>Job '{0}' does not exist in the resource group '{1}'.</value>
</data>
<data name="InputNotFound" xml:space="preserve">
<value>Input '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.</value>
</data>
<data name="OutputNotFound" xml:space="preserve">
<value>Output '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.</value>
</data>
<data name="TransformationNotFound" xml:space="preserve">
<value>Transformation '{0}' does not exist in the stream analytics job {1} in the resource group '{2}'.</value>
</data>
</root>

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

@ -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;
}
}
}

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

@ -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<string, object> 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<string, string> ExtractTagsFromJson(string jsonText)
{
Dictionary<string, object> 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<string, object>).ToDictionary(
p => p.Key,
p => (string)p.Value);
return tags;
}
}
return null;
}
public static Dictionary<string, string> ToDictionary(this Hashtable hashTable)
{
return hashTable.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
}
public static bool TagsAreEqual(IDictionary<string, string> first, IDictionary<string, string> 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;
}
}
}

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

@ -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; }
}
}

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

@ -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<PSQuota>), 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<PSQuota> quotas = StreamAnalyticsClient.GetQuotas(Location);
if (quotas != null)
{
if (quotas.Count == 1 && Location != null)
{
WriteObject(quotas[0]);
}
else
{
WriteObject(quotas, true);
}
}
}
}
}

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

@ -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<PSTransformation>), 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);
}
}
}

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

@ -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));
}
}
}

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

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.Management.StreamAnalytics" version="0.12.1-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Common" version="1.4.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Common.Dependencies" version="1.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
</packages>