Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Move Test-AzureName cmdlet from private to public #706

Merged
merged 1 commit into from

2 participants

@ogail
Collaborator

No description provided.

@christav

LGTM

@ogail ogail merged commit 4200b78 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 7, 2012
  1. @ogail
This page is out of date. Refresh to see the latest.
View
80 WindowsAzurePowershell/src/Management.CloudService/Cmdlet/TestAzureNameCommand.cs
@@ -0,0 +1,80 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright 2011 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.WindowsAzure.Management.CloudService.Cmdlet
+{
+ using System.Management.Automation;
+ using Microsoft.WindowsAzure.Management.CloudService.Cmdlet.Common;
+ using Samples.WindowsAzure.ServiceManagement;
+
+ [Cmdlet(VerbsDiagnostic.Test, "AzureName")]
+ public class TestAzureNameCommand : CloudCmdlet<IServiceManagement>
+ {
+ public TestAzureNameCommand()
+ {
+ }
+
+ public TestAzureNameCommand(IServiceManagement channel)
+ {
+ Channel = channel;
+ }
+
+ [Parameter(Position = 0, Mandatory = true, ParameterSetName = "Service", HelpMessage = "Test for a cloud service name.")]
+ public SwitchParameter Service
+ {
+ get;
+ set;
+ }
+
+ [Parameter(Position = 0, Mandatory = true, ParameterSetName = "Storage", HelpMessage = "Test for a storage account name.")]
+ public SwitchParameter Storage
+ {
+ get;
+ set;
+ }
+
+ [Parameter(Position = 1, ParameterSetName = "Service", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Cloud service name.")]
+ [Parameter(Position = 1, ParameterSetName = "Storage", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Storage account name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name
+ {
+ get;
+ set;
+ }
+
+ public void IsDNSAvailable(string name)
+ {
+ ExecuteClientActionInOCS(null, "IsDNSAvailable", s => Channel.IsDNSAvailable(s, name), WaitForOperation, (op, response) => !response.Result);
+ }
+
+ public void IsStorageServiceAvailable(string name)
+ {
+ ExecuteClientActionInOCS(null, "IsStorageServiceAvailable", s => Channel.IsStorageServiceAvailable(s, Name), WaitForOperation, (op, response) => !response.Result);
+ }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+
+ if (Service.IsPresent)
+ {
+ IsDNSAvailable(Name);
+ }
+ else
+ {
+ IsStorageServiceAvailable(Name);
+ }
+ }
+ }
+}
View
1  WindowsAzurePowershell/src/Management.CloudService/Management.CloudService.csproj
@@ -131,6 +131,7 @@
<Compile Include="Cmdlet\EnableAzureMemcacheRole.cs" />
<Compile Include="Cmdlet\GetAzureServiceProjectRoleRuntime.cs" />
<Compile Include="Cmdlet\SetAzureServiceProject.cs" />
+ <Compile Include="Cmdlet\TestAzureNameCommand.cs" />
<Compile Include="Microsoft.WindowsAzure.Management.CloudServiceSnapIn.cs">
<SubType>Component</SubType>
</Compile>
View
164 ...sAzurePowershell/src/Management.CloudService/Microsoft.WindowsAzure.Management.CloudService.dll-Help.xml
@@ -2869,4 +2869,168 @@ C:\PS&gt; </maml:introduction>
</maml:navigationLink>
</maml:relatedLinks>
</command:command>
+<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
+ <command:details>
+ <command:name>Test-AzureName</command:name>
+ <maml:description>
+ <maml:para>Tests whether a Windows Azure service or storage name is already in use.</maml:para>
+ </maml:description>
+ <maml:copyright>
+ <maml:para />
+ </maml:copyright>
+ <command:verb>Test</command:verb>
+ <command:noun>AzureName</command:noun>
+ <dev:version />
+ </command:details>
+ <maml:description>
+ <maml:para>The Test-AzureName tests whether a Windows Azure service name or storage name is in use. If the name is in use, the cmdlet returns $True. If the name is not being used, it returns $False. You can test for a service name or a storage name. </maml:para>
+ </maml:description>
+ <command:syntax>
+ <command:syntaxItem>
+ <maml:name>Test-AzureName</maml:name>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
+ <maml:name>Service</maml:name>
+ <maml:description>
+ <maml:para>Specifies to test for an existing service account.</maml:para>
+ </maml:description>
+ <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
+ </command:parameter>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="2" aliases="">
+ <maml:name>Name</maml:name>
+ <maml:description>
+ <maml:para>Specifies the name of the service or storage account to test.</maml:para>
+ </maml:description>
+ <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
+ </command:parameter>
+ </command:syntaxItem>
+ <command:syntaxItem>
+ <maml:name>Test-AzureName</maml:name>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
+ <maml:name>Storage</maml:name>
+ <maml:description>
+ <maml:para>Specifies to test for an existing storage account.</maml:para>
+ </maml:description>
+ <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
+ </command:parameter>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="2" aliases="">
+ <maml:name>Name</maml:name>
+ <maml:description>
+ <maml:para>Specifies the name of the service or storage account to test.</maml:para>
+ </maml:description>
+ <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
+ </command:parameter>
+ </command:syntaxItem>
+ </command:syntax>
+ <command:parameters>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByPropertyName)" position="2" aliases="">
+ <maml:name>Name</maml:name>
+ <maml:description>
+ <maml:para>Specifies the name of the service or storage account to test.</maml:para>
+ </maml:description>
+ <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
+ <dev:type>
+ <maml:name>String</maml:name>
+ <maml:uri />
+ </dev:type>
+ <dev:defaultValue></dev:defaultValue>
+ </command:parameter>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
+ <maml:name>Service</maml:name>
+ <maml:description>
+ <maml:para>Specifies to test for an existing service account.</maml:para>
+ </maml:description>
+ <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
+ <dev:type>
+ <maml:name>SwitchParameter</maml:name>
+ <maml:uri />
+ </dev:type>
+ <dev:defaultValue></dev:defaultValue>
+ </command:parameter>
+ <command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="1" aliases="">
+ <maml:name>Storage</maml:name>
+ <maml:description>
+ <maml:para>Specifies to test for an existing storage account.</maml:para>
+ </maml:description>
+ <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
+ <dev:type>
+ <maml:name>SwitchParameter</maml:name>
+ <maml:uri />
+ </dev:type>
+ <dev:defaultValue></dev:defaultValue>
+ </command:parameter>
+ </command:parameters>
+ <command:inputTypes>
+ <command:inputType>
+ <dev:type>
+ <maml:name></maml:name>
+ <maml:uri></maml:uri>
+ <maml:description>
+ <maml:para />
+ </maml:description>
+ </dev:type>
+ <maml:description></maml:description>
+ </command:inputType>
+ </command:inputTypes>
+ <command:returnValues>
+ <command:returnValue>
+ <dev:type>
+ <maml:name></maml:name>
+ <maml:uri></maml:uri>
+ <maml:description>
+ <maml:para />
+ </maml:description>
+ </dev:type>
+ <maml:description></maml:description>
+ </command:returnValue>
+ </command:returnValues>
+ <command:terminatingErrors />
+ <command:nonTerminatingErrors />
+ <maml:alertSet>
+ <maml:title></maml:title>
+ <maml:alert>
+ <maml:para>node-dev, php-dev</maml:para>
+ </maml:alert>
+ </maml:alertSet>
+ <command:examples>
+ <command:example>
+ <maml:title>
+ -------------- Example 1 --------------
+ </maml:title>
+ <maml:introduction>
+ <maml:para></maml:para>
+ </maml:introduction>
+ <dev:code>
+ C:\PS&gt;Test-AzureName –Service "MyNameService1"
+ </dev:code>
+ <dev:remarks>
+ <maml:para>This command tests to see if the "MyNameService1" is an existing Windows Azure service name. </maml:para>
+ </dev:remarks>
+ <command:commandLines>
+ <command:commandLine>
+ <command:commandText />
+ </command:commandLine>
+ </command:commandLines>
+ </command:example>
+ <command:example>
+ <maml:title>
+ -------------- Example 2 --------------
+ </maml:title>
+ <maml:introduction>
+ <maml:para></maml:para>
+ </maml:introduction>
+ <dev:code>
+ C:\PS&gt;Test-AzureName –Storage "mystorename1"
+ </dev:code>
+ <dev:remarks>
+ <maml:para>This command tests to see if the "mystorename1" is an existing Windows Azure storage account name. </maml:para>
+ </dev:remarks>
+ <command:commandLines>
+ <command:commandLine>
+ <command:commandText />
+ </command:commandLine>
+ </command:commandLines>
+ </command:example>
+ </command:examples>
+ <maml:relatedLinks></maml:relatedLinks>
+</command:command>
</helpItems>
Something went wrong with that request. Please try again.