Initial Code Import
Change-Id: Ic5be6fe4e739c01656160ee8a8070ab08aef448f
This commit is contained in:
parent
e2d543c344
commit
961f31ef64
6
.nuget/NuGet.Config
Normal file
6
.nuget/NuGet.Config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
</configuration>
|
BIN
.nuget/NuGet.exe
Normal file
BIN
.nuget/NuGet.exe
Normal file
Binary file not shown.
151
.nuget/NuGet.targets
Normal file
151
.nuget/NuGet.targets
Normal file
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
||||
|
||||
<!-- Enable the restore command to run before builds -->
|
||||
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
|
||||
|
||||
<!-- Property that enables building a package from a project -->
|
||||
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
|
||||
|
||||
<!-- Determines if package restore consent is required to restore packages -->
|
||||
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
|
||||
|
||||
<!-- Download NuGet.exe if it does not already exist -->
|
||||
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
||||
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
|
||||
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
|
||||
<!--
|
||||
<PackageSource Include="https://www.nuget.org/api/v2/" />
|
||||
<PackageSource Include="https://my-nuget-source/nuget/" />
|
||||
-->
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
|
||||
<!-- Windows specific commands -->
|
||||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
|
||||
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
||||
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackagesProjectConfig>packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
|
||||
</PropertyGroup>
|
||||
|
||||
<Choose>
|
||||
<When Condition="Exists('$(PackagesProjectConfig)')">
|
||||
<PropertyGroup>
|
||||
<PackagesConfig>$(PackagesProjectConfig)</PackagesConfig>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
<When Condition="Exists('packages.config')">
|
||||
<PropertyGroup>
|
||||
<PackagesConfig>packages.config</PackagesConfig>
|
||||
</PropertyGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- NuGet command -->
|
||||
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
|
||||
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
|
||||
|
||||
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
||||
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
||||
|
||||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
||||
|
||||
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
|
||||
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
|
||||
|
||||
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
|
||||
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
|
||||
|
||||
<!-- Commands -->
|
||||
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
|
||||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
|
||||
|
||||
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
||||
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
||||
RestorePackages;
|
||||
$(BuildDependsOn);
|
||||
</BuildDependsOn>
|
||||
|
||||
<!-- Make the build depend on restore packages -->
|
||||
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
||||
$(BuildDependsOn);
|
||||
BuildPackage;
|
||||
</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CheckPrerequisites">
|
||||
<!-- Raise an error if we're unable to locate nuget.exe -->
|
||||
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
||||
<!--
|
||||
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
|
||||
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
||||
parallel builds will have to wait for it to complete.
|
||||
-->
|
||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_DownloadNuGet">
|
||||
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(BuildCommand)"
|
||||
Condition=" '$(OS)' != 'Windows_NT' " />
|
||||
|
||||
<Exec Command="$(BuildCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
</Target>
|
||||
|
||||
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<OutputFilename ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Reference Include="System.Core" />
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Net" />
|
||||
<Using Namespace="Microsoft.Build.Framework" />
|
||||
<Using Namespace="Microsoft.Build.Utilities" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
try {
|
||||
OutputFilename = Path.GetFullPath(OutputFilename);
|
||||
|
||||
Log.LogMessage("Downloading latest version of NuGet.exe...");
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.LogErrorFromException(ex);
|
||||
return false;
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
</Project>
|
4
.nuget/packages.config
Normal file
4
.nuget/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle1.7" version="1.7" />
|
||||
</packages>
|
@ -0,0 +1,46 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Openstack.Client.Powershell.Deployment", "Openstack.Client.Powershell.Deployment.vdproj", "{15B40627-0EBD-4D70-A69C-F248EBD1BD36}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Openstack.Client.Powershell", "..\Openstack.Client.Powershell\Openstack.Client.Powershell.csproj", "{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Openstack.Common", "..\..\OpenStack-API\Openstack.Common\Openstack.Common.csproj", "{F6AF0191-F236-4C26-8C93-30D5F4D8000F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Openstack.Objects", "..\..\OpenStack-API\Openstack.Objects\Openstack.Objects.csproj", "{BDCDCBF5-3467-461E-8307-E1E4E19F6532}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
TransformTool Build|Any CPU = TransformTool Build|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{15B40627-0EBD-4D70-A69C-F248EBD1BD36}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{15B40627-0EBD-4D70-A69C-F248EBD1BD36}.Release|Any CPU.ActiveCfg = Release
|
||||
{15B40627-0EBD-4D70-A69C-F248EBD1BD36}.Release|Any CPU.Build.0 = Release
|
||||
{15B40627-0EBD-4D70-A69C-F248EBD1BD36}.TransformTool Build|Any CPU.ActiveCfg = Release
|
||||
{15B40627-0EBD-4D70-A69C-F248EBD1BD36}.TransformTool Build|Any CPU.Build.0 = Release
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.TransformTool Build|Any CPU.ActiveCfg = TransformTool Build|Any CPU
|
||||
{32BAC168-2EC8-4074-9E6D-8C13460DCFAD}.TransformTool Build|Any CPU.Build.0 = TransformTool Build|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.TransformTool Build|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6AF0191-F236-4C26-8C93-30D5F4D8000F}.TransformTool Build|Any CPU.Build.0 = Release|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.TransformTool Build|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BDCDCBF5-3467-461E-8307-E1E4E19F6532}.TransformTool Build|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
File diff suppressed because it is too large
Load Diff
242
Openstack.Client.Powershell/BaseNavigationCmdletProvider.cs
Normal file
242
Openstack.Client.Powershell/BaseNavigationCmdletProvider.cs
Normal file
@ -0,0 +1,242 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Provider;
|
||||
using Openstack;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Threading;
|
||||
using Openstack.Client.Powershell.Utility;
|
||||
using Openstack.Storage;
|
||||
using System.Security;
|
||||
using System.Linq;
|
||||
using Openstack.Identity;
|
||||
|
||||
|
||||
namespace Openstack.Client.Powershell.Providers.Common
|
||||
{
|
||||
public class BaseNavigationCmdletProvider : NavigationCmdletProvider
|
||||
{
|
||||
|
||||
OpenstackClient _client; // = new OpenstackClient(credential, CancellationToken.None);
|
||||
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected OpenstackClient Client
|
||||
{
|
||||
get
|
||||
{
|
||||
return (OpenstackClient)this.SessionState.PSVariable.Get("Client").Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Client", value));
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
protected Settings Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Context.Settings;
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected Context Context
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Context)this.SessionState.PSVariable.GetValue("Context", null);
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
private bool IsContextInitialized()
|
||||
{
|
||||
if (this.SessionState.PSVariable.GetValue("Context", null) == null) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
protected string ConfigFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return (string)this.SessionState.PSVariable.Get("ConfigPath").Value;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + @"OS\CLI.config";
|
||||
}
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
private void SetZoneColor()
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement defaultZoneNode = doc.XPathSelectElement("//AvailabilityZone[@isDefault='True']");
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), defaultZoneNode.Attribute("shellForegroundColor").Value);
|
||||
this.Host.UI.RawUI.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), defaultZoneNode.Attribute("shellForegroundColor").Value);
|
||||
this.Context.Forecolor = defaultZoneNode.Attribute("shellForegroundColor").Value;
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected void InitializeSession()
|
||||
{
|
||||
CredentialManager manager = new CredentialManager(false);
|
||||
IOpenstackCredential credential = manager.GetCredentials(false);
|
||||
|
||||
// Connect to the Service Provider..
|
||||
|
||||
var client = new OpenstackClient(credential, CancellationToken.None);
|
||||
var connectTask = client.Connect();
|
||||
connectTask.Wait();
|
||||
|
||||
// Setup the environment based on what came back from Auth..
|
||||
|
||||
Context context = new Context();
|
||||
context.ServiceCatalog = credential.ServiceCatalog;
|
||||
context.Settings = Settings.Default;
|
||||
context.ProductName = "Openstack-WinCLI";
|
||||
context.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Context", context));
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Client", client));
|
||||
this.SetZoneColor();
|
||||
}
|
||||
#region Implementation of DriveCmdletProvider
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
/// Removes an Item from the store..
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
//==================================================================================================
|
||||
protected override void ClearItem(string path)
|
||||
{
|
||||
base.ClearItem(path);
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
/// Called when the user decides to delete a KVSDrive.
|
||||
/// </summary>
|
||||
/// <param name="drive"></param>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
protected override PSDriveInfo RemoveDrive(PSDriveInfo drive)
|
||||
{
|
||||
if (drive == null)
|
||||
{
|
||||
WriteError(new ErrorRecord(new ArgumentNullException("drive"), "NullDrive", ErrorCategory.InvalidArgument, drive));
|
||||
return null;
|
||||
}
|
||||
return drive;
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="returnContainers"></param>
|
||||
//==================================================================================================
|
||||
protected override void GetChildNames(string path, ReturnContainers returnContainers)
|
||||
{
|
||||
WriteItemObject(path, path, true);
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
protected override string GetChildName(string path)
|
||||
{
|
||||
return base.GetChildName(path);
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
protected override bool ItemExists(string path)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
/// This test should not verify the existance of the item at the path.
|
||||
/// It should only perform syntactic and semantic validation of the
|
||||
/// path. For instance, for the file system provider, that path should
|
||||
/// be canonicalized, syntactically verified, and ensure that the path
|
||||
/// does not refer to a device.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
protected override bool IsValidPath(string path)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
383
Openstack.Client.Powershell/Cmdlets/BasePSCmdlet.cs
Normal file
383
Openstack.Client.Powershell/Cmdlets/BasePSCmdlet.cs
Normal file
@ -0,0 +1,383 @@
|
||||
///* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//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.Text;
|
||||
//using System.Management.Automation;
|
||||
//using Openstack.Objects.DataAccess;
|
||||
//using System.IO;
|
||||
//using Openstack.Common.Properties;
|
||||
//using System.Xml;
|
||||
//using System.Xml.Serialization;
|
||||
//using Openstack.Client.Powershell.Providers.Storage;
|
||||
//using Openstack.Objects.Domain;
|
||||
//using Openstack.Objects.Utility;
|
||||
//using Openstack.Client.Powershell.Providers.Common;
|
||||
//using System.Linq;
|
||||
//using System.Collections.ObjectModel;
|
||||
//using System.Management.Automation.Host;
|
||||
|
||||
//namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
//{
|
||||
// public class BasePSCmdlet : PSCmdlet
|
||||
// {
|
||||
// private Openstack.Objects.DataAccess.ResponseFormat _responseFormat = ResponseFormat.none;
|
||||
// private BaseRepositoryFactory _repositoryFactory;
|
||||
|
||||
// #region Properties
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected BaseUIContainer CurrentContainer
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
// if (tempDrive != null)
|
||||
// {
|
||||
// return tempDrive.CurrentContainer as BaseUIContainer;
|
||||
// }
|
||||
// else return null;
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// Exposes the currently mapped Drive. Belongs in base class???
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected PSDriveInfo Drive
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return this.SessionState.Drive.Current;
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="message"></param>
|
||||
////=========================================================================================
|
||||
// protected void WriteHeaderSection(string headerText)
|
||||
// {
|
||||
// WriteObject(" ");
|
||||
// Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
// WriteObject("==============================================================================================");
|
||||
// Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
// WriteObject(headerText);
|
||||
// Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
// WriteObject("==============================================================================================");
|
||||
// Console.ForegroundColor = ConsoleColor.Green;
|
||||
// }
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////==================================================================================================
|
||||
// protected Context Context
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return (Context)this.SessionState.PSVariable.GetValue("Context", null);
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// this.SessionState.PSVariable.Set(new PSVariable("Context", value));
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected BaseRepositoryFactory RepositoryFactory
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (_repositoryFactory == null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// _repositoryFactory = (BaseRepositoryFactory)this.SessionState.PSVariable.Get("BaseRepositoryFactory").Value;
|
||||
// }
|
||||
// catch (NullReferenceException ex)
|
||||
// {
|
||||
// throw new PSSecurityException("The Authentication process has failed for this session. Please ensure that proper credentials have been supplied before using any of these cmdlets.");
|
||||
// }
|
||||
// return _repositoryFactory;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return _repositoryFactory;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// protected string ConfigFilePath
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return (string)this.SessionState.PSVariable.Get("ConfigPath").Value;
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + @"OS\CLI.config";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// protected Settings Settings
|
||||
// {
|
||||
// set
|
||||
// {
|
||||
// this.Context.Settings = value;
|
||||
// }
|
||||
// get
|
||||
// {
|
||||
// return this.Context.Settings;
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// #region Methods
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="path"></param>
|
||||
///// <returns></returns>
|
||||
////==================================================================================================
|
||||
// protected string TranslateQuickPickNumber(string path)
|
||||
// {
|
||||
// CommonDriveInfo drive = this.Drive as CommonDriveInfo;
|
||||
// if (drive != null)
|
||||
// {
|
||||
// BaseUIContainer result = null;
|
||||
// int number = 0;
|
||||
|
||||
// if (Int32.TryParse(Path.GetFileName(path), out number))
|
||||
// {
|
||||
// if (path == "\\" + this.Drive.CurrentLocation)
|
||||
// {
|
||||
// return path.Replace(Path.GetFileName(path), drive.CurrentContainer.Entity.Id);
|
||||
// }
|
||||
// //else if (path.Length < this.Drive.CurrentLocation.Length)
|
||||
// //{
|
||||
// // result = drive.CurrentContainer.Parent;
|
||||
// //}
|
||||
// else
|
||||
// {
|
||||
// result = drive.CurrentContainer.Containers.Where(q => q.Entity.QuickPickNumber == number).FirstOrDefault<BaseUIContainer>();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return path;
|
||||
// }
|
||||
|
||||
// if (result != null)
|
||||
// return path.Replace(Path.GetFileName(path), result.Id);
|
||||
// else return null;
|
||||
// }
|
||||
// else return null;
|
||||
// }
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////==================================================================================================
|
||||
// protected override void BeginProcessing()
|
||||
// {
|
||||
// if (this.Drive.Name != "OpenStack" && this.Drive.Provider.Name != "OS-Storage")
|
||||
// {
|
||||
// ErrorRecord err = new ErrorRecord(new InvalidOperationException("You must be attached to an ObjectStorage Container or the OpenStack drive to execute an OpenStack Cloud cmdlet."), "0" , ErrorCategory.InvalidOperation, this);
|
||||
// this.ThrowTerminatingError(err);
|
||||
// }
|
||||
|
||||
// bool isAuthorized = false;
|
||||
// Type type = this.GetType();
|
||||
// object[] metadata = type.GetCustomAttributes(false);
|
||||
// bool foundattribute = false;
|
||||
|
||||
// foreach (object attribute in metadata)
|
||||
// {
|
||||
// RequiredServiceIdentifierAttribute identifier = attribute as RequiredServiceIdentifierAttribute;
|
||||
|
||||
// if (identifier != null)
|
||||
// {
|
||||
// if (this.Context.ServiceCatalog.GetService(identifier.Services) != null)
|
||||
// isAuthorized = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (isAuthorized == false && foundattribute == false) return;
|
||||
|
||||
// if (!isAuthorized)
|
||||
// this.ThrowTerminatingError(new ErrorRecord(new InvalidOperationException("You're not current authorized to use this service. Please go to https://www.Openstack.com/ for more information on signing up for this service."), "aa", ErrorCategory.InvalidOperation, this));
|
||||
// }
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
///// Writes out the files represented as StorageObjects for the supplied path.
|
||||
///// </summary>
|
||||
////==================================================================================================
|
||||
// protected void WriteXML<T>(T graph, string path)
|
||||
// {
|
||||
// XmlTextWriter xtw = null;
|
||||
// MemoryStream stream = new MemoryStream();
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// XmlDocument document = new XmlDocument();
|
||||
// StringWriter writer = null;
|
||||
// XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
|
||||
// try
|
||||
// {
|
||||
// serializer.Serialize(stream, graph);
|
||||
// stream.Position = 0;
|
||||
// document.Load(stream);
|
||||
|
||||
// writer = new StringWriter(builder);
|
||||
// xtw = new XmlTextWriter(writer);
|
||||
// xtw.Formatting = Formatting.Indented;
|
||||
|
||||
// document.WriteTo(xtw);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// xtw.Close();
|
||||
// }
|
||||
// WriteObject(builder.ToString());
|
||||
// WriteObject("");
|
||||
// }
|
||||
// #endregion
|
||||
// #region Methods
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="entity"></param>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// protected bool UserConfirmsDeleteAction(string entity)
|
||||
// {
|
||||
// Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>();
|
||||
// choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
// choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
// if (this.Host.UI.PromptForChoice("Confirm Action", "You are about to delete all " + entity + " in the current container. Are you sure about this?", choices, 0) == 0)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected void UpdateCache(Context context)
|
||||
// {
|
||||
// CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
// if (tempDrive != null)
|
||||
// {
|
||||
// BaseUIContainer container = tempDrive.CurrentContainer as BaseUIContainer;
|
||||
// container.Context = context;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// catch (InvalidOperationException) { }
|
||||
// if (container.Parent != null)
|
||||
// container.Parent.Load();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected void UpdateCache()
|
||||
// {
|
||||
// CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
// if (tempDrive != null)
|
||||
// {
|
||||
// BaseUIContainer container = tempDrive.CurrentContainer as BaseUIContainer;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// catch (InvalidOperationException) { }
|
||||
// if (container.Parent != null)
|
||||
// container.Parent.Load();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// Updates the cache if the current UIContainer manages the supplied type.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected void UpdateCache<T>() where T : BaseUIContainer
|
||||
// {
|
||||
// T container = ((CommonDriveInfo)this.Drive).CurrentContainer as T;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// T parentContainer = ((CommonDriveInfo)this.Drive).CurrentContainer.Parent as T;
|
||||
// if (parentContainer != null)
|
||||
// {
|
||||
// parentContainer.Load();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="path"></param>
|
||||
////=========================================================================================
|
||||
// protected StoragePath CreateStoragePath(string path)
|
||||
// {
|
||||
// return ((OSDriveInfo)this.Drive).CreateStoragePath(path);
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
@ -0,0 +1,97 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet("Attach", "Volume", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.BlockStorage)]
|
||||
public class AttachVolumeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _volumeId;
|
||||
private string _device;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "AttachVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "AttachVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string VolumeId
|
||||
{
|
||||
get { return _volumeId; }
|
||||
set { _volumeId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "AttachVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Device
|
||||
{
|
||||
get { return _device; }
|
||||
set { _device = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
VolumeAttachment attachment = new VolumeAttachment();
|
||||
attachment.Device = this.Device;
|
||||
attachment.VolumeId = this.VolumeId;
|
||||
attachment.ServerId = this.ServerId;
|
||||
|
||||
this.RepositoryFactory.CreateVolumeRepository().AttachVolume(attachment, this.ServerId);
|
||||
this.UpdateCache<AttachmentsUIContainer>();
|
||||
this.UpdateCache<VolumesUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,107 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet("Backup", "Volume", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.BlockStorage)]
|
||||
public class BackupVolumeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private NewVolumeBackup _newBackup = new NewVolumeBackup();
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, ParameterSetName = "BackupVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("c")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Container
|
||||
{
|
||||
get { return _newBackup.Container; }
|
||||
set { _newBackup.Container = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "BackupVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Description
|
||||
{
|
||||
get { return _newBackup.Description; }
|
||||
set { _newBackup.Container = value; }
|
||||
}
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "BackupVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string VolumeId
|
||||
{
|
||||
get { return _newBackup.VolumeId;}
|
||||
set { _newBackup.VolumeId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "BackupVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _newBackup.Name; }
|
||||
set { _newBackup.Name = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewVolumeBackup backup = new NewVolumeBackup();
|
||||
|
||||
backup.VolumeId = this.TranslateQuickPickNumber(_newBackup.VolumeId);
|
||||
|
||||
this.RepositoryFactory.CreateVolumeRepository().SaveVolumeBackup(backup);
|
||||
this.UpdateCache<VolumesUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,78 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet("Detach", "Volume", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.BlockStorage)]
|
||||
public class DetachVolumeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _volumeId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DettachVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DettachVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string VolumeId
|
||||
{
|
||||
get { return _volumeId; }
|
||||
set { _volumeId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.RepositoryFactory.CreateVolumeRepository().DetachVolume(this.VolumeId, this.ServerId);
|
||||
this.UpdateCache<AttachmentsUIContainer>();
|
||||
this.UpdateCache<VolumesUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,132 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using System;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "Snapshot", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.BlockStorage)]
|
||||
public class NewSnapshotCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private SwitchParameter _force = false;
|
||||
private string _description;
|
||||
private string _volumeId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewSnapshot", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewSnapshot", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Description
|
||||
{
|
||||
get { return _description; }
|
||||
set { _description = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewSnapshot", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string VolumeId
|
||||
{
|
||||
get { return _volumeId; }
|
||||
set { _volumeId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 4, ParameterSetName = "NewSnapshot", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("f")]
|
||||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private bool IsVolumeAvailable(string volumeId)
|
||||
{
|
||||
Volume volume = this.RepositoryFactory.CreateVolumeRepository().GetVolume(volumeId);
|
||||
if (volume.Status == "in-use")
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.IsVolumeAvailable(this.VolumeId))
|
||||
{
|
||||
NewSnapshot snapshot = new NewSnapshot();
|
||||
snapshot.Description = this.Description;
|
||||
snapshot.Name = this.Name;
|
||||
snapshot.VolumeId = this.VolumeId;
|
||||
snapshot.Force = this.Force;
|
||||
|
||||
this.RepositoryFactory.CreateSnapshotRepository().SaveSnapshot(snapshot);
|
||||
this.UpdateCache<SnapshotsUIContainer>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("The specified Volume is already in use.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,153 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "Volume", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.BlockStorage)]
|
||||
public class NewVolumeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _size;
|
||||
private string _description;
|
||||
private string[] _metadata;
|
||||
private NewVolume vol = new NewVolume();
|
||||
private string _availabilityZone;
|
||||
private string _sourceVolid;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 4, ParameterSetName = "NewVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("az")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string AvailabilityZone
|
||||
{
|
||||
get { return _availabilityZone; }
|
||||
set { _availabilityZone = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, ParameterSetName = "NewVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("svid")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SourceVolumeId
|
||||
{
|
||||
get { return _sourceVolid; }
|
||||
set { _sourceVolid = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewVolume", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Description
|
||||
{
|
||||
get { return _description; }
|
||||
set { _description = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Size
|
||||
{
|
||||
get { return _size; }
|
||||
set { _size = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, Mandatory = false, ParameterSetName = "NewVolume", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("md")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] MetaData
|
||||
{
|
||||
get { return _metadata; }
|
||||
set { _metadata = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewVolume volume = new NewVolume();
|
||||
volume.Description = this.Description;
|
||||
volume.Name = this.Name;
|
||||
volume.SourceVolid = this.SourceVolumeId;
|
||||
volume.AvailabilityZone = this.AvailabilityZone;
|
||||
|
||||
if (this.SourceVolumeId == null)
|
||||
volume.Size = this.Size;
|
||||
else
|
||||
volume.Size = null;
|
||||
|
||||
|
||||
if (_metadata != null && _metadata.Length > 0)
|
||||
{
|
||||
foreach (string kv in _metadata)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
volume.Metadata.Add(temp[0], temp[1]);
|
||||
}
|
||||
}
|
||||
|
||||
this.RepositoryFactory.CreateVolumeRepository().SaveVolume(volume);
|
||||
this.UpdateCache<VolumesUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Snapshot", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveSnapshotCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _snapshotId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RemoveSnapshot", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "a")]
|
||||
[Alias("s")]
|
||||
public string SnapshotId
|
||||
{
|
||||
get { return _snapshotId; }
|
||||
set { _snapshotId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.UserConfirmsDeleteAction("Snapshots"))
|
||||
{
|
||||
this.RepositoryFactory.CreateSnapshotRepository().DeleteSnapshot(this.SnapshotId);
|
||||
this.UpdateCache<SnapshotsUIContainer>();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
class RemoveVolumeBackupCmdlet
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.Domain.BlockStorage;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.BlockStorage
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Volume", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveVolumeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _volumeId;
|
||||
private SwitchParameter _force = false;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "RemoveVolume2", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RemoveVolume", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "a")]
|
||||
[Alias("v")]
|
||||
public string VolumeId
|
||||
{
|
||||
get { return _volumeId; }
|
||||
set { _volumeId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.VolumeId);
|
||||
|
||||
if (_force == true && this.UserConfirmsDeleteAction("Volumes")) {
|
||||
this.RemoveAllVolumes();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RepositoryFactory.CreateVolumeRepository().DeleteVolume(id);
|
||||
this.UpdateCache<VolumesUIContainer>();
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllVolumes()
|
||||
{
|
||||
List<Volume> volumes = this.RepositoryFactory.CreateVolumeRepository().GetVolumes();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (Volume volume in volumes)
|
||||
{
|
||||
|
||||
Console.WriteLine("Removing Volume : " + volume.Name);
|
||||
this.RepositoryFactory.CreateVolumeRepository().DeleteVolume(volume.Id);
|
||||
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
39
Openstack.Client.Powershell/Cmdlets/Clipboard.cs
Normal file
39
Openstack.Client.Powershell/Cmdlets/Clipboard.cs
Normal file
@ -0,0 +1,39 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets
|
||||
{
|
||||
class OutClipboard
|
||||
{
|
||||
[STAThread]
|
||||
public static void SetText(string text)
|
||||
{
|
||||
TextBox tb = new TextBox();
|
||||
tb.Multiline = true;
|
||||
|
||||
tb.Text = text;
|
||||
tb.SelectAll();
|
||||
tb.Copy();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,268 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Common.Properties;
|
||||
using System.Collections.ObjectModel;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
using Openstack.Objects.Utility;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
public class BaseAuthenticationCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _key;
|
||||
private string _value;
|
||||
private SwitchParameter _reset = false;
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected void InitializeSession(AuthenticationRequest request, Settings settings = null)
|
||||
{
|
||||
Context context = new Context();
|
||||
|
||||
if (request != null)
|
||||
{
|
||||
KeystoneAuthProvider authProvider = new KeystoneAuthProvider();
|
||||
AuthenticationResponse response = authProvider.Authenticate(request);
|
||||
|
||||
context.ServiceCatalog = response.ServiceCatalog;
|
||||
if (settings == null)
|
||||
context.Settings = Settings.Default;
|
||||
else
|
||||
context.Settings = settings;
|
||||
context.AccessToken = response.Token;
|
||||
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Context", context));
|
||||
this.SessionState.PSVariable.Set(new PSVariable("BaseRepositoryFactory", new BaseRepositoryFactory(context)));
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected void InitializeSession(Settings settings)
|
||||
{
|
||||
AuthenticationRequest request = new AuthenticationRequest(new Credentials(settings.Username, settings.Password), settings.DefaultTenantId);
|
||||
this.InitializeSession(request, settings);
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
private System.Collections.ObjectModel.Collection<PSDriveInfo> GetAvailableDrives(Settings settings, ProviderInfo providerInfo, string configFilePath)
|
||||
{
|
||||
List<StorageContainer> storageContainers = null;
|
||||
OSDriveParameters parameters = new OSDriveParameters();
|
||||
|
||||
if (this.Settings != null)
|
||||
{
|
||||
parameters.Settings = this.Settings;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters.Settings = settings;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IContainerRepository storageContainerRepository = this.RepositoryFactory.CreateContainerRepository();
|
||||
storageContainers = storageContainerRepository.GetStorageContainers(configFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
|
||||
Collection<PSDriveInfo> drives = new Collection<PSDriveInfo>();
|
||||
|
||||
// For every storageContainer that the User has access to, create a Drive that he can mount within Powershell..
|
||||
|
||||
try
|
||||
{
|
||||
if (storageContainers.Count > 0)
|
||||
{
|
||||
foreach (StorageContainer storageContainer in storageContainers)
|
||||
{
|
||||
PSDriveInfo driveInfo = new PSDriveInfo(storageContainer.Name, providerInfo, "/", "Root folder for your storageContainer", null);
|
||||
OSDriveInfo kvsDriveInfo = new OSDriveInfo(driveInfo, parameters, this.Context);
|
||||
try
|
||||
{
|
||||
drives.Add(kvsDriveInfo);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PSDriveInfo driveInfo = new PSDriveInfo("OS-Init", this.SessionState.Drive.Current.Provider, "/", "Root folder for your storageContainer", null);
|
||||
return new Collection<PSDriveInfo>
|
||||
{
|
||||
new OSDriveInfo(driveInfo, parameters, this.Context)
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return drives;
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
/// Removes all currently registered drives..
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void RemoveDrives()
|
||||
{
|
||||
// Remove the old Users drives first..
|
||||
|
||||
Collection<PSDriveInfo> deadDrives = this.SessionState.Drive.GetAllForProvider("OS-Storage");
|
||||
foreach (PSDriveInfo deadDrive in deadDrives)
|
||||
{
|
||||
this.SessionState.Drive.Remove(deadDrive.Name, true, "local");
|
||||
}
|
||||
}
|
||||
////=======================================================================================================
|
||||
///// <summary>
|
||||
///// removes only the currently registered shared drives..
|
||||
///// </summary>
|
||||
////=======================================================================================================
|
||||
// private void RemoveSharedDrives()
|
||||
// {
|
||||
// Collection<PSDriveInfo> deadDrives = this.SessionState.Drive.GetAllForProvider("OS-Storage");
|
||||
// foreach (OSDriveInfo deadDrive in deadDrives)
|
||||
// {
|
||||
// if (deadDrive.SharePath != null)
|
||||
// this.SessionState.Drive.Remove(deadDrive.Name, true, "local");
|
||||
// }
|
||||
// }
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected void WriteContainers(string configFilePath)
|
||||
{
|
||||
List<string> invalidDriveNames = new List<string>();
|
||||
OSDriveParameters parameters = new OSDriveParameters();
|
||||
|
||||
// Write out the commands header information first..
|
||||
|
||||
WriteObject("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("===================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject("Object Storage Service available. Remapping to the following drives.");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("===================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
WriteObject(" ");
|
||||
|
||||
HPOSNavigationProvider provider = new HPOSNavigationProvider();
|
||||
Collection<PSDriveInfo> drives = this.GetAvailableDrives(this.Settings, this.SessionState.Provider.GetOne("OS-Storage"), configFilePath);
|
||||
|
||||
if (drives != null)
|
||||
{
|
||||
this.RemoveDrives();
|
||||
|
||||
foreach (PSDriveInfo drive in drives)
|
||||
{
|
||||
if (drive.Name != string.Empty)
|
||||
{
|
||||
WriteObject("Storage Container : [" + drive.Name + "] now available.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.SessionState.Drive.New(drive, "local");
|
||||
}
|
||||
catch (PSArgumentException ex)
|
||||
{
|
||||
if (drive.Name != string.Empty)
|
||||
invalidDriveNames.Add(drive.Name);
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
}
|
||||
WriteObject("");
|
||||
}
|
||||
else
|
||||
{
|
||||
// No storageContainers exist for the new credentials so make some up...
|
||||
|
||||
PSDriveInfo driveInfo = new PSDriveInfo("OS-Init", this.SessionState.Drive.Current.Provider, "/", "Root folder for your storageContainer", null);
|
||||
this.SessionState.Drive.New(new OSDriveInfo(driveInfo, parameters, this.Context), "local");
|
||||
}
|
||||
|
||||
if (invalidDriveNames.Count > 0)
|
||||
{
|
||||
WriteObject("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
WriteObject("Error : A subset of your Containers could not be bound to this");
|
||||
WriteObject("session due to naming conflicts with the naming standards required");
|
||||
WriteObject("for Powershell drives. These containers are listed below.");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
WriteObject(" ");
|
||||
|
||||
foreach (string name in invalidDriveNames)
|
||||
{
|
||||
WriteObject(name);
|
||||
WriteObject(" ");
|
||||
}
|
||||
WriteObject(" ");
|
||||
}
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected void WriteServices()
|
||||
{
|
||||
WriteObject("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject("Binding to new Account. New service catalog is as follows.");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
WriteObject(" ");
|
||||
|
||||
foreach (Service service in this.Context.ServiceCatalog)
|
||||
{
|
||||
WriteObject(service);
|
||||
}
|
||||
WriteObject("");
|
||||
}
|
||||
}
|
||||
}
|
310
Openstack.Client.Powershell/Cmdlets/Common/BasePSCmdlet.cs
Normal file
310
Openstack.Client.Powershell/Cmdlets/Common/BasePSCmdlet.cs
Normal file
@ -0,0 +1,310 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Text;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Utility;
|
||||
using System.IO;
|
||||
using Openstack.Common;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Linq;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Management.Automation.Host;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
public class BasePSCmdlet : PSCmdlet
|
||||
{
|
||||
#region Properties
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
//protected BaseUIContainer CurrentContainer
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
// if (tempDrive != null)
|
||||
// {
|
||||
// return tempDrive.CurrentContainer as BaseUIContainer;
|
||||
// }
|
||||
// else return null;
|
||||
// }
|
||||
//}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// Exposes the currently mapped Drive. Belongs in base class???
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected PSDriveInfo Drive
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.SessionState.Drive.Current;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
//=========================================================================================
|
||||
protected void WriteHeaderSection(string headerText)
|
||||
{
|
||||
WriteObject(" ");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject(headerText);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected IOpenstackClient Client
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IOpenstackClient)this.SessionState.PSVariable.GetValue("Client", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Client", value));
|
||||
}
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected Context Context
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Context)this.SessionState.PSVariable.GetValue("Context", null);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.SessionState.PSVariable.Set(new PSVariable("Context", value));
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
protected string ConfigFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + @"OS\CLI.config";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="path"></param>
|
||||
///// <returns></returns>
|
||||
////==================================================================================================
|
||||
//protected string TranslateQuickPickNumber(string path)
|
||||
//{
|
||||
// CommonDriveInfo drive = this.Drive as CommonDriveInfo;
|
||||
// if (drive != null)
|
||||
// {
|
||||
// BaseUIContainer result = null;
|
||||
// int number = 0;
|
||||
|
||||
// if (Int32.TryParse(Path.GetFileName(path), out number))
|
||||
// {
|
||||
// if (path == "\\" + this.Drive.CurrentLocation)
|
||||
// {
|
||||
// return path.Replace(Path.GetFileName(path), drive.CurrentContainer.Entity.Id);
|
||||
// }
|
||||
// //else if (path.Length < this.Drive.CurrentLocation.Length)
|
||||
// //{
|
||||
// // result = drive.CurrentContainer.Parent;
|
||||
// //}
|
||||
// else
|
||||
// {
|
||||
// result = drive.CurrentContainer.Containers.Where(q => q.Entity.QuickPickNumber == number).FirstOrDefault<BaseUIContainer>();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return path;
|
||||
// }
|
||||
|
||||
// if (result != null)
|
||||
// return path.Replace(Path.GetFileName(path), result.Id);
|
||||
// else return null;
|
||||
// }
|
||||
// else return null;
|
||||
//}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//==================================================================================================
|
||||
protected override void BeginProcessing()
|
||||
{
|
||||
//if (this.Drive.Name != "OpenStack" && this.Drive.Provider.Name != "OS-Storage")
|
||||
//{
|
||||
// ErrorRecord err = new ErrorRecord(new InvalidOperationException("You must be attached to an ObjectStorage Container or the OpenStack drive to execute an OpenStack Cloud cmdlet."), "0", ErrorCategory.InvalidOperation, this);
|
||||
// this.ThrowTerminatingError(err);
|
||||
//}
|
||||
|
||||
//bool isAuthorized = false;
|
||||
//Type type = this.GetType();
|
||||
//object[] metadata = type.GetCustomAttributes(false);
|
||||
//bool foundattribute = false;
|
||||
|
||||
//foreach (object attribute in metadata)
|
||||
//{
|
||||
// RequiredServiceIdentifierAttribute identifier = attribute as RequiredServiceIdentifierAttribute;
|
||||
|
||||
// if (identifier != null)
|
||||
// {
|
||||
// if (this.Context.ServiceCatalog.Exists(identifier.Services) != null)
|
||||
// isAuthorized = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (isAuthorized == false && foundattribute == false) return;
|
||||
|
||||
//if (!isAuthorized)
|
||||
// this.ThrowTerminatingError(new ErrorRecord(new InvalidOperationException("You're not current authorized to use this service. Please go to https://www.Openstack.com/ for more information on signing up for this service."), "aa", ErrorCategory.InvalidOperation, this));
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
protected bool UserConfirmsDeleteAction(string entity)
|
||||
{
|
||||
Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>();
|
||||
choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
if (this.Host.UI.PromptForChoice("Confirm Action", "You are about to delete all " + entity + " in the current container. Are you sure about this?", choices, 0) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected void UpdateCache(Context context)
|
||||
{
|
||||
//CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
//if (tempDrive != null)
|
||||
//{
|
||||
// BaseUIContainer container = tempDrive.CurrentContainer as BaseUIContainer;
|
||||
// container.Context = context;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// catch (InvalidOperationException) { }
|
||||
// if (container.Parent != null)
|
||||
// container.Parent.Load();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected void UpdateCache()
|
||||
{
|
||||
//CommonDriveInfo tempDrive = this.Drive as CommonDriveInfo;
|
||||
//if (tempDrive != null)
|
||||
//{
|
||||
// BaseUIContainer container = tempDrive.CurrentContainer as BaseUIContainer;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// catch (InvalidOperationException) { }
|
||||
// if (container.Parent != null)
|
||||
// container.Parent.Load();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// Updates the cache if the current UIContainer manages the supplied type.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
//protected void UpdateCache<T>() where T : BaseUIContainer
|
||||
//{
|
||||
// T container = ((CommonDriveInfo)this.Drive).CurrentContainer as T;
|
||||
|
||||
// if (container != null)
|
||||
// {
|
||||
// container.Load();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// T parentContainer = ((CommonDriveInfo)this.Drive).CurrentContainer.Parent as T;
|
||||
// if (parentContainer != null)
|
||||
// {
|
||||
// parentContainer.Load();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
//=========================================================================================
|
||||
//protected StoragePath CreateStoragePath(string path)
|
||||
//{
|
||||
// return ((OSDriveInfo)this.Drive).CreateStoragePath(path);
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
61
Openstack.Client.Powershell/Cmdlets/Common/CopyIdCmdlet.cs
Normal file
61
Openstack.Client.Powershell/Cmdlets/Common/CopyIdCmdlet.cs
Normal file
@ -0,0 +1,61 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Collections;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Linq;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Copy, "Id", SupportsShouldProcess = true)]
|
||||
public class CopyIdCmdlet : BasePSCmdlet
|
||||
{
|
||||
private int _quickPickNumber;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "CopyIdCmdlet", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("qp")]
|
||||
public int QuickPickNumber
|
||||
{
|
||||
get { return _quickPickNumber; }
|
||||
set { _quickPickNumber = value; }
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
int number = 0;
|
||||
CommonDriveInfo drive = this.Drive as CommonDriveInfo;
|
||||
BaseUIContainer result = drive.CurrentContainer.Containers.Where(q => q.Entity.QuickPickNumber == _quickPickNumber).FirstOrDefault<BaseUIContainer>();
|
||||
|
||||
WriteObject("");
|
||||
this.WriteObject("Id " + result.Entity.Id + " copied to clipboard.");
|
||||
WriteObject("");
|
||||
OutClipboard.SetText(result.Entity.Id);
|
||||
}
|
||||
}
|
||||
}
|
152
Openstack.Client.Powershell/Cmdlets/Common/GetCatalogCmdlet.cs
Normal file
152
Openstack.Client.Powershell/Cmdlets/Common/GetCatalogCmdlet.cs
Normal file
@ -0,0 +1,152 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Collections;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Catalog", SupportsShouldProcess = true)]
|
||||
public class GetCatalogCmdlet : BasePSCmdlet
|
||||
{
|
||||
private SwitchParameter _verbose = false;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
//[Parameter(Mandatory = false, ParameterSetName = "gc0", ValueFromPipelineByPropertyName = true, HelpMessage = "Prints information for the current service in use.")]
|
||||
//[Alias("cs")]
|
||||
//[ValidateNotNullOrEmpty]
|
||||
//public SwitchParameter CurrentService
|
||||
//{
|
||||
// get { return _currentService; }
|
||||
// set { _currentService = value; }
|
||||
//}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Mandatory = false, ParameterSetName = "gc0", ValueFromPipelineByPropertyName = true, HelpMessage = "Prints extended information for each service.")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter Verbose2
|
||||
{
|
||||
get { return _verbose; }
|
||||
set { _verbose = value; }
|
||||
}
|
||||
#endregion
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
//=========================================================================================
|
||||
private void WriteSection(string headerText)
|
||||
{
|
||||
WriteObject(" ");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject(headerText);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="endpoint"></param>
|
||||
//=======================================================================================================
|
||||
private void PrintEndpoint(Endpoint endpoint)
|
||||
{
|
||||
Console.WriteLine("Region : " + endpoint.Region);
|
||||
Console.WriteLine("Public URL : " + endpoint.PublicURL);
|
||||
Console.WriteLine("Internal URL : " + endpoint.InternalURL);
|
||||
Console.WriteLine("Admin URL : " + endpoint.AdminURL);
|
||||
Console.WriteLine("Version : " + endpoint.Version.Id);
|
||||
Console.WriteLine("Version Info : " + endpoint.Version.InfoURL);
|
||||
Console.WriteLine("Version List : " + endpoint.Version.ListURL);
|
||||
Console.WriteLine();
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="service"></param>
|
||||
//=======================================================================================================
|
||||
private void PrintServiceVerbose(Service service)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
this.WriteSection ("Service : " + service.Name);
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("General");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("Name : " + service.Name);
|
||||
Console.WriteLine("Type : " + service.Type);
|
||||
// Console.WriteLine("Provider Name : " + service.ProviderName);
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Associated Endpoints");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
|
||||
foreach (Endpoint endpoint in service.Endpoints)
|
||||
{
|
||||
this.PrintEndpoint(endpoint);
|
||||
}
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void PrintServiceCatalog()
|
||||
{
|
||||
WriteObject("");
|
||||
this.WriteSection("You have access to the following Services ");
|
||||
WriteObject("");
|
||||
|
||||
foreach (Service service in this.Context.ServiceCatalog)
|
||||
{
|
||||
if (!_verbose)
|
||||
WriteObject(service);
|
||||
else
|
||||
PrintServiceVerbose(service);
|
||||
}
|
||||
WriteObject("");
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.PrintServiceCatalog();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Collections;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Config", SupportsShouldProcess = true)]
|
||||
public class GetConfigCmdlet : BasePSCmdlet
|
||||
{
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
//=========================================================================================
|
||||
private void WriteSection(string headerText)
|
||||
{
|
||||
WriteObject(" ");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject(headerText);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
|
||||
WriteObject("");
|
||||
this.WriteSection("Current Session Settings are as follows. ");
|
||||
WriteObject("");
|
||||
this.WriteObject("Configuration File located at " + configFilePath);
|
||||
WriteObject("");
|
||||
|
||||
foreach (DictionaryEntry setting in this.Settings)
|
||||
{
|
||||
if (((string)setting.Key) == "SecretKey" || ((string)setting.Key)== "AccessKey")
|
||||
{
|
||||
DictionaryEntry entry = new DictionaryEntry();
|
||||
entry.Value = "***********";
|
||||
entry.Key = setting.Key;
|
||||
WriteObject(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteObject(setting);
|
||||
}
|
||||
}
|
||||
WriteObject("");
|
||||
}
|
||||
}
|
||||
}
|
210
Openstack.Client.Powershell/Cmdlets/Common/GetMetadataCmdlet.cs
Normal file
210
Openstack.Client.Powershell/Cmdlets/Common/GetMetadataCmdlet.cs
Normal file
@ -0,0 +1,210 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Storage.CDN
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Metadata", SupportsShouldProcess = true)]
|
||||
public class GetNMetadataCmdlet2 : BasePSCmdlet
|
||||
{
|
||||
private string _cdnContainerName;
|
||||
private string _sourcePath;
|
||||
private string _objectStorageContainerName;
|
||||
private string _serverId;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "serverMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "containerMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("cn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ObjectStorageContainerName
|
||||
{
|
||||
get { return _objectStorageContainerName; }
|
||||
set { _objectStorageContainerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0 , ParameterSetName = "objectMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("sp")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SourcePath
|
||||
{
|
||||
get { return _sourcePath; }
|
||||
set { _sourcePath = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Mandatory = false, ParameterSetName = "cdnMetadata", ValueFromPipelineByPropertyName = true, HelpMessage = "The Name of the Container to enable for CDN access.")]
|
||||
[Alias("cdn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string CDNContainerName
|
||||
{
|
||||
get { return _cdnContainerName; }
|
||||
set { _cdnContainerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
//=========================================================================================
|
||||
private void WriteSection(string headerText)
|
||||
{
|
||||
WriteObject(" ");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject(headerText);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="kvps"></param>
|
||||
//=========================================================================================
|
||||
private void WriteKVPs(List<KeyValuePair<string, string>> kvps, string displayName)
|
||||
{
|
||||
if (kvps.Count > 0)
|
||||
{
|
||||
WriteObject("");
|
||||
this.WriteSection("Meta-Data for " + displayName + " is as follows.");
|
||||
WriteObject("");
|
||||
foreach (KeyValuePair<string, string> kvp in kvps)
|
||||
{
|
||||
WriteObject("Key = " + kvp.Key.Replace("X-", string.Empty));
|
||||
WriteObject("Value = " + Convert.ToString(kvp.Value));
|
||||
WriteObject("---------------------------------");
|
||||
}
|
||||
WriteObject("");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteObject("");
|
||||
Console.WriteLine("No meta-data found for the supplied resource name.");
|
||||
WriteObject("");
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessCDNMetadata()
|
||||
{
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist(Services.CDN) == false) {
|
||||
Console.WriteLine("You don't have access to CDN services under this account. For information on signing up for CDN access please go to http://Openstack.com/.");
|
||||
}
|
||||
WriteKVPs(RepositoryFactory.CreateCDNRepository().GetMetaData(this.CDNContainerName), this.CDNContainerName);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessObjectMetadata()
|
||||
{
|
||||
if (this.Drive.Provider.Name != "OS-Storage")
|
||||
Console.WriteLine("You must be using the Object Storage Provider to use this cmdlet with the supplied parameters. To use this provider mount to a ObjectStorage container first. To see a list of available Containers issue the Get-PSDrive command.");
|
||||
else
|
||||
WriteKVPs(RepositoryFactory.CreateStorageObjectRepository().GetMetaData(this.CreateStoragePath(this.SourcePath).AbsoluteURI), this.SourcePath);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessContainerMetadata()
|
||||
{
|
||||
if (this.Drive.Provider.Name != "OS-Storage")
|
||||
Console.WriteLine("You must be using the Object Storage Provider to use this cmdlet with the supplied parameters. To use this provider mount to a ObjectStorage container first. To see a list of available Containers issue the Get-PSDrive command.");
|
||||
else
|
||||
WriteKVPs(RepositoryFactory.CreateContainerRepository().GetMetaData(_objectStorageContainerName), _objectStorageContainerName);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessServerMetadata()
|
||||
{
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist(Services.Compute) == false)
|
||||
Console.WriteLine("You don't have access to Compute services under this account. For information on signing up for this please go to http://Openstack.com/.");
|
||||
else
|
||||
{
|
||||
Server server = RepositoryFactory.CreateServerRepository().GetServer(this.ServerId);
|
||||
//WriteKVPs(server.MetaData.ToKeypairs(), server.Name);
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The main driver..
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
switch (this.ParameterSetName)
|
||||
{
|
||||
case ("serverMetadata"):
|
||||
this.ProcessServerMetadata();
|
||||
break;
|
||||
|
||||
case ("containerMetadata"):
|
||||
this.ProcessContainerMetadata();
|
||||
break;
|
||||
|
||||
case ("cdnMetadata"):
|
||||
|
||||
this.ProcessCDNMetadata();
|
||||
break;
|
||||
|
||||
case ("objectMetadata"):
|
||||
this.ProcessObjectMetadata();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
148
Openstack.Client.Powershell/Cmdlets/Common/GetNotesCmdlet.cs
Normal file
148
Openstack.Client.Powershell/Cmdlets/Common/GetNotesCmdlet.cs
Normal file
@ -0,0 +1,148 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Notes", SupportsShouldProcess = true)]
|
||||
public class GetNotesCmdlet : BasePSCmdlet
|
||||
{
|
||||
private bool _showAllNotes = false;
|
||||
private string _version;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "sn", ValueFromPipelineByPropertyName = true, HelpMessage = "Show all release notes for this product.")]
|
||||
[Alias("all")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter ShowAllNotes
|
||||
{
|
||||
get { return _showAllNotes; }
|
||||
set { _showAllNotes = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "sn", Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Show release notes for a specific version of the CLI.")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Version
|
||||
{
|
||||
get { return _version; }
|
||||
set { _version = value; }
|
||||
}
|
||||
#endregion
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="releaseNode"></param>
|
||||
//=======================================================================================================
|
||||
private void PrintRelease (XElement releaseNode)
|
||||
{
|
||||
Console.WriteLine("-------------------------------------------------------- ");
|
||||
Console.WriteLine("Version : " + releaseNode.Attribute(XName.Get("version")).Value);
|
||||
Console.WriteLine("Notes :");
|
||||
|
||||
XElement notes = (from xml2 in releaseNode.Descendants()
|
||||
select xml2).FirstOrDefault();
|
||||
Console.WriteLine(notes.Value);
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
public void PrintVersionNotes(XDocument releaseNotes)
|
||||
{
|
||||
string currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
XElement releaseNode = (from xml2 in releaseNotes.Descendants("Release")
|
||||
where xml2.Attribute(XName.Get("version")).Value == _version
|
||||
select xml2).FirstOrDefault();
|
||||
|
||||
this.PrintRelease(releaseNode);
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void PrintAllNotes(XDocument releaseNotes)
|
||||
{
|
||||
Console.WriteLine(" ");
|
||||
foreach (XElement element in releaseNotes.Descendants("Release"))
|
||||
{
|
||||
this.PrintRelease(element);
|
||||
}
|
||||
Console.WriteLine(" ");
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void PrintCurrentRelease(XDocument releaseNotes)
|
||||
{
|
||||
string currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
//XElement releaseNode = (from xml2 in releaseNotes.Descendants("Release")
|
||||
// where xml2.Attribute(XName.Get("version")).Value == currentVersion
|
||||
// select xml2).FirstOrDefault();
|
||||
|
||||
XElement notes = releaseNotes.XPathSelectElement("//Release[@version='" + currentVersion + "']");
|
||||
if (notes != null)
|
||||
this.PrintRelease(notes);
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("No release notes exist for the current version.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
XDocument releaseNotes = XDocument.Load(this.Settings.ReleaseNotesURI);
|
||||
|
||||
if (_version == null && _showAllNotes == false)
|
||||
{
|
||||
this.PrintCurrentRelease(releaseNotes);
|
||||
}
|
||||
else if (_showAllNotes)
|
||||
{
|
||||
this.PrintAllNotes(releaseNotes);
|
||||
}
|
||||
else if (_version != null)
|
||||
{
|
||||
this.PrintVersionNotes(releaseNotes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
///* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Openstack;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Client.Powershell.Utility;
|
||||
using System.Linq;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "SP", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class GetServiceProvidersCmdlet : BasePSCmdlet
|
||||
{
|
||||
#region Parameters
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
List<ServiceProvider> serviceProviders = new List<ServiceProvider>();
|
||||
XDocument doc = XDocument.Load(this.ConfigFilePath);
|
||||
IEnumerable<XElement> serviceProviderNodes = doc.Descendants("ServiceProvider");
|
||||
|
||||
foreach (XElement element in serviceProviderNodes)
|
||||
{
|
||||
ServiceProvider provider = new ServiceProvider();
|
||||
provider.AuthenticationServiceURI = element.Elements().Where(e => e.Attribute("key").Value == "AuthenticationServiceURI").Attributes("value").Single().Value;
|
||||
provider.DefaultTenantId = element.Elements().Where(e => e.Attribute("key").Value == "DefaultTenantId").Attributes("value").Single().Value;
|
||||
provider.Username = element.Elements().Where(e => e.Attribute("key").Value == "Username").Attributes("value").Single().Value;
|
||||
provider.IsDefault = Convert.ToBoolean(element.Attribute("isDefault").Value);
|
||||
provider.Name = element.Attribute("name").Value;
|
||||
|
||||
serviceProviders.Add(provider);
|
||||
}
|
||||
this.WriteObject(serviceProviders);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Reflection;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.GroupManagement
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Version", SupportsShouldProcess = true)]
|
||||
public class GetVersionCmdlet : BasePSCmdlet
|
||||
{
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
Console.WriteLine(" ");
|
||||
Console.WriteLine("Assembly Location : " + Assembly.GetExecutingAssembly().Location);
|
||||
Console.WriteLine("Product Version : " + Assembly.GetExecutingAssembly().GetName().Version);
|
||||
Console.WriteLine("CLR Version : " + Assembly.GetExecutingAssembly().ImageRuntimeVersion);
|
||||
Console.WriteLine(" ");
|
||||
}
|
||||
}
|
||||
}
|
46
Openstack.Client.Powershell/Cmdlets/Common/GetZoneCmdlet.cs
Normal file
46
Openstack.Client.Powershell/Cmdlets/Common/GetZoneCmdlet.cs
Normal file
@ -0,0 +1,46 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Management.Automation;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet("Get", "Zone", SupportsShouldProcess = true)]
|
||||
public class GetZoneCmdlet : BasePSCmdlet
|
||||
{
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement defaultZoneNode = doc.XPathSelectElement("//AvailabilityZone[@isDefault='True']");
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Current Availability Zone is " + defaultZoneNode.Attribute("name").Value);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
115
Openstack.Client.Powershell/Cmdlets/Common/GetZonesCmdlet.cs
Normal file
115
Openstack.Client.Powershell/Cmdlets/Common/GetZonesCmdlet.cs
Normal file
@ -0,0 +1,115 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Management.Automation;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet("Get", "Zones", SupportsShouldProcess = true)]
|
||||
public class GetZonesCmdlet : BasePSCmdlet
|
||||
{
|
||||
private SwitchParameter _verbose = false;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Mandatory = false, ParameterSetName = "gc0", ValueFromPipelineByPropertyName = true, HelpMessage = "Prints extended information for each service.")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter Verbose2
|
||||
{
|
||||
get { return _verbose; }
|
||||
set { _verbose = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ShowVerboseOutput(IEnumerable<XElement> zoneKeyNode)
|
||||
{
|
||||
foreach (XElement element in zoneKeyNode)
|
||||
{
|
||||
this.WriteHeaderSection("Zone : " + element.Attribute("name").Value);
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
Console.WriteLine("Zone Id : " + element.Attribute("id").Value);
|
||||
Console.WriteLine("Zone Name : " + element.Attribute("name").Value);
|
||||
Console.WriteLine("Shell Foreground Color : " + element.Attribute("shellForegroundColor").Value);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("The following Services are available from this Availability Zone");
|
||||
Console.WriteLine("----------------------------------------------------------------");
|
||||
this.WriteObject(this.Context.ServiceCatalog.GetAZServices(element.Attribute("name").Value));
|
||||
Console.WriteLine("");
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ShowNonVerboseOutput(IEnumerable<XElement> zoneKeyNode)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Current Availability Zones include ");
|
||||
Console.WriteLine("");
|
||||
foreach (XElement element in zoneKeyNode)
|
||||
{
|
||||
Zone zone = new Zone();
|
||||
zone.Name = element.Attribute("name").Value;
|
||||
zone.ShellForegroundColor = element.Attribute("shellForegroundColor").Value;
|
||||
zone.Id = element.Attribute("id").Value;
|
||||
|
||||
if (element.Attribute("isDefault").Value == "True")
|
||||
zone.IsDefault = true;
|
||||
else
|
||||
zone.IsDefault = false;
|
||||
|
||||
this.WriteObject(zone);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath; ;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
IEnumerable<XElement> zoneKeyNode = doc.Descendants("AvailabilityZone");
|
||||
|
||||
if (_verbose)
|
||||
{
|
||||
this.ShowVerboseOutput(zoneKeyNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowNonVerboseOutput(zoneKeyNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
131
Openstack.Client.Powershell/Cmdlets/Common/NewServiceProvider.cs
Normal file
131
Openstack.Client.Powershell/Cmdlets/Common/NewServiceProvider.cs
Normal file
@ -0,0 +1,131 @@
|
||||
//* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//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.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Client.Powershell.Utility;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "SP", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class NewServiceProvidersCmdlet : BasePSCmdlet
|
||||
{
|
||||
|
||||
private string _name = "HP21";
|
||||
private bool _isDefault = false;
|
||||
private string _authenticationServiceURI = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens";
|
||||
private string _username = "travis.plummer@hp.com";
|
||||
private string _password = "NoRemorseGlock27";
|
||||
private string _defTenantId = "travis.plummer@hp.com";
|
||||
|
||||
#region Parameters
|
||||
|
||||
[Parameter(Position = 0, ParameterSetName = "NewSP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
[Parameter(Position = 1, ParameterSetName = "NewSP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("url")]
|
||||
public string AuthenticationServiceURI
|
||||
{
|
||||
get { return _authenticationServiceURI; }
|
||||
set { _authenticationServiceURI = value; }
|
||||
}
|
||||
[Parameter(Position = 2, ParameterSetName = "NewSP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("un")]
|
||||
public string Username
|
||||
{
|
||||
get { return _username; }
|
||||
set { _username = value; }
|
||||
}
|
||||
[Parameter(Position = 3, ParameterSetName = "NewSP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("p")]
|
||||
public string Password
|
||||
{
|
||||
get { return _password; }
|
||||
set { _password = value; }
|
||||
}
|
||||
[Parameter(Position = 4, ParameterSetName = "NewSP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("t")]
|
||||
public string DefTenantId
|
||||
{
|
||||
get { return _defTenantId; }
|
||||
set { _defTenantId = value; }
|
||||
}
|
||||
[Parameter(Position = 4, ParameterSetName = "NewSP", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter IsDefault
|
||||
{
|
||||
get { return _isDefault; }
|
||||
set { _isDefault = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
//=========================================================================================
|
||||
private XElement CreateAddElement(string name, string value)
|
||||
{
|
||||
XElement element = new XElement("add");
|
||||
element.SetAttributeValue("key", name);
|
||||
element.SetAttributeValue("value", value);
|
||||
return element;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string isDef = "False";
|
||||
if (IsDefault) {
|
||||
isDef = "True";
|
||||
}
|
||||
else {
|
||||
isDef = "False";
|
||||
}
|
||||
|
||||
List<ServiceProvider> serviceProviders = new List<ServiceProvider>();
|
||||
XDocument doc = XDocument.Load(this.ConfigFilePath);
|
||||
XElement element = new XElement("ServiceProvider", new XAttribute("name", this.Name), new XAttribute("isDefault", isDef));
|
||||
|
||||
element.Add(this.CreateAddElement("AuthenticationServiceURI", this.AuthenticationServiceURI));
|
||||
element.Add(this.CreateAddElement("Username", this.Username));
|
||||
element.Add(this.CreateAddElement("Password", this.Password));
|
||||
element.Add(this.CreateAddElement("DefaultTenantId", this.DefTenantId));
|
||||
|
||||
doc.XPathSelectElement("configuration/appSettings/IdentityServices").Add(element);
|
||||
doc.Save(this.ConfigFilePath);
|
||||
this.WriteObject("");
|
||||
this.WriteObject("New Serviced Provider " + this.Name + " created!");
|
||||
this.WriteObject("");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet("Refresh", "Cache", SupportsShouldProcess = true)]
|
||||
public class RefreshCacheCmdlet : BasePSCmdlet
|
||||
{
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.UpdateCache();
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Shell Cache Reloaded successfully.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
197
Openstack.Client.Powershell/Cmdlets/Common/SetConfigCmdlet.cs
Normal file
197
Openstack.Client.Powershell/Cmdlets/Common/SetConfigCmdlet.cs
Normal file
@ -0,0 +1,197 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Automation;
|
||||
using System.Xml.Linq;
|
||||
using Openstack.Common.Properties;
|
||||
using Openstack.Objects.Domain;
|
||||
using System.Xml.XPath;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Utility;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Set, "Config", SupportsShouldProcess = true)]
|
||||
public class SetConfigCmdlet : BaseAuthenticationCmdlet
|
||||
{
|
||||
private string _key;
|
||||
private string _value;
|
||||
private string _configFilePath = null;
|
||||
private SwitchParameter _reset = false;
|
||||
private string _oldAccessKey;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "sc3", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("resetcfg")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter Reset
|
||||
{
|
||||
get { return _reset; }
|
||||
set { _reset = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "sc4", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ConfigFilePathKey
|
||||
{
|
||||
get { return _configFilePath; }
|
||||
set { _configFilePath = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "sc", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("k")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Key
|
||||
{
|
||||
get { return _key; }
|
||||
set { _key = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, Mandatory = true, ParameterSetName = "sc", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("v")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set { _value = value; }
|
||||
}
|
||||
#endregion
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void LoadConfigFile()
|
||||
{
|
||||
this.InitializeSession(Settings.Default);
|
||||
|
||||
// Show the User the new ServiceCatalog that we just received..
|
||||
|
||||
this.WriteServices();
|
||||
|
||||
// If ObjectStorage is among those new Services, show the new Container set bound to those credentials..
|
||||
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist("OS-Storage"))
|
||||
{
|
||||
this.WriteContainers(_configFilePath);
|
||||
}
|
||||
}
|
||||
//======================================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
//======================================================================================================================
|
||||
private string GetContainerName(string url)
|
||||
{
|
||||
string[] elements = url.Split('/');
|
||||
return elements[elements.Length - 1];
|
||||
}
|
||||
//======================================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
//======================================================================================================================
|
||||
private string GetDNSPortion(string url)
|
||||
{
|
||||
string[] elements = url.Split('/');
|
||||
return elements[2];
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void LoadConfigFile(string configFilePath)
|
||||
{
|
||||
this.Settings = Settings.LoadConfig(configFilePath);
|
||||
this.Context.Settings = this.Settings;
|
||||
this.Context = this.Context;
|
||||
|
||||
// We need to ensure that the Users new identity doesn't alter the list bof available storageContainers. If so, just deal with it..
|
||||
|
||||
if (_oldAccessKey != this.Settings.Username)
|
||||
{
|
||||
this.InitializeSession(this.Settings);
|
||||
|
||||
// Show the User the new ServiceCatalog that we just received..
|
||||
|
||||
this.WriteServices();
|
||||
|
||||
// If ObjectStorage is among those new Services, show the new Container set bound to those credentials..
|
||||
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist("OS-Storage"))
|
||||
{
|
||||
this.WriteContainers(_configFilePath);
|
||||
}
|
||||
|
||||
if (this.Drive.Name == "OpenStack")
|
||||
{
|
||||
this.SessionState.InvokeCommand.InvokeScript(@"cd\");
|
||||
((CommonDriveInfo)this.Drive).CurrentContainer.Load();
|
||||
}
|
||||
|
||||
this.SessionState.PSVariable.Set(new PSVariable("ConfigPath", configFilePath));
|
||||
|
||||
//Context tempContext = (Context)this.SessionState.PSVariable.GetValue("Context", null);
|
||||
//this.UpdateCache(tempContext);
|
||||
}
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (_reset)
|
||||
{
|
||||
_configFilePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + @"OS\CLI.config";
|
||||
this.LoadConfigFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_configFilePath != null)
|
||||
this.LoadConfigFile(_configFilePath);
|
||||
else
|
||||
this.Settings[_key] = _value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Set, "Credentials", SupportsShouldProcess = true)]
|
||||
public class SetCredentialsCmdlet : BaseAuthenticationCmdlet
|
||||
{
|
||||
private string _accessKey;
|
||||
private string _secretKey;
|
||||
private string _tenantId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, Mandatory = true, ParameterSetName = "sc5", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("ak")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string AccessKey
|
||||
{
|
||||
get { return _accessKey; }
|
||||
set { _accessKey = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "sc5", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("sk")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SecretKey
|
||||
{
|
||||
get { return _secretKey; }
|
||||
set { _secretKey = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, Mandatory = true, ParameterSetName = "sc5", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("t")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string TenantId
|
||||
{
|
||||
get { return _tenantId; }
|
||||
set { _tenantId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
AuthenticationRequest request = new AuthenticationRequest(new Credentials(_accessKey, _secretKey), _tenantId);
|
||||
this.InitializeSession(request);
|
||||
|
||||
// Show the User the new ServiceCatalog that we just received..
|
||||
|
||||
this.WriteServices();
|
||||
|
||||
// If ObjectStorage is among those new Services, show the new Container set bound to those credentials..
|
||||
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist("OS-Storage"))
|
||||
{
|
||||
//this.WriteContainers();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
302
Openstack.Client.Powershell/Cmdlets/Common/SetMetadataCmdlet.cs
Normal file
302
Openstack.Client.Powershell/Cmdlets/Common/SetMetadataCmdlet.cs
Normal file
@ -0,0 +1,302 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using Openstack.Objects.Domain.Admin;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using System.Collections;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Storage.CDN
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Set, "Metadata", SupportsShouldProcess = true)]
|
||||
public class SetMetadataCmdlet2 : BasePSCmdlet
|
||||
{
|
||||
private string _cdnContainerName;
|
||||
private string _sourcePath;
|
||||
private string _objectStorageContainerName;
|
||||
private string _serverId;
|
||||
private string[] _extendedProperties;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter( ParameterSetName = "containerMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("c")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ObjectStorageContainerName
|
||||
{
|
||||
get { return _objectStorageContainerName; }
|
||||
set { _objectStorageContainerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("md")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] ExtendedProperties
|
||||
{
|
||||
get { return _extendedProperties; }
|
||||
set { _extendedProperties = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "serverMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "objectMetadata", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("sp")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SourcePath
|
||||
{
|
||||
get { return _sourcePath; }
|
||||
set { _sourcePath = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Mandatory = false, ParameterSetName = "cdnMetadata", ValueFromPipelineByPropertyName = true, HelpMessage = "The Name of the Container to enable for CDN access.")]
|
||||
[Alias("cdn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string CDNContainerName
|
||||
{
|
||||
get { return _cdnContainerName; }
|
||||
set { _cdnContainerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessCDNMetadata()
|
||||
{
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist(Services.CDN) == false)
|
||||
Console.WriteLine("You don't have access to CDN services under this account. For information on signing up for CDN access please go to http://Openstack.com/.");
|
||||
else
|
||||
{
|
||||
List<KeyValuePair<string, string>> metadata = new List<KeyValuePair<string, string>>();
|
||||
if (this.ExtendedProperties != null && this.ExtendedProperties.Count() > 0)
|
||||
{
|
||||
foreach (string kv in this.ExtendedProperties)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
KeyValuePair<string, string> element = new KeyValuePair<string, string>(temp[0], temp[1]);
|
||||
|
||||
metadata.Add(element);
|
||||
}
|
||||
this.RepositoryFactory.CreateCDNRepository().SetMetaData(this.CDNContainerName, metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessObjectMetadata()
|
||||
{
|
||||
IStorageObjectRepository repository = this.RepositoryFactory.CreateStorageObjectRepository();
|
||||
StoragePath storagePath = this.CreateStoragePath(_sourcePath);
|
||||
StorageObject storageObject = new StorageObject();
|
||||
storageObject.FileName = storagePath.FileName;
|
||||
|
||||
storageObject.ExtendedProperties.AddEntries(this.ExtendedProperties);
|
||||
repository.SetMetaData(storagePath.AbsoluteURI, storageObject.ExtendedProperties);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
//=========================================================================================
|
||||
private void AddElements(MetaData metadata)
|
||||
{
|
||||
IList elements = ((CommonDriveInfo)this.Drive).CurrentContainer.Entities;
|
||||
|
||||
foreach (KeyValuePair<string, string> element in metadata)
|
||||
{
|
||||
MetaDataElement newElement = new MetaDataElement();
|
||||
newElement.Key = element.Key;
|
||||
newElement.Value = element.Value;
|
||||
|
||||
elements.Add(newElement);
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
public MetaData ReformatMetadata(string[] keyValuePairs)
|
||||
{
|
||||
MetaData metadata = new MetaData();
|
||||
|
||||
if (keyValuePairs != null && keyValuePairs.Count() > 0)
|
||||
{
|
||||
foreach (string kv in keyValuePairs)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
MetaDataElement element = new MetaDataElement();
|
||||
element.Key = temp[0];
|
||||
element.Value = temp[1];
|
||||
|
||||
metadata.Add(temp[0], temp[1]);
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ProcessServerMetadata()
|
||||
{
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist(Services.Compute) == false)
|
||||
Console.WriteLine("You don't have access to Compute services under this account. For information on signing up for this please go to http://Openstack.com/.");
|
||||
else
|
||||
{
|
||||
MetaData md = null;
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
md = this.ReformatMetadata(this.ExtendedProperties);
|
||||
this.RepositoryFactory.CreateServerRepository().SetMetadata(md, this.ServerId);
|
||||
this.UpdateCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
|
||||
if (serverContainer != null)
|
||||
{
|
||||
md = this.ReformatMetadata(this.ExtendedProperties);
|
||||
this.RepositoryFactory.CreateServerRepository().SetMetadata(md, serverContainer.Entity.Id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
md = this.ReformatMetadata(this.ExtendedProperties);
|
||||
this.RepositoryFactory.CreateServerRepository().SetMetadata(md, currentContainer.Entity.Id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
private void ProcessContainerMetadata()
|
||||
{
|
||||
if (this.Context.ServiceCatalog.DoesServiceExist(Services.ObjectStorage) == false)
|
||||
Console.WriteLine("You don't have access to Object Storage services under this account. For information on signing up for this please go to http://Openstack.com/.");
|
||||
else
|
||||
{
|
||||
MetaData md = null;
|
||||
if (this.ObjectStorageContainerName != null)
|
||||
{
|
||||
List<KeyValuePair<string, string>> exProps = new List<KeyValuePair<string, string>>();
|
||||
if (this.ExtendedProperties != null && this.ExtendedProperties.Count() > 0)
|
||||
{
|
||||
foreach (string kv in this.ExtendedProperties)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
exProps.AddEntry(temp[0], temp[1]);
|
||||
}
|
||||
}
|
||||
|
||||
md = this.ReformatMetadata(this.ExtendedProperties);
|
||||
this.RepositoryFactory.CreateContainerRepository().SetMetaData(_objectStorageContainerName, exProps);
|
||||
this.UpdateCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The main driver..
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
switch (this.ParameterSetName)
|
||||
{
|
||||
case ("serverMetadata"):
|
||||
this.ProcessServerMetadata();
|
||||
break;
|
||||
|
||||
case ("cdnMetadata"):
|
||||
|
||||
this.ProcessCDNMetadata();
|
||||
break;
|
||||
|
||||
case ("objectMetadata"):
|
||||
this.ProcessObjectMetadata();
|
||||
break;
|
||||
|
||||
case ("containerMetadata"):
|
||||
this.ProcessContainerMetadata();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
262
Openstack.Client.Powershell/Cmdlets/Common/SetZoneCmdlet.cs
Normal file
262
Openstack.Client.Powershell/Cmdlets/Common/SetZoneCmdlet.cs
Normal file
@ -0,0 +1,262 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Management.Automation;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Collections.ObjectModel;
|
||||
using Openstack.Common.Properties;
|
||||
using Openstack.Objects.DataAccess;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet("Set", "Zone", SupportsShouldProcess = true)]
|
||||
public class SetZoneCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _Zone;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "SetZone", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("z")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateSet("1", "2", "3", "4", "5")]
|
||||
public string Zone
|
||||
{
|
||||
get { return _Zone; }
|
||||
set { _Zone = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.Drive.Provider.Name != "OS-Cloud" && this.Drive.Provider.Name != "OS-Storage")
|
||||
{
|
||||
ConsoleColor oldColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Setting the Availability Zone requires you to be connected to the OpenStack: drive or a valid Storage Container. Please map to one of these drive types and reissue the command.");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = oldColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement zoneKeyNode = doc.XPathSelectElement("//AvailabilityZone[@id='" + _Zone + "']");
|
||||
XElement defaultZoneNode = doc.XPathSelectElement("//AvailabilityZone[@isDefault='True']");
|
||||
|
||||
defaultZoneNode.SetAttributeValue("isDefault", "False");
|
||||
zoneKeyNode.SetAttributeValue("isDefault", "True");
|
||||
doc.Save(configFilePath);
|
||||
this.Settings.Load(configFilePath);
|
||||
|
||||
this.Context.Forecolor = zoneKeyNode.Attribute("shellForegroundColor").Value;
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), zoneKeyNode.Attribute("shellForegroundColor").Value);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("New Availability Zone " + zoneKeyNode.Attribute("name").Value + " selected.");
|
||||
Console.WriteLine("");
|
||||
|
||||
|
||||
if (this.Drive.Name == "OpenStack")
|
||||
this.SessionState.InvokeCommand.InvokeScript(@"cd\");
|
||||
else
|
||||
this.SessionState.InvokeCommand.InvokeScript("cd c:");
|
||||
|
||||
|
||||
this.UpdateCache();
|
||||
this.WriteServices(zoneKeyNode.Attribute("name").Value);
|
||||
this.WriteContainers();
|
||||
}
|
||||
}
|
||||
//=======================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=======================================================================================================
|
||||
private void WriteServices(string availabilityZone)
|
||||
{
|
||||
this.WriteHeader("This Availability Zone has the following services available.");
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
WriteObject(this.Context.ServiceCatalog.GetAZServices(availabilityZone));
|
||||
}
|
||||
//==================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//==================================================================================================
|
||||
private System.Collections.ObjectModel.Collection<PSDriveInfo> GetAvailableDrives(Settings settings, ProviderInfo providerInfo)
|
||||
{
|
||||
List<StorageContainer> storageContainers = null;
|
||||
OSDriveParameters parameters = new OSDriveParameters();
|
||||
|
||||
if (this.Settings != null)
|
||||
{
|
||||
parameters.Settings = this.Settings;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters.Settings = settings;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IContainerRepository storageContainerRepository = this.RepositoryFactory.CreateContainerRepository();
|
||||
storageContainers = storageContainerRepository.GetStorageContainers();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
|
||||
Collection<PSDriveInfo> drives = new Collection<PSDriveInfo>();
|
||||
|
||||
// For every storageContainer that the User has access to, create a Drive that he can mount within Powershell..
|
||||
|
||||
try
|
||||
{
|
||||
if (storageContainers.Count > 0)
|
||||
{
|
||||
foreach (StorageContainer storageContainer in storageContainers)
|
||||
{
|
||||
PSDriveInfo driveInfo = new PSDriveInfo(storageContainer.Name, providerInfo, "/", "Root folder for your storageContainer", null);
|
||||
OSDriveInfo kvsDriveInfo = new OSDriveInfo(driveInfo, parameters, this.Context);
|
||||
drives.Add(kvsDriveInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PSDriveInfo driveInfo = new PSDriveInfo("OS-Init", this.SessionState.Drive.Current.Provider, "/", "Root folder for your storageContainer", null);
|
||||
return new Collection<PSDriveInfo>
|
||||
{
|
||||
new OSDriveInfo(driveInfo, parameters, this.Context)
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return drives;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void WriteHeader(string message)
|
||||
{
|
||||
// Write out the commands header information first..
|
||||
|
||||
WriteObject("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("===================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
WriteObject(message);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("===================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
WriteObject(" ");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void WriteContainers()
|
||||
{
|
||||
List<string> invalidDriveNames = new List<string>();
|
||||
OSDriveParameters parameters = new OSDriveParameters();
|
||||
HPOSNavigationProvider provider = new HPOSNavigationProvider();
|
||||
Collection<PSDriveInfo> drives = this.GetAvailableDrives(this.Settings, this.SessionState.Provider.GetOne("OS-Storage"));
|
||||
|
||||
if (drives != null)
|
||||
{
|
||||
this.WriteHeader("Storage Containers available in this Region include");
|
||||
|
||||
// Remove the old Users drives first..
|
||||
|
||||
Collection<PSDriveInfo> deadDrives = this.SessionState.Drive.GetAllForProvider("OS-Storage");
|
||||
foreach (PSDriveInfo deadDrive in deadDrives)
|
||||
{
|
||||
this.SessionState.Drive.Remove(deadDrive.Name, true, "local");
|
||||
}
|
||||
|
||||
foreach (PSDriveInfo drive in drives)
|
||||
{
|
||||
if (drive.Name != string.Empty)
|
||||
{
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
WriteObject("Storage Container : [" + drive.Name + "] now available.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.SessionState.Drive.New(drive, "local");
|
||||
}
|
||||
catch (PSArgumentException ex)
|
||||
{
|
||||
if (drive.Name != string.Empty)
|
||||
invalidDriveNames.Add(drive.Name);
|
||||
}
|
||||
|
||||
}
|
||||
//WriteObject("");
|
||||
}
|
||||
else
|
||||
{
|
||||
// No storageContainers exist for the new credentials so make some up...
|
||||
|
||||
PSDriveInfo driveInfo = new PSDriveInfo("OS-Init", this.SessionState.Drive.Current.Provider, "/", "Root folder for your storageContainer", null);
|
||||
this.SessionState.Drive.New(new OSDriveInfo(driveInfo, parameters, this.Context), "local");
|
||||
}
|
||||
|
||||
if (invalidDriveNames.Count > 0)
|
||||
{
|
||||
WriteObject("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
WriteObject("Error : A subset of your Containers could not be bound to this");
|
||||
WriteObject("session due to naming conflicts with the naming standards required");
|
||||
WriteObject("for Powershell drives. These containers are listed below.");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
WriteObject("=================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
WriteObject(" ");
|
||||
|
||||
foreach (string name in invalidDriveNames)
|
||||
{
|
||||
WriteObject(name);
|
||||
WriteObject(" ");
|
||||
}
|
||||
//WriteObject(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Management.Automation;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
{
|
||||
[Cmdlet("Set", "ZoneColor", SupportsShouldProcess = true)]
|
||||
public class SetZoneColorCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _zone;
|
||||
private string _color;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "SetZoneColor", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("c")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateSet("Black", "Blue", "Cyan", "DarkBlue", "DarkCyan", "DarkGray", "DarkGreen", "DarkMagenta", "DarkRed", "DarkYellow", "Gray", "Green", "Magenta", "Red", "White", "Yellow")]
|
||||
public string Color
|
||||
{
|
||||
get { return _color; }
|
||||
set { _color = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "SetZoneColor", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("z")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateSet("1", "2", "3", "4")]
|
||||
public string Zone
|
||||
{
|
||||
get { return _zone; }
|
||||
set { _zone = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement zoneKeyNode = doc.XPathSelectElement("//AvailabilityZone[@id='" + _zone + "']");
|
||||
|
||||
zoneKeyNode.SetAttributeValue("shellForegroundColor", _color);
|
||||
doc.Save(configFilePath);
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.Write(zoneKeyNode.Attribute("name").Value + " now assigned to ");
|
||||
|
||||
ConsoleColor currentColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), zoneKeyNode.Attribute("shellForegroundColor").Value);
|
||||
|
||||
Console.Write(_color + ".");
|
||||
Console.ForegroundColor = currentColor;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using Openstack.Objects.DataAccess.Compute;
|
||||
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Security
|
||||
{
|
||||
[Cmdlet("Get", "Limits", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class GetLimitsCmdlet : BasePSCmdlet
|
||||
{
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
Limits limits = this.RepositoryFactory.CreateServerRepository().GetLimits();
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("The following Limits are in place for this account.");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Limit Category : Absolute");
|
||||
Console.WriteLine("-------------------------------------------------");
|
||||
Console.WriteLine("Max Server Metadata Elements : " + limits.limits.AbsoluteLimits.maxServerMeta);
|
||||
Console.WriteLine("Max Personality : " + limits.limits.AbsoluteLimits.maxPersonality);
|
||||
Console.WriteLine("Max Image Metadata Elements : " + limits.limits.AbsoluteLimits.maxImageMeta);
|
||||
Console.WriteLine("Max Personality Size : " + limits.limits.AbsoluteLimits.maxPersonalitySize);
|
||||
Console.WriteLine("Max Security Group Rules : " + limits.limits.AbsoluteLimits.maxSecurityGroupRules);
|
||||
Console.WriteLine("Max Security Groups : " + limits.limits.AbsoluteLimits.maxSecurityGroups);
|
||||
Console.WriteLine("Max Total Instances : " + limits.limits.AbsoluteLimits.maxTotalInstances);
|
||||
Console.WriteLine("Max Total RAM Size : " + limits.limits.AbsoluteLimits.maxTotalRAMSize);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,129 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain.Compute.Servers.Actions;
|
||||
using System;
|
||||
using Openstack.Objects.DataAccess.Compute;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "Password", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class GetPasswordCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _administratorPassword;
|
||||
private string _serverId;
|
||||
private string _keyName;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "GetPassword", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("k")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string KeyName
|
||||
{
|
||||
get { return _keyName; }
|
||||
set { _keyName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "GetPassword", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private string GetServerId()
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
if (serverContainer != null)
|
||||
return serverContainer.Entity.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentContainer.Entity.Id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.ServerId == null)
|
||||
this.ServerId = this.GetServerId();
|
||||
|
||||
IServerRepository repository = this.RepositoryFactory.CreateServerRepository();
|
||||
GetServerLogAction action = new GetServerLogAction();
|
||||
action.ServerId = this.ServerId;
|
||||
Log log = repository.GetServerLog(action);
|
||||
|
||||
if (log != null && log.Content.Length > 14)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Log detected!");
|
||||
string pw = log.ExtractAdminPassword(this.Settings.KeyStoragePath + @"\OS\" + _keyName + ".pem");
|
||||
Console.WriteLine("Administrator Password : " + pw);
|
||||
Console.WriteLine("");
|
||||
|
||||
if (this.Settings.EnableCredentialTracking == true)
|
||||
{
|
||||
CredentialListManager manager = new CredentialListManager(this.Settings);
|
||||
manager.SetPassword(this.ServerId, pw);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Unfortunately we couldn't retrieve the Instance Log. If this situation persist, we recommend that you delete and recreate the instance.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using Openstack.Objects.Domain.Server;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Network
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "KeyPair", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class NewKeyPairCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _filename = null;
|
||||
private SwitchParameter _copyToClipboard = false;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
//[Parameter(Position = 2, ParameterSetName = "NewKeypair", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "a")]
|
||||
//[Alias("c")]
|
||||
//public SwitchParameter CopyToClipboard
|
||||
//{
|
||||
// get { return _copyToClipboard; }
|
||||
// set { _copyToClipboard = value; }
|
||||
//}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewKeypair", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "a")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void StoreKey(string privateKey)
|
||||
{
|
||||
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ExportKey(string privateKey, string filename)
|
||||
{
|
||||
// Save the key locally first..
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.AppendLine(privateKey);
|
||||
|
||||
using (StreamWriter outfile = new StreamWriter(this.Settings.KeyStoragePath + @"\OS\" + filename, false))
|
||||
{
|
||||
outfile.Write(builder.ToString());
|
||||
}
|
||||
|
||||
// Now export with PuttyGen
|
||||
|
||||
//Process.Start(this.Settings.PuttuGenPath, this.Settings.KeyStoragePath + @"\TempKey.key -O private -o " + this.Settings.KeyStoragePath + "testKey.ppk" + "-q");
|
||||
//int y = 9;
|
||||
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewKeyPair nkp = new NewKeyPair();
|
||||
nkp.Name = this.Name;
|
||||
KeyPair keypair = this.RepositoryFactory.CreateKeyPairRepository().SaveKeyPair(nkp);
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("New keypair created.");
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("User Id : " + keypair.UserId);
|
||||
Console.WriteLine("Name : " + keypair.Name);
|
||||
Console.WriteLine("Private Key : ");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(keypair.PrivateKey);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Public Key : ");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(keypair.PublicKey);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Fingerprint : " + keypair.Fingerprint);
|
||||
Console.WriteLine("");
|
||||
|
||||
this.ExportKey(keypair.PrivateKey, keypair.Name + ".pem");
|
||||
|
||||
if (_copyToClipboard)
|
||||
{
|
||||
OutClipboard.SetText(keypair.PrivateKey);
|
||||
}
|
||||
|
||||
Console.WriteLine("Exporting Private Key.");
|
||||
Console.WriteLine("Storing Key.");
|
||||
Console.WriteLine("Key Generation and storage complete.");
|
||||
Console.WriteLine("");
|
||||
this.UpdateCache<KeyPairsUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Network
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "KeyPair", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveKeyPairCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RemoveKeyPair", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "a")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.RepositoryFactory.CreateKeyPairRepository().DeleteKeyPair(this.Name);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Keypair " + this.Name + " removed.");
|
||||
Console.WriteLine("");
|
||||
this.UpdateCache<KeyPairsUIContainer>();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Error : Keypair " + this.Name + " not found.");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Reset, "Password", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class ResetPasswordCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _administratorPassword;
|
||||
private string _serverId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "ResetPassword", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "ResetPassword", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("p")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string AdministratorPassword
|
||||
{
|
||||
get { return _administratorPassword; }
|
||||
set { _administratorPassword = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ChangeWindowsImagePW()
|
||||
{
|
||||
CredentialListManager manager = new CredentialListManager(this.Settings);
|
||||
if (this.Settings.EnableCredentialTracking == true)
|
||||
{
|
||||
manager.SetPassword(this.ServerId, this.AdministratorPassword);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Password Updated.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("You're attempting to update the password for a Windows Image but EnableCredentialTracking is currently turned off. To turn this on please use the Get-config and Set-config cmdlets. Operation failed.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ChangeNonWindowsImagePW()
|
||||
{
|
||||
ChangePasswordAction action = new ChangePasswordAction();
|
||||
action.AdministratorPassword = this.AdministratorPassword;
|
||||
action.ServerId = this.ServerId;
|
||||
|
||||
this.RepositoryFactory.CreateServerRepository().ChangePassword(action);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Password Changed.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private string GetServerId()
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
if (serverContainer != null)
|
||||
return serverContainer.Entity.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return currentContainer.Entity.Id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private bool IsWindowsImage(string imageId)
|
||||
{
|
||||
Image image = this.RepositoryFactory.CreateImageRepository().GetImage(imageId);
|
||||
return image.IsWindowsImage;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.ServerId == null)
|
||||
this.ServerId = this.GetServerId();
|
||||
|
||||
Openstack.Objects.Domain.Compute.Server server = this.RepositoryFactory.CreateServerRepository().GetServer(this.ServerId);
|
||||
|
||||
if (this.IsWindowsImage(server.Image.Id)) {
|
||||
ChangeWindowsImagePW();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Invalid Server : The Server you supplied is not a based on a Windows image. We currently only support key based authentication for non-Windows images.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,316 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using Openstack.Objects.DataAccess.Compute;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.Domain.Compute.Servers.Actions;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet("Connect", "Server", SupportsShouldProcess = true)]
|
||||
public class ConnectServerCmdletd : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _keypairName = null;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "ConnectServerPS", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("s")]
|
||||
public string ServerId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_serverId != null)
|
||||
return _serverId;
|
||||
else
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
ServerUIContainer serverContainer = currentContainer as ServerUIContainer;
|
||||
|
||||
if (serverContainer != null) {
|
||||
return serverContainer.Entity.Id;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
set { _serverId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private bool IsWindowsImage(string imageId)
|
||||
{
|
||||
Image image = this.RepositoryFactory.CreateImageRepository().GetImage(imageId);
|
||||
return image.IsWindowsImage;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private string GetAdminPassword(string keyname)
|
||||
{
|
||||
GetServerLogAction action = new GetServerLogAction();
|
||||
action.ServerId = this.ServerId;
|
||||
Log log = this.RepositoryFactory.CreateServerRepository().GetServerLog(action);
|
||||
|
||||
if (log != null)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
string pw = log.ExtractAdminPassword(this.Settings.KeyStoragePath + keyname + ".pem");
|
||||
Console.WriteLine("Administrator Password : " + pw);
|
||||
return pw;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ShowCredentialsNotFoundMsg()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Credentials not found. You'll have to manually enter your Administrator credentials for this instance.");
|
||||
Console.WriteLine("If you want to continue to use Automatic Credential Tracking for this instance make sure that you update");
|
||||
Console.WriteLine("our records with the new password. To do this, use the Reset-Password cmdlet.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
//=========================================================================================
|
||||
private void WriteSection(string headerText)
|
||||
{
|
||||
ConsoleColor oldColor = Console.ForegroundColor;
|
||||
Console.WriteLine(" ");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("==============================================================================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine(headerText);
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("==============================================================================================================================================");
|
||||
Console.ForegroundColor = oldColor;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//===================================================================================K=====
|
||||
private void ShowKeyBasedLoginInstructions(string keyname)
|
||||
{
|
||||
if (keyname == null) keyname = "YourKeyfile";
|
||||
|
||||
this.WriteSection("Unable to find a suitable Putty key file!");
|
||||
Console.WriteLine("1. Make sure that you have downloaded the latest version of Putty and PuttyGen for Windows.");
|
||||
Console.WriteLine("2. Tell us where Putty.exe exist by setting the Config file entry SSHClientPath (use Set-Config)");
|
||||
Console.WriteLine("3. Tell PuttyGen to Load an existing key file. This file will be located at " + this.Settings.KeyStoragePath + @"\OS\" + keyname + ".pem");
|
||||
Console.WriteLine("4. Convert the .pem file to the .ppk format that Putty.exe understands by clicking the Save Private Key button.");
|
||||
Console.WriteLine("5. Save the .ppk file as " + keyname + ".ppk");
|
||||
Console.WriteLine("6. Launch the SSH session with the Connect-Server cmdlet");
|
||||
Console.WriteLine("7. HINT : If you use the same keypair name for each Server you create you can skip steps 1-5 after the steps have been completed once.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private bool LaunchPasswordBasedSSHSession(Openstack.Objects.Domain.Compute.Server server)
|
||||
{
|
||||
CredentialListManager manager = new CredentialListManager(this.Settings);
|
||||
SSHClient sshClient = new SSHClient(this.Settings);
|
||||
sshClient.Username = "ubuntu";
|
||||
sshClient.Address = server.Addresses.Private[1].Addr;
|
||||
sshClient.Password = manager.GetPassword(server.Id);
|
||||
|
||||
if (sshClient.Password == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
sshClient.LaunchClient();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private bool IsSSHClientConfigured()
|
||||
{
|
||||
if (this.Settings.SSHClientPath == string.Empty)
|
||||
return false;
|
||||
else
|
||||
return File.Exists(this.Settings.SSHClientPath);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private bool DoesPPKExist(string keyName)
|
||||
{
|
||||
return File.Exists(this.Settings.KeyStoragePath + @"\OS\" + keyName + ".ppk");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void SaveSSHClientLocation(string path)
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement clientPathNode = doc.XPathSelectElement("//add[@key='SSHClientPath']");
|
||||
|
||||
clientPathNode.SetAttributeValue("value", path);
|
||||
doc.Save(configFilePath);
|
||||
this.Settings.SSHClientPath = path;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ConfigureSSHClient()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("You're trying to establish a remote session with a non-Windows based server. This requires a fully qualified path to the SSH client (putty.exe)");
|
||||
Console.Write("SSH Client Path : ");
|
||||
string path = Console.ReadLine();
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Putty.exe found! Saving location for future sessions..");
|
||||
Console.WriteLine("");
|
||||
this.SaveSSHClientLocation(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Putty.exe not found! Invalid path supplied.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void LaunchSSHSession(Openstack.Objects.Domain.Compute.Server server)
|
||||
{
|
||||
if (!IsSSHClientConfigured()) {
|
||||
this.ConfigureSSHClient();
|
||||
}
|
||||
|
||||
if (server.KeyName != null && this.DoesPPKExist(server.KeyName))
|
||||
{
|
||||
SSHClient sshClient = new SSHClient(this.Settings);
|
||||
sshClient.Username = "ubuntu";
|
||||
sshClient.KeypairName = server.KeyName;
|
||||
sshClient.Address = server.Addresses.Private[1].Addr;
|
||||
|
||||
sshClient.LaunchClient();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ShowKeyBasedLoginInstructions(server.KeyName);
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void LaunchWindowsSession(Openstack.Objects.Domain.Compute.Server server)
|
||||
{
|
||||
CredentialListManager manager = new CredentialListManager(this.Settings);
|
||||
RDPClient client = new RDPClient();
|
||||
client.Address = server.Addresses.Private[1].Addr;
|
||||
client.Username = "Administrator";
|
||||
|
||||
if (this.Settings.EnableCredentialTracking == true)
|
||||
{
|
||||
client.Password = manager.GetPassword(server.Id);
|
||||
if (client.Password == null)
|
||||
{
|
||||
this.ShowCredentialsNotFoundMsg();
|
||||
return;
|
||||
}
|
||||
}
|
||||
client.LaunchClient();
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.ServerId);
|
||||
if (id != null)
|
||||
{
|
||||
Openstack.Objects.Domain.Compute.Server server = this.RepositoryFactory.CreateServerRepository().GetServer(id);
|
||||
if (server != null)
|
||||
{
|
||||
if (IsWindowsImage(server.Image.Id))
|
||||
{
|
||||
this.LaunchWindowsSession(server);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.LaunchSSHSession(server);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Server not found.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,176 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "Image", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class NewImageCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string[] _metadata;
|
||||
private string _serverId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "NewImage", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewImage", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "NewImage", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("md")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] MetaData
|
||||
{
|
||||
get { return _metadata; }
|
||||
set { _metadata = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
public MetaData AddEntries(string[] keyValuePairs)
|
||||
{
|
||||
MetaData metadata = new MetaData();
|
||||
|
||||
if (keyValuePairs != null && keyValuePairs.Count() > 0)
|
||||
{
|
||||
foreach (string kv in keyValuePairs)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
MetaDataElement element = new MetaDataElement();
|
||||
element.Key = temp[0];
|
||||
element.Value = temp[1];
|
||||
|
||||
metadata.Add(temp[0], temp[1]);
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
public MetaData ReformatMetadata(string[] keyValuePairs)
|
||||
{
|
||||
MetaData metadata = new MetaData();
|
||||
|
||||
if (keyValuePairs != null && keyValuePairs.Count() > 0)
|
||||
{
|
||||
foreach (string kv in keyValuePairs)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
MetaDataElement element = new MetaDataElement();
|
||||
element.Key = temp[0];
|
||||
element.Value = temp[1];
|
||||
|
||||
metadata.Add(temp[0], temp[1]);
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
MetaData md = null;
|
||||
md = this.ReformatMetadata(this.MetaData);
|
||||
NewImage image = new NewImage();
|
||||
image.MetaData = md;
|
||||
image.Name = this.Name;
|
||||
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
image.ServerId = this.ServerId;
|
||||
this.RepositoryFactory.CreateImageRepository().SaveImage(image);
|
||||
this.UpdateCache<ImageUIContainer>();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
|
||||
if (serverContainer != null)
|
||||
{
|
||||
image.ServerId = serverContainer.Entity.Id;
|
||||
this.RepositoryFactory.CreateImageRepository().SaveImage(image);
|
||||
this.UpdateCache<ImagesUIContainer>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
image.ServerId = currentContainer.Entity.Id;
|
||||
this.RepositoryFactory.CreateImageRepository().SaveImage(image);
|
||||
this.UpdateCache<ImagesUIContainer>();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,323 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Openstack.Objects.DataAccess.Compute;
|
||||
using System.Threading;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "Server", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class NewServerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _imageId;
|
||||
private string _flavorId;
|
||||
private string _password;
|
||||
private string _accessIPv4;
|
||||
private string _accessIPv6;
|
||||
private string _keyName;
|
||||
private string[] _metadata;
|
||||
private string[] _securityGroups;
|
||||
private bool _useWizard = false;
|
||||
private string[] _networksIds;
|
||||
private string _availabilityZone;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewServerPS", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewServerPS", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "A valid reference to an Image.")]
|
||||
[Alias("i")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ImageRef
|
||||
{
|
||||
get { return _imageId; }
|
||||
set { _imageId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewServerPS", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "A reference to a valid Flavor.Image")]
|
||||
[Alias("f")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string FlavorRef
|
||||
{
|
||||
get { return _flavorId; }
|
||||
set { _flavorId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, ParameterSetName = "NewServerPS", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "ipv4 address for remote access.")]
|
||||
[Alias("ip4")]
|
||||
public string AccessIPv4
|
||||
{
|
||||
get { return _accessIPv4; }
|
||||
set { _accessIPv4 = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 4, ParameterSetName = "NewServerPS", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "ipv6 address for remote access.")]
|
||||
[Alias("ip6")]
|
||||
public string AccessIPv6
|
||||
{
|
||||
get { return _accessIPv6; }
|
||||
set { _accessIPv6 = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, Mandatory = false, ParameterSetName = "NewServerPS", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("md")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] MetaData
|
||||
{
|
||||
get { return _metadata; }
|
||||
set { _metadata = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 6, ParameterSetName = "NewServerPS", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("k")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string KeyName
|
||||
{
|
||||
get { return _keyName; }
|
||||
set { _keyName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 7, Mandatory = false, ParameterSetName = "NewServerPS", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("sg")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] SecurityGroups
|
||||
{
|
||||
get { return _securityGroups; }
|
||||
set { _securityGroups = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 8, Mandatory = true, ParameterSetName = "NewServerPS", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("nid")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] NetworksIds
|
||||
{
|
||||
get { return _networksIds; }
|
||||
set { _networksIds = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 9, ParameterSetName = "NewServerPS", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("az")]
|
||||
public string AvailabilityZone
|
||||
{
|
||||
get { return _availabilityZone; }
|
||||
set { _availabilityZone = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
public MetaData AddEntries(string[] keyValuePairs)
|
||||
{
|
||||
MetaData metadata = new MetaData();
|
||||
|
||||
if (keyValuePairs != null && keyValuePairs.Count() > 0)
|
||||
{
|
||||
foreach (string kv in keyValuePairs)
|
||||
{
|
||||
char[] seperator = { '|' };
|
||||
string[] temp = kv.Split(seperator);
|
||||
MetaDataElement element = new MetaDataElement();
|
||||
element.Key = temp[0];
|
||||
element.Value = temp[1];
|
||||
|
||||
metadata.Add(temp[0], temp[1]);
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private List<SecurityGroupAssignment> GetSecurityGroups()
|
||||
{
|
||||
List<SecurityGroupAssignment> assignments = new List<SecurityGroupAssignment>();
|
||||
|
||||
if (_securityGroups != null)
|
||||
{
|
||||
foreach (string sg in _securityGroups)
|
||||
{
|
||||
assignments.Add(new SecurityGroupAssignment(sg));
|
||||
}
|
||||
}
|
||||
|
||||
return assignments;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private bool IsWindowsImage(string imageId)
|
||||
{
|
||||
Image image = this.RepositoryFactory.CreateImageRepository().GetImage(imageId);
|
||||
return image.IsWindowsImage;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private List<NetworkId> GetNetworkIDs()
|
||||
{
|
||||
if (this.NetworksIds != null)
|
||||
{
|
||||
List<NetworkId> ids = new List<NetworkId>();
|
||||
foreach (string id in this.NetworksIds)
|
||||
{
|
||||
NetworkId uuid = new NetworkId(id);
|
||||
ids.Add(uuid);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void SaveServer()
|
||||
{
|
||||
NewServer server = new NewServer();
|
||||
server.Name = this.Name;
|
||||
server.ImageRef = this.ImageRef;
|
||||
server.FlavorRef = this.FlavorRef;
|
||||
server.AccessIPv6 = this.AccessIPv6;
|
||||
server.AccessIPv4 = this.AccessIPv4;
|
||||
server.MetaData = this.AddEntries(this.MetaData);
|
||||
server.KeyName = this.KeyName;
|
||||
server.SecurityGroups = this.GetSecurityGroups();
|
||||
server.Networks = this.GetNetworkIDs();
|
||||
server.AvailabilityZone = this.AvailabilityZone;
|
||||
|
||||
if (IsWindowsImage(this.ImageRef))
|
||||
{
|
||||
WindowsInstanceBuilder builder = new WindowsInstanceBuilder(this.RepositoryFactory, this.Settings);
|
||||
builder.Changed += new Openstack.Objects.DataAccess.Compute.WindowsInstanceBuilder.CreateInstanceEventHandler(BuilderEvent);
|
||||
builder.CreateInstance(server);
|
||||
builder.Changed -= new Openstack.Objects.DataAccess.Compute.WindowsInstanceBuilder.CreateInstanceEventHandler(BuilderEvent);
|
||||
this.UpdateCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
NonWindowsInstanceBuilder nonWIBuilder = new NonWindowsInstanceBuilder(this.RepositoryFactory, this.Settings);
|
||||
nonWIBuilder.Changed += new Openstack.Objects.DataAccess.Compute.NonWindowsInstanceBuilder.CreateInstanceEventHandler(BuilderEvent);
|
||||
nonWIBuilder.CreateInstance(server, _keyName);
|
||||
nonWIBuilder.Changed -= new Openstack.Objects.DataAccess.Compute.NonWindowsInstanceBuilder.CreateInstanceEventHandler(BuilderEvent);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//=========================================================================================
|
||||
private void BuilderEvent(object sender, CreateInstanceEventArgs e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private NewServer ShowNewServerWizard()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.SaveServer();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,180 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet("Ping", "Server", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class PingServerCmdletd : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "PingwServerPS", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("s")]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="address"></param>
|
||||
//=========================================================================================
|
||||
private void PingServer(string address)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Pinging Server : " + address);
|
||||
AutoResetEvent waiter = new AutoResetEvent(false);
|
||||
|
||||
Ping pingSender = new Ping();
|
||||
|
||||
// When the PingCompleted event is raised,
|
||||
// the PingCompletedCallback method is called.
|
||||
pingSender.PingCompleted += new PingCompletedEventHandler(PingCompletedCallback);
|
||||
|
||||
// Create a buffer of 32 bytes of data to be transmitted.
|
||||
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(data);
|
||||
|
||||
// Wait 12 seconds for a reply.
|
||||
int timeout = 12000;
|
||||
|
||||
// Set options for transmission:
|
||||
// The data can go through 64 gateways or routers
|
||||
// before it is destroyed, and the data packet
|
||||
// cannot be fragmented.
|
||||
PingOptions options = new PingOptions(64, true);
|
||||
|
||||
Console.WriteLine("Time to live : {0}", options.Ttl);
|
||||
Console.WriteLine("Don't fragment : {0}", options.DontFragment);
|
||||
|
||||
// Send the ping asynchronously.
|
||||
// Use the waiter as the user token.
|
||||
// When the callback completes, it can wake up this thread.
|
||||
pingSender.SendAsync(address, timeout, buffer, options, waiter);
|
||||
|
||||
// Prevent this example application from ending.
|
||||
// A real application should do something useful
|
||||
// when possible.
|
||||
waiter.WaitOne();
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private IList<IPAddress> GetServerIPAddresses(string serverId)
|
||||
{
|
||||
Openstack.Objects.Domain.Compute.Server server = this.RepositoryFactory.CreateServerRepository().GetServer(serverId);
|
||||
return server.Addresses.Private;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
IList<IPAddress> addresses = this.GetServerIPAddresses(this.ServerId);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(addresses.Count + " assigned IP addresses found. Ping results are as follows.");
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (IPAddress address in addresses)
|
||||
{
|
||||
this.PingServer(address.Addr);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private static void PingCompletedCallback(object sender, PingCompletedEventArgs e)
|
||||
{
|
||||
// If the operation was canceled, display a message to the user.
|
||||
if (e.Cancelled)
|
||||
{
|
||||
Console.WriteLine("Ping canceled.");
|
||||
|
||||
// Let the main thread resume.
|
||||
// UserToken is the AutoResetEvent object that the main thread
|
||||
// is waiting for.
|
||||
((AutoResetEvent)e.UserState).Set();
|
||||
}
|
||||
|
||||
// If an error occurred, display the exception to the user.
|
||||
if (e.Error != null)
|
||||
{
|
||||
Console.WriteLine("Ping failed:");
|
||||
Console.WriteLine(e.Error.ToString());
|
||||
|
||||
// Let the main thread resume.
|
||||
((AutoResetEvent)e.UserState).Set();
|
||||
}
|
||||
|
||||
PingReply reply = e.Reply;
|
||||
|
||||
DisplayReply(reply);
|
||||
|
||||
// Let the main thread resume.
|
||||
((AutoResetEvent)e.UserState).Set();
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
public static void DisplayReply(PingReply reply)
|
||||
{
|
||||
if (reply == null)
|
||||
return;
|
||||
|
||||
Console.WriteLine("ping status : {0}", reply.Status);
|
||||
if (reply.Status == IPStatus.Success)
|
||||
{
|
||||
Console.WriteLine("Address : {0}", reply.Address.ToString());
|
||||
Console.WriteLine("RoundTrip time : {0}", reply.RoundtripTime);
|
||||
Console.WriteLine("Time to live : {0}", reply.Options.Ttl);
|
||||
Console.WriteLine("Don't fragment : {0}", reply.Options.DontFragment);
|
||||
Console.WriteLine("Buffer size : {0}", reply.Buffer.Length);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
using System;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet("Reboot", "Server", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RebootServerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private ServerRebootType _type = ServerRebootType.SOFT;
|
||||
private string _serverId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RebootServer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "RebootServer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[Alias("t")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateSet("SOFT", "HARD")]
|
||||
public ServerRebootType Type
|
||||
{
|
||||
get { return _type; }
|
||||
set { _type = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.ServerId);
|
||||
|
||||
RebootAction action = new RebootAction();
|
||||
action.RebootType = this.Type;
|
||||
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
action.ServerId = id;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Rebooting Server " + id);
|
||||
Console.WriteLine("");
|
||||
this.RepositoryFactory.CreateServerRepository().Reboot(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
|
||||
if (serverContainer != null)
|
||||
{
|
||||
action.ServerId = serverContainer.Entity.Id;
|
||||
this.RepositoryFactory.CreateServerRepository().Reboot(action);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer as ServerUIContainer;
|
||||
if (serverContainer != null)
|
||||
{
|
||||
action.ServerId = serverContainer.Entity.Id;
|
||||
this.RepositoryFactory.CreateServerRepository().Reboot(action);
|
||||
this.UpdateCache<ServerUIContainer>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Metadata", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveMetadataCmdletd : BasePSCmdlet
|
||||
{
|
||||
private string _key;
|
||||
private string _serverId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "RemoveMetadata", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, Mandatory = true, ParameterSetName = "RemoveMetadata", ValueFromPipelineByPropertyName = true, HelpMessage = "sdfgh")]
|
||||
[Alias("k")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Key
|
||||
{
|
||||
get { return _key; }
|
||||
set { _key = value; }
|
||||
}
|
||||
#endregion
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
//=========================================================================================
|
||||
private void RemoveElement(string key)
|
||||
{
|
||||
IList elements = ((CommonDriveInfo)this.Drive).CurrentContainer.Entities;
|
||||
MetaDataElement mdElement = null;
|
||||
|
||||
foreach (MetaDataElement element in elements)
|
||||
{
|
||||
if (element.Key == this.Key)
|
||||
{
|
||||
mdElement = element;
|
||||
}
|
||||
}
|
||||
|
||||
elements.Remove(mdElement);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
this.RepositoryFactory.CreateServerRepository().DeleteMetadata(this.ServerId, this.Key);
|
||||
this.RemoveElement(this.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseUIContainer currentContainer = this.SessionState.PSVariable.Get("CurrentContainer").Value as BaseUIContainer;
|
||||
|
||||
if (currentContainer.Name == "Metadata")
|
||||
{
|
||||
ServerUIContainer serverContainer = currentContainer.Parent as ServerUIContainer;
|
||||
|
||||
if (serverContainer != null) {
|
||||
this.RepositoryFactory.CreateServerRepository().DeleteMetadata(serverContainer.Entity.Id, this.Key);
|
||||
this.RemoveElement(this.Key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.RepositoryFactory.CreateServerRepository().DeleteMetadata(currentContainer.Entity.Id, this.Key);
|
||||
this.RemoveElement(this.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Management.Automation.Host;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Server", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveServerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private SwitchParameter _force = false;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "RemoveServer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RemoveServer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllServers()
|
||||
{
|
||||
List<Openstack.Objects.Domain.Compute.Server> servers = this.RepositoryFactory.CreateServerRepository().GetServers();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach(Openstack.Objects.Domain.Compute.Server server in servers)
|
||||
{
|
||||
if (server.Name != "RGWinLarge")
|
||||
{
|
||||
Console.WriteLine("Removing Server : " + server.Name);
|
||||
this.RepositoryFactory.CreateServerRepository().DeleteServer(server.Id);
|
||||
}
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.ServerId);
|
||||
|
||||
if (_force)
|
||||
{
|
||||
Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>();
|
||||
choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
Console.WriteLine("");
|
||||
if (this.Host.UI.PromptForChoice("Confirm Action", "You are about to remove all active Server instances. Are you sure about this?", choices, 0) == 0)
|
||||
this.RemoveAllServers();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
this.RepositoryFactory.CreateServerRepository().DeleteServer(id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,96 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Objects.Domain.Compute.Servers;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Server
|
||||
{
|
||||
[Cmdlet("Update", "Server", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class UpdateServerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _name;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdateServer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdateServer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void UpdateName(string name)
|
||||
{
|
||||
BaseUIContainer server = ((CommonDriveInfo)this.Drive).CurrentContainer;
|
||||
server.Name = name;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
Openstack.Objects.Domain.Compute.Server server = new Openstack.Objects.Domain.Compute.Server();
|
||||
if (this.ServerId != null)
|
||||
{
|
||||
server.Id = this.ServerId;
|
||||
server.Name = this.Name;
|
||||
|
||||
this.RepositoryFactory.CreateServerRepository().UpdateServer(server);
|
||||
this.UpdateName(this.Name);
|
||||
this.UpdateCache<ServersUIContainer>();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Assign", "IP", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class AssignIPCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _ip;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("ip")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string IpAddress
|
||||
{
|
||||
get { return _ip; }
|
||||
set { _ip = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (!this.ServerId.Contains("."))
|
||||
{
|
||||
IFloatingIPRepository repository = new FloatingIPRepository(this.Context.GetRepositoryContext("compute"));
|
||||
|
||||
AssignIPAction assignment = new AssignIPAction();
|
||||
assignment.ServerId = this.ServerId;
|
||||
assignment.Ip = this.IpAddress;
|
||||
|
||||
repository.AssignIP(assignment);
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Floating IP Address " + this.IpAddress + " now assigned to Server : " + assignment.ServerId);
|
||||
Console.WriteLine("");
|
||||
this.UpdateCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
InvalidOperationException ex = new InvalidOperationException("Please check the supplied parameters. IP addresses are not allowed in place of Server IDs.", null);
|
||||
WriteError(new ErrorRecord(ex, "0", ErrorCategory.InvalidArgument, null));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "FloatingIP", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class DeleteFloatingIPCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _floatingIPId;
|
||||
private SwitchParameter _force = false;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeleteFloatingIP", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeleteFloatingIP2", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("id")]
|
||||
public string FloatingIP
|
||||
{
|
||||
get { return _floatingIPId; }
|
||||
set { _floatingIPId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllFloatingIPs()
|
||||
{
|
||||
IFloatingIPRepository repository = this.RepositoryFactory.CreateFloatingIPRepository();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (BaseEntity entity in this.CurrentContainer.Entities)
|
||||
{
|
||||
if (entity.Name != null)
|
||||
Console.WriteLine("Removing Floating IP : " + entity.Name);
|
||||
else
|
||||
Console.WriteLine("Removing Floating IP : " + entity.Id);
|
||||
|
||||
repository.DeleteFloatingIP(entity.Id);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (_force)
|
||||
{
|
||||
if (this.UserConfirmsDeleteAction("Floating IP Addresses"))
|
||||
{
|
||||
this.RemoveAllFloatingIPs();
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.FloatingIP);
|
||||
this.RepositoryFactory.CreateFloatingIPRepository().DeleteFloatingIP(id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Network", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.)]
|
||||
public class DeleteNetworkCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _networkId;
|
||||
private SwitchParameter _removeAll = false;
|
||||
private SwitchParameter _force = true;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeleteNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("id")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeleteNetwork2", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _removeAll; }
|
||||
set { _removeAll = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "DeleteNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("f")]
|
||||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//=========================================================================================
|
||||
private void BuilderEvent(object sender, CreateNetworkEventArgs e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllNetworks()
|
||||
{
|
||||
INetworkRepository repository = this.RepositoryFactory.CreateNetworkRepository();
|
||||
List<Network> networks = repository.GetNetworks();
|
||||
|
||||
repository.Changed += new Openstack.Objects.DataAccess.Networking.NetworkRepository.CreateNetworkEventHandler(BuilderEvent);
|
||||
foreach (BaseEntity entity in this.CurrentContainer.Entities)
|
||||
{
|
||||
if (entity.Name != "Ext-Net")
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Removing Network : " + entity.Name);
|
||||
Console.WriteLine("");
|
||||
repository.DeleteNetwork(entity.Id, _force);
|
||||
}
|
||||
}
|
||||
Console.WriteLine("");
|
||||
repository.Changed -= new Openstack.Objects.DataAccess.Networking.NetworkRepository.CreateNetworkEventHandler(BuilderEvent);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
|
||||
if (_networkId == null && _removeAll == false)
|
||||
{
|
||||
Console.WriteLine("Error : ");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_removeAll)
|
||||
{
|
||||
if (this.UserConfirmsDeleteAction("Networks"))
|
||||
{
|
||||
this.RemoveAllNetworks();
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.NetworkId);
|
||||
this.RepositoryFactory.CreateNetworkRepository().DeleteNetwork(id, _force);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Port", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class DeletePortCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _floatingIPId;
|
||||
private SwitchParameter _force = false;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeletePort", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("id")]
|
||||
public string PortId
|
||||
{
|
||||
get { return _floatingIPId; }
|
||||
set { _floatingIPId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeletePort2", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllPorts()
|
||||
{
|
||||
IPortRepository repository = this.RepositoryFactory.CreatePortRepository();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (BaseEntity entity in this.CurrentContainer.Entities)
|
||||
{
|
||||
if (entity.Name != null)
|
||||
Console.WriteLine("Removing Port : " + entity.Name);
|
||||
else
|
||||
Console.WriteLine("Removing Port : " + entity.Id);
|
||||
|
||||
repository.DeletePort(entity.Id);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.PortId);
|
||||
|
||||
if (_force)
|
||||
{
|
||||
if (this.UserConfirmsDeleteAction("Ports"))
|
||||
{
|
||||
this.RemoveAllPorts();
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RepositoryFactory.CreatePortRepository().DeletePort(id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Router", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class DeleteRouterCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _routerId;
|
||||
private SwitchParameter _force = false;
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeleteRouter", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("rid")]
|
||||
public string RouterId
|
||||
{
|
||||
get { return _routerId; }
|
||||
set { _routerId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeleteRouter2", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllRouters()
|
||||
{
|
||||
IRouterRepository repository = this.RepositoryFactory.CreateRouterRepository();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (BaseEntity entity in this.CurrentContainer.Entities)
|
||||
{
|
||||
if (entity.Name != null)
|
||||
Console.WriteLine("Removing Router : " + entity.Name);
|
||||
else
|
||||
Console.WriteLine("Removing Router : " + entity.Id);
|
||||
|
||||
repository.DeleteRouter(entity.Id);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.RouterId);
|
||||
|
||||
if (_force)
|
||||
{
|
||||
if (this.UserConfirmsDeleteAction("Routers"))
|
||||
{
|
||||
this.RemoveAllRouters();
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RepositoryFactory.CreateRouterRepository().DeleteRouter(id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "RouterInterface", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class DeleteRouterInterfaceCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _routerId;
|
||||
private string _subnetId;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeleteRouterInterface", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("id")]
|
||||
public string RouterId
|
||||
{
|
||||
get { return _routerId; }
|
||||
set { _routerId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeleteRouterInterface", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("sid")]
|
||||
public string SubnetId
|
||||
{
|
||||
get { return _subnetId; }
|
||||
set { _subnetId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.RepositoryFactory.CreateRouterRepository().DeleteInterfaceByRouter(this.RouterId, this.SubnetId);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Host;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Subnet", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class DeleteSubnetCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _subnetId;
|
||||
private SwitchParameter _force = false;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "DeleteSubnet", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("id")]
|
||||
public string SubnetId
|
||||
{
|
||||
get { return _subnetId; }
|
||||
set { _subnetId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "DeleteSubnet2", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("all")]
|
||||
public SwitchParameter RemoveAll
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void RemoveAllSubnets()
|
||||
{
|
||||
ISubnetRepository repository = this.RepositoryFactory.CreateSubnetRepository();
|
||||
Console.WriteLine("");
|
||||
|
||||
foreach (BaseEntity entity in this.CurrentContainer.Entities)
|
||||
{
|
||||
if (entity.Name != null)
|
||||
Console.WriteLine("Removing Subnet : " + entity.Name);
|
||||
else
|
||||
Console.WriteLine("Removing Subnet : " + entity.Id);
|
||||
|
||||
repository.DeleteSubnet(entity.Id);
|
||||
}
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.SubnetId);
|
||||
|
||||
if (_force && this.UserConfirmsDeleteAction("Subnets"))
|
||||
{
|
||||
this.RemoveAllSubnets();
|
||||
this.UpdateCache();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RepositoryFactory.CreateSubnetRepository().DeleteSubnet(id);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "FloatingIP", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class NewFloatingIPCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _networkId;
|
||||
private string _portId;
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewFloatingIP", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("pid")]
|
||||
public string PortId
|
||||
{
|
||||
get { return _portId; }
|
||||
set { _portId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewFloatingIP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the Server.")]
|
||||
[Alias("nid")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewFloatingIP newFloatingIP = new NewFloatingIP();
|
||||
newFloatingIP.FloatingNetworkId = this.NetworkId;
|
||||
newFloatingIP.PortId = this.PortId;
|
||||
|
||||
this.RepositoryFactory.CreateFloatingIPRepository().SaveFloatingIP(newFloatingIP);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("New", "Network", SupportsShouldProcess = true)]
|
||||
public class NewNetworkCmdlet : BasePSCmdlet
|
||||
{
|
||||
private bool _adminStateUp = true;
|
||||
private bool _force = true;
|
||||
private string _name;
|
||||
private string _cidr = "11.0.3.0/24";
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, ParameterSetName = "NewNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("cidr")]
|
||||
public string CidrValue
|
||||
{
|
||||
get { return _cidr; }
|
||||
set { _cidr = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("asu")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter AdminStateUp
|
||||
{
|
||||
get { return _adminStateUp; }
|
||||
set { _adminStateUp = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewNetwork", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("f")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter Force
|
||||
{
|
||||
get { return _force; }
|
||||
set { _force = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//=========================================================================================
|
||||
private void BuilderEvent(object sender, CreateNetworkEventArgs e)
|
||||
{
|
||||
Console.WriteLine("- " + e.Message);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
Console.WriteLine("");
|
||||
NewNetwork newNetwork = new NewNetwork();
|
||||
newNetwork.AdminStateUp = _adminStateUp;
|
||||
newNetwork.Name = _name;
|
||||
|
||||
if (this.CidrValue == null) {
|
||||
newNetwork.Cidr = "11.0.3.0/24";
|
||||
}
|
||||
else{
|
||||
newNetwork.Cidr = this.CidrValue;
|
||||
}
|
||||
|
||||
INetworkRepository repository = this.RepositoryFactory.CreateNetworkRepository();
|
||||
repository.Changed += new Openstack.Objects.DataAccess.Networking.NetworkRepository.CreateNetworkEventHandler(BuilderEvent);
|
||||
repository.SaveNetwork(newNetwork, this.Force);
|
||||
repository.Changed -= new Openstack.Objects.DataAccess.Networking.NetworkRepository.CreateNetworkEventHandler(BuilderEvent);
|
||||
Console.WriteLine(" Network Build Complete!");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
104
Openstack.Client.Powershell/Cmdlets/Networking/NewPortCmdlet.cs
Normal file
104
Openstack.Client.Powershell/Cmdlets/Networking/NewPortCmdlet.cs
Normal file
@ -0,0 +1,104 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("New", "Port", SupportsShouldProcess = true)]
|
||||
public class NewPortCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private SwitchParameter _admin_state_up = true;
|
||||
private string _networkId;
|
||||
private string _deviceId;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewPort", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewPort", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("nid")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, ParameterSetName = "NewPort", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("asu")]
|
||||
|
||||
public SwitchParameter AdminStateUp
|
||||
{
|
||||
get { return _admin_state_up; }
|
||||
set { _admin_state_up = value; }
|
||||
}
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewPort", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("did")]
|
||||
public string DeviceId
|
||||
{
|
||||
get { return _deviceId; }
|
||||
set { _deviceId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewPort newPort = new NewPort();
|
||||
newPort.AdminStateUp = this.AdminStateUp;
|
||||
newPort.DeviceId = this.DeviceId;
|
||||
newPort.Name = this.Name;
|
||||
newPort.NetworkId = this.NetworkId;
|
||||
|
||||
this.RepositoryFactory.CreatePortRepository().SavePort(newPort);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("New", "Router", SupportsShouldProcess = true)]
|
||||
public class NewRouterCmdlet : BasePSCmdlet
|
||||
{
|
||||
private bool _adminStateUp = true;
|
||||
private string _name;
|
||||
private string _extGatewayNetworkId;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewRouter", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("egw")]
|
||||
public string ExternalGateway
|
||||
{
|
||||
get { return _extGatewayNetworkId; }
|
||||
set { _extGatewayNetworkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewRouter", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewRouter", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("asu")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter AdminStateUp
|
||||
{
|
||||
get { return _adminStateUp; }
|
||||
set { _adminStateUp = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewRouter newRouter = new NewRouter();
|
||||
newRouter.Name = this.Name;
|
||||
newRouter.AdminStateUp = this.AdminStateUp;
|
||||
|
||||
if (this.ExternalGateway != null) {
|
||||
newRouter.ExternalGateway.NetworkId = this.ExternalGateway;
|
||||
}
|
||||
|
||||
this.RepositoryFactory.CreateRouterRepository().SaveRouter(newRouter);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("New", "RouterInterface", SupportsShouldProcess = true)]
|
||||
public class NewRouterInterfaceCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _subnetId;
|
||||
private string _portId;
|
||||
private string _routerId;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewRouterInterface", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("rid")]
|
||||
public string RouterId
|
||||
{
|
||||
get { return _routerId; }
|
||||
set { _routerId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewRouterInterface", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("sid")]
|
||||
public string SubnetId
|
||||
{
|
||||
get { return _subnetId; }
|
||||
set { _subnetId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewRouterInterface", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("pid")]
|
||||
public string PortId
|
||||
{
|
||||
get { return _portId; }
|
||||
set { _portId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewRouterInterface newRouterInterface = new NewRouterInterface();
|
||||
newRouterInterface.PortId = this.PortId;
|
||||
newRouterInterface.SubnetId = this._subnetId;
|
||||
newRouterInterface.RouterId = this.RouterId;
|
||||
|
||||
NewRouterInterface response = this.RepositoryFactory.CreateRouterRepository().SaveRouterInterface(newRouterInterface);
|
||||
if (response.SubnetId != null)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("New Router Interface created for Subnet Id " + response.SubnetId);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
else if (response.PortId != null)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("New Router Interface created for Port Id " + response.PortId);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("New", "Subnet", SupportsShouldProcess = true)]
|
||||
public class NewSubnetCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _networkId;
|
||||
private int _IPVersion;
|
||||
private string _cidr;
|
||||
private string[] _allocationPools;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewSubnet", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("nid")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "NewSubnet", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("ipv")]
|
||||
public int IPVersion
|
||||
{
|
||||
get { return _IPVersion; }
|
||||
set { _IPVersion = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "NewSubnet", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("c")]
|
||||
public string Cidr
|
||||
{
|
||||
get { return _cidr; }
|
||||
set { _cidr = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, Mandatory = false, ParameterSetName = "NewSubnet", ValueFromPipelineByPropertyName = true, HelpMessage = "Valid values include")]
|
||||
[Alias("a")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] AllocationPools
|
||||
{
|
||||
get { return _allocationPools; }
|
||||
set { _allocationPools = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewSubnet newSubnet = new NewSubnet();
|
||||
//newSubnet.AllocationPools = this.FormatAllocationPools();
|
||||
newSubnet.Cidr = this.Cidr;
|
||||
newSubnet.IPversion = this.IPVersion;
|
||||
newSubnet.NetworkId = this.NetworkId;
|
||||
|
||||
Subnet subnet = this.RepositoryFactory.CreateSubnetRepository().SaveSubnet(newSubnet);
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("New Subnet " + subnet.Id + " created.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="keyValuePairs"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
public List<AllocationPool> FormatAllocationPools()
|
||||
{
|
||||
if (_allocationPools != null)
|
||||
{
|
||||
List<AllocationPool> allocationPools = new List<AllocationPool>();
|
||||
char[] seperator = { '|' };
|
||||
|
||||
foreach (string ap in _allocationPools)
|
||||
{
|
||||
string[] temp = ap.Split(seperator);
|
||||
AllocationPool allocationPool = new AllocationPool();
|
||||
allocationPool.Start = temp[0];
|
||||
allocationPool.End = temp[1];
|
||||
|
||||
allocationPools.Add(allocationPool);
|
||||
}
|
||||
return allocationPools;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.DataAccess.Networking;
|
||||
using Openstack.Client.Powershell.Providers.Compute;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Compute.Security
|
||||
{
|
||||
[Cmdlet("UnAssign", "IP", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class UnAssignIPCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _serverId;
|
||||
private string _ip;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("ip")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string IpAddress
|
||||
{
|
||||
get { return _ip; }
|
||||
set { _ip = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("sid")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ServerId
|
||||
{
|
||||
get { return _serverId; }
|
||||
set { _serverId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
IFloatingIPRepository repository = new FloatingIPRepository(this.Context.GetRepositoryContext("compute"));
|
||||
UnAssignIPAction assignment = new UnAssignIPAction();
|
||||
assignment.ServerId = this.ServerId;
|
||||
assignment.Ip = this.IpAddress;
|
||||
|
||||
repository.UnAssignIP(assignment);
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Floating IP Address " + this.IpAddress + " has been disassociated with Server : " + assignment.ServerId);
|
||||
Console.WriteLine("");
|
||||
this.UpdateCache<ServerUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Update", "FloatingIP", SupportsShouldProcess = true)]
|
||||
//[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class UpdateFloatingIPCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _portId;
|
||||
private string _floatingIPId;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdateFloatingIP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("fid")]
|
||||
public string FloatingIPId
|
||||
{
|
||||
get { return _floatingIPId; }
|
||||
set { _floatingIPId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdateFloatingIP", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("pid")]
|
||||
public string PortId
|
||||
{
|
||||
get { return _portId; }
|
||||
set { _portId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
UpdateFloatingIP updateIP = new UpdateFloatingIP();
|
||||
updateIP.PortId = this.PortId;
|
||||
|
||||
this.RepositoryFactory.CreateFloatingIPRepository().UpdateFloatingIP(this.FloatingIPId, updateIP);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Update", "Network", SupportsShouldProcess = true)]
|
||||
public class UpdateNetworkCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _networkId;
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdateNetwork", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("id")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdateNetwork", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.NetworkId);
|
||||
UpdateNetwork updateNetwork = new UpdateNetwork();
|
||||
updateNetwork.Name = this.Name;
|
||||
|
||||
this.RepositoryFactory.CreateNetworkRepository().UpdateNetwork(id, updateNetwork);
|
||||
this.UpdateCache();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Update", "Port", SupportsShouldProcess = true)]
|
||||
public class UpdatePortCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _deviceId;
|
||||
private string _portId;
|
||||
|
||||
#region Properties
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdatePort", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("id")]
|
||||
public string PortId
|
||||
{
|
||||
get { return _portId; }
|
||||
set { _portId = value; }
|
||||
}
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdatePort", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("did")]
|
||||
public string DeviceId
|
||||
{
|
||||
get { return _deviceId; }
|
||||
set { _deviceId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
UpdatePort updatePort = new UpdatePort();
|
||||
updatePort.DeviceId = this.DeviceId;
|
||||
|
||||
this.RepositoryFactory.CreatePortRepository().UpdatePort(this.PortId, updatePort);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Update", "Router", SupportsShouldProcess = true)]
|
||||
public class UpdateRouterCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _networkId;
|
||||
private string _routerId;
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdateRouter", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("id")]
|
||||
public string RouterId
|
||||
{
|
||||
get { return _routerId; }
|
||||
set { _routerId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdateRouter", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("nid")]
|
||||
public string NetworkId
|
||||
{
|
||||
get { return _networkId; }
|
||||
set { _networkId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.RouterId);
|
||||
UpdateRouter updateRouter = new UpdateRouter();
|
||||
//updateRouter.ExternalGatewayInfo.NetworkId = this.NetworkId;
|
||||
|
||||
this.RepositoryFactory.CreateRouterRepository().UpdateRouter(id, updateRouter);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Networking;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Networking
|
||||
{
|
||||
[Cmdlet("Update", "Subnet", SupportsShouldProcess = true)]
|
||||
public class UpdateSubnetCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _gatewayIP;
|
||||
private string _name;
|
||||
private string _subnetId;
|
||||
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "UpdateSubnet", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("id")]
|
||||
public string SubnetId
|
||||
{
|
||||
get { return _subnetId; }
|
||||
set { _subnetId = value; }
|
||||
}
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "UpdateSubnet", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("egw")]
|
||||
public string GatewayId
|
||||
{
|
||||
get { return _gatewayIP; }
|
||||
set { _gatewayIP = value; }
|
||||
}
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "UpdateSubnet", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The Id of the Server.")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//============================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//============================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
UpdateSubnet updateSubnet = new UpdateSubnet();
|
||||
updateSubnet.Name = this.Name;
|
||||
updateSubnet.GatewayIP = this.GatewayId;
|
||||
|
||||
this.RepositoryFactory.CreateSubnetRepository().UpdateSubnet(_subnetId, updateSubnet);
|
||||
}
|
||||
}
|
||||
}
|
31
Openstack.Client.Powershell/Cmdlets/Networking/newclasses
Normal file
31
Openstack.Client.Powershell/Cmdlets/Networking/newclasses
Normal file
@ -0,0 +1,31 @@
|
||||
Volume in drive C has no label.
|
||||
Volume Serial Number is EE3F-CECC
|
||||
|
||||
Directory of C:\Projects\HPCloud\CLI\HPCloud.Client.Powershell\Cmdlets\Networking
|
||||
|
||||
08/23/2013 02:45 PM <DIR> .
|
||||
08/23/2013 02:45 PM <DIR> ..
|
||||
07/19/2013 04:04 PM 1,386 AllocateIPCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,351 AssignIPCmdlet.cs
|
||||
07/19/2013 04:04 PM 2,484 DeallocateIPCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,871 DeleteFloatingIPCmdlet.cs
|
||||
08/13/2013 11:01 AM 6,478 DeleteNetworkCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,771 DeletePortCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,786 DeleteRouterCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,491 DeleteRouterInterfaceCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,745 DeleteSubnetCmdlet.cs
|
||||
08/23/2013 02:45 PM 0 newclasses
|
||||
07/30/2013 08:06 PM 3,607 NewFloatingIPCmdlet.cs
|
||||
07/30/2013 08:06 PM 5,864 NewNetworkCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,717 NewPortCmdlet.cs
|
||||
08/10/2013 07:02 PM 4,297 NewRouterCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,797 NewRouterInterfaceCmdlet.cs
|
||||
07/30/2013 08:06 PM 6,609 NewSubnetCmdlet.cs
|
||||
07/30/2013 08:06 PM 4,043 UnAssignIPCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,507 UpdateFloatingIPCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,486 UpdateNetworkCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,370 UpdatePortCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,512 UpdateRouterCmdlet.cs
|
||||
07/30/2013 08:06 PM 3,879 UpdateSubnetCmdlet.cs
|
||||
22 File(s) 89,051 bytes
|
||||
2 Dir(s) 6,555,230,208 bytes free
|
@ -0,0 +1,54 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Storage.CDN
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Get, "CDN", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.CDN)]
|
||||
public class GetCDNCmdlet : BasePSCmdlet
|
||||
{
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The main driver..
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
List<StorageContainer> containers = this.RepositoryFactory.CreateCDNRepository().GetContainers();
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("The following Storage Containers are CDN enabled");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("==============================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("");
|
||||
|
||||
|
||||
this.WriteObject(containers);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using System.IO;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Diagnostics;
|
||||
using Openstack.Common;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Storage.CDN
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "CDN", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.CDN)]
|
||||
public class NewCDNCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _containerName;
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, Mandatory = true, ParameterSetName = "EnableCDN", ValueFromPipelineByPropertyName = true, HelpMessage = "The Name of the Container to enable for CDN access.")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ContainerName
|
||||
{
|
||||
get { return _containerName; }
|
||||
set { _containerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The main driver..
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
List<StorageContainer> containers = this.RepositoryFactory.CreateContainerRepository().GetStorageContainers();
|
||||
if (!containers.Any(c => c.Name == this.ContainerName))
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine ("Storage Container not found. Please specify an existing Storage Container name to pair with this CDN entry.");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
else
|
||||
{
|
||||
string url = this.RepositoryFactory.CreateCDNRepository().SaveContainer(this.ContainerName);
|
||||
if (url != null)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("================================================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("CDN entry created successfully. The URL below can be combined with object names to serve objects through the CDN.");
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.WriteLine("================================================================================================================");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(url);
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using System.IO;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Diagnostics;
|
||||
using Openstack.Common;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Storage.CDN
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "CDN", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.CDN)]
|
||||
public class RemoveCDNCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _containerName;
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Mandatory = true, ParameterSetName = "EnableCDN", ValueFromPipelineByPropertyName = true, HelpMessage = "The Name of the Container to enable for CDN access.")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ContainerName
|
||||
{
|
||||
get { return _containerName; }
|
||||
set { _containerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The main driver..
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().DeleteContainer(this.ContainerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,265 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.DataAccess.Storage;
|
||||
using Openstack.Migrations;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Containers
|
||||
{
|
||||
[Cmdlet("Migrate", "Drive", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class MigrateDriveCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _accessKeyID;
|
||||
private string _secretAccessKeyID;
|
||||
private long _bytesCopied = 0;
|
||||
private int _filesCopied = 0;
|
||||
private long _totalBytesCopied = 0;
|
||||
private int _totalFilesCopied = 0;
|
||||
private string[] _buckets;
|
||||
private string _provider;
|
||||
|
||||
#region Parameters
|
||||
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "localStore", Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = " ")]
|
||||
[ValidateSet("Skydrive", "Dropbox", "S3")]
|
||||
[Alias("p")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Provider
|
||||
{
|
||||
get { return _provider; }
|
||||
set { _provider = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, Mandatory = false, ParameterSetName = "localStore", ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("ak")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string AccessKeyId
|
||||
{
|
||||
get { return _accessKeyID; }
|
||||
set { _accessKeyID = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, ParameterSetName = "localStore", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("sk")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SecretAccessKeyId
|
||||
{
|
||||
get { return _secretAccessKeyID; }
|
||||
set { _secretAccessKeyID = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "localStore", ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("b")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] Buckets
|
||||
{
|
||||
get { return _buckets; }
|
||||
set { _buckets = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void PrintTotals()
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Operation Summary");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Total Files Copied : " + Convert.ToString(_totalFilesCopied));
|
||||
Console.WriteLine("Total Bytes Copied : " + Convert.ToString(_totalBytesCopied));
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void MigrateS3Drive()
|
||||
{
|
||||
//AWSMigration migration = new AWSMigration("AKIAJ6SAONGOGCUKSONA", "0Hi00F7zlFwGi8a45qRhGfW2Btf+FAioZhfD+99K");
|
||||
AWSMigration migration = new AWSMigration(_accessKeyID, _secretAccessKeyID);
|
||||
if (_buckets == null) _buckets = migration.GetBuckets();
|
||||
|
||||
migration.Changed += new Openstack.Migrations.AWSMigration.CopyOperationEventHandler(ListChanged);
|
||||
migration.ContainerCreated += new Openstack.Migrations.AWSMigration.CreateContainerOperationEventHandler(OnCreateContainer);
|
||||
|
||||
Console.WriteLine("");
|
||||
foreach (string bucketName in _buckets)
|
||||
{
|
||||
_bytesCopied = 0;
|
||||
_filesCopied = 0;
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Processing Bucket : " + bucketName);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
migration.MigrateBucket(bucketName);
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Files Copied : " + Convert.ToString(_filesCopied));
|
||||
Console.WriteLine("Bytes Copied : " + Convert.ToString(_bytesCopied));
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("");
|
||||
}
|
||||
|
||||
this.PrintTotals();
|
||||
migration.Changed -= new Openstack.Migrations.AWSMigration.CopyOperationEventHandler(ListChanged);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void MigrateLocalDrive()
|
||||
{
|
||||
LocalStoreMigration migration = new LocalStoreMigration();
|
||||
|
||||
migration.Changed += new Openstack.Migrations.LocalStoreMigration.CopyOperationEventHandler(ListChanged);
|
||||
Console.WriteLine("");
|
||||
|
||||
_bytesCopied = 0;
|
||||
_filesCopied = 0;
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("Migrating local " + _provider + " store.");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.WriteLine("--------------------------------------");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
|
||||
if (_provider == "Dropbox")
|
||||
migration.MigrateLocalStore(StorageProvider.DropBox);
|
||||
else
|
||||
migration.MigrateLocalStore(StorageProvider.SkyDrive);
|
||||
|
||||
this.PrintTotals();
|
||||
migration.Changed -= new Openstack.Migrations.LocalStoreMigration.CopyOperationEventHandler(ListChanged);
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//=========================================================================================
|
||||
private void OnCreateContainer(object sender, CreateContainerOperationInfoEventArgs e)
|
||||
{
|
||||
PSDriveInfo psDriveInfo = new PSDriveInfo(e.ContainerName, this.Drive.Provider, "/", "", null);
|
||||
OSDriveParameters driveParameters = new OSDriveParameters();
|
||||
driveParameters.Settings = this.Settings;
|
||||
try
|
||||
{
|
||||
this.SessionState.Drive.New(new OSDriveInfo(psDriveInfo, driveParameters, this.Context), "local");
|
||||
}
|
||||
catch (SessionStateException ex) { }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
//=========================================================================================
|
||||
private void ListChanged(object sender, CopyOperationInfoEventArgs e)
|
||||
{
|
||||
if (e.ExceptionMessage == null)
|
||||
{
|
||||
if (e.Filename != null || e.Filename != string.Empty)
|
||||
{
|
||||
Console.WriteLine("Copying file " + e.Filename);
|
||||
_bytesCopied = _bytesCopied + e.BytesCopied;
|
||||
++_filesCopied;
|
||||
_totalBytesCopied = _totalBytesCopied + e.BytesCopied;
|
||||
++_totalFilesCopied;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Error : " + e.ExceptionMessage);
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (_provider == "S3")
|
||||
{
|
||||
if (_accessKeyID == null || _secretAccessKeyID == null)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Please supply both Secret key and Access key parameters to migrate your S3 Buckets.");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
this.MigrateS3Drive();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MigrateS3Drive();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MigrateLocalDrive();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,306 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Management.Automation.Host;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using System;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Containers
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "Container", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class NewContainerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _sharedContainerURL = null;
|
||||
private bool _forceSave = false;
|
||||
private bool _createCDN = false;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "SaveSharedStorageContainer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("url")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SharedContainerURL
|
||||
{
|
||||
get { return _sharedContainerURL; }
|
||||
set { _sharedContainerURL = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "SavestorageContainer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "SavestorageContainer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("cdn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter CreateCDN
|
||||
{
|
||||
get { return _createCDN; }
|
||||
set { _createCDN = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, ParameterSetName = "SavestorageContainer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("f")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter Force
|
||||
{
|
||||
get { return _forceSave; }
|
||||
set { _forceSave = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void CreateStorageContainer(StorageContainer storageContainer)
|
||||
{
|
||||
IContainerRepository repository = this.RepositoryFactory.CreateContainerRepository();
|
||||
bool skipAdd = false;
|
||||
|
||||
// These should be transacted somehow..
|
||||
|
||||
repository.SaveContainer(storageContainer);
|
||||
|
||||
Collection<PSDriveInfo> drives = this.SessionState.Drive.GetAllForProvider("OS-Storage");
|
||||
foreach (PSDriveInfo drive in drives)
|
||||
{
|
||||
if (drive.Name == storageContainer.Name)
|
||||
{
|
||||
skipAdd = true;
|
||||
}
|
||||
}
|
||||
if (!skipAdd)
|
||||
{
|
||||
PSDriveInfo psDriveInfo = new PSDriveInfo(storageContainer.Name, this.GetStorageProvider(drives), "/", "", null);
|
||||
OSDriveParameters driveParameters = new OSDriveParameters();
|
||||
driveParameters.Settings = this.Settings;
|
||||
|
||||
this.SessionState.Drive.New(new OSDriveInfo(psDriveInfo, driveParameters, this.Context), "local");
|
||||
}
|
||||
|
||||
this.WriteObject(" ");
|
||||
this.WriteObject("Storage Container " + _name + " created successfully.");
|
||||
this.WriteObject(" ");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private bool IsDuplicateContainer(string container)
|
||||
{
|
||||
List<StorageContainer> containers = this.RepositoryFactory.CreateContainerRepository().GetStorageContainers();
|
||||
return containers.Where(cn => cn.Name == container).Any();
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void SaveNewContainer()
|
||||
{
|
||||
StorageContainer storageContainer = new StorageContainer();
|
||||
storageContainer.Name = _name;
|
||||
|
||||
if (IsDuplicateContainer(this.Name))
|
||||
{
|
||||
this.WriteObject(" ");
|
||||
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), this.Context.Forecolor);
|
||||
Console.WriteLine("Storage Container " + _name + " already exist.");
|
||||
Console.WriteLine("");
|
||||
return;
|
||||
}
|
||||
|
||||
if (storageContainer.ValidateBasicRequirements() == false)
|
||||
{
|
||||
this.WriteObject(" ");
|
||||
this.WriteObject("Storage Container " + _name + " has failed basic validation rules. Please ensure that the name doesn't include a forward slash, single or double quote character and is less than 255 characters in length.");
|
||||
return;
|
||||
}
|
||||
else if (storageContainer.ValidateExtendedRequirements() == false)
|
||||
{
|
||||
|
||||
// Check to see if the Container already exist.. Or not maybe it does z
|
||||
|
||||
if (_forceSave)
|
||||
{
|
||||
this.CreateStorageContainer(storageContainer);
|
||||
if (_createCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().SaveContainer(_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>();
|
||||
choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
if (this.Host.UI.PromptForChoice("Confirm Action", "Specified Storage Container name is not a valid virtalhost name, continue anyway?", choices, 0) == 0)
|
||||
{
|
||||
this.CreateStorageContainer(storageContainer);
|
||||
if (_createCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().SaveContainer(_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CreateStorageContainer(storageContainer);
|
||||
if (_createCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().SaveContainer(_name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void CreateSharedDrive(string drivePath)
|
||||
{
|
||||
string driveName = Path.GetFileName(drivePath);
|
||||
Collection<PSDriveInfo> drives = this.SessionState.Drive.GetAllForProvider("OS-Storage");
|
||||
PSDriveInfo psDriveInfo = new PSDriveInfo(driveName, this.GetStorageProvider(drives), "/", "", null);
|
||||
OSDriveParameters driveParameters = new OSDriveParameters();
|
||||
driveParameters.Settings = this.Settings;
|
||||
OSDriveInfo newDrive = new OSDriveInfo(psDriveInfo, driveParameters, this.Context);
|
||||
newDrive.SharePath = drivePath;
|
||||
|
||||
this.SessionState.Drive.New(newDrive, "local");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void SaveSharedContainer()
|
||||
{
|
||||
if (this.IsUrlValid(this.SharedContainerURL))
|
||||
{
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
XElement newDrive = new XElement("SharedContainer");
|
||||
newDrive.Add(new XAttribute("url", this.SharedContainerURL));
|
||||
|
||||
doc.Element("configuration").Element("appSettings").Element("StorageManagement").Element("SharedContainers").Add(newDrive);
|
||||
doc.Save(configFilePath);
|
||||
this.CreateSharedDrive(this.SharedContainerURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid URL supplied");
|
||||
}
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private ProviderInfo GetStorageProvider(Collection<PSDriveInfo> drives)
|
||||
{
|
||||
foreach (PSDriveInfo drive in drives)
|
||||
{
|
||||
if (drive.Provider.Name == "OS-Storage")
|
||||
{
|
||||
return drive.Provider;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="smtpHost"></param>
|
||||
/// <returns></returns>
|
||||
//=========================================================================================
|
||||
private bool IsUrlValid(string smtpHost)
|
||||
{
|
||||
return true;
|
||||
bool br = false;
|
||||
try
|
||||
{
|
||||
IPHostEntry ipHost = Dns.GetHostEntry(smtpHost);
|
||||
br = true;
|
||||
}
|
||||
catch (SocketException se)
|
||||
{
|
||||
br = false;
|
||||
}
|
||||
return br;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// qqqqqqqqqqq
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (_sharedContainerURL != null)
|
||||
{
|
||||
this.SaveSharedContainer();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SaveNewContainer();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,274 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Management.Automation.Host;
|
||||
using Openstack.Common.Properties;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Containers
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Container", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class RemoveContainerCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private SwitchParameter _forceDelete = false;
|
||||
private SwitchParameter _reset = false;
|
||||
private bool _removeCDN = false;
|
||||
|
||||
#region Properties
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "RemoveContainer", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("cdn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter RemoveCDN
|
||||
{
|
||||
get { return _removeCDN; }
|
||||
set { _removeCDN = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "RemoveContainer", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
[Alias("n")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = false, ParameterSetName = "RemoveContainer", ValueFromPipelineByPropertyName = true, HelpMessage = "s")]
|
||||
[Alias("fd")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public SwitchParameter ForceDelete
|
||||
{
|
||||
get { return _forceDelete; }
|
||||
set { _forceDelete = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//======================================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the Container to trash</param>
|
||||
//======================================================================================================================
|
||||
private bool DeleteContainerContents(StorageContainer storageContainer)
|
||||
{
|
||||
List<StorageObject> containerItems = null;
|
||||
IStorageObjectRepository repository = this.RepositoryFactory.CreateStorageObjectRepository();
|
||||
|
||||
try
|
||||
{
|
||||
containerItems = repository.GetStorageObjects(storageContainer.Name, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Define our Action delegate which will delete the element in the list..
|
||||
|
||||
if (containerItems != null)
|
||||
{
|
||||
Action<StorageObject> deleteStorageObjectAction = delegate(StorageObject storageObject)
|
||||
{
|
||||
StoragePath targetPath = this.CreateStoragePath(storageObject.Key);
|
||||
repository.DeleteStorageObject(targetPath.AbsoluteURI);
|
||||
};
|
||||
|
||||
// Remove all Files contained within the storageContainer...
|
||||
|
||||
if (containerItems != null)
|
||||
{
|
||||
containerItems.ForEach(deleteStorageObjectAction);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void DeleteAllContainers()
|
||||
{
|
||||
IContainerRepository repository = this.RepositoryFactory.CreateContainerRepository();
|
||||
List<StorageContainer> containers = repository.GetStorageContainers();
|
||||
|
||||
foreach (StorageContainer container in containers)
|
||||
{
|
||||
try
|
||||
{
|
||||
// repository.DeleteContainer(container);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
//======================================================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
//======================================================================================================================
|
||||
private string GetContainerName(string url)
|
||||
{
|
||||
string[] elements = url.Split('/');
|
||||
return elements[elements.Length - 1];
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private bool RemoveSharedContainer()
|
||||
{
|
||||
bool entryRemoved = false;
|
||||
List<StorageContainer> results = new List<StorageContainer>();
|
||||
string configFilePath = this.ConfigFilePath;
|
||||
XDocument doc = XDocument.Load(configFilePath);
|
||||
IEnumerable<XElement> containers = doc.XPathSelectElements("//SharedContainer");
|
||||
|
||||
foreach (XElement element in containers)
|
||||
{
|
||||
string sharedPath = (string)element.Attribute("url");
|
||||
if (this.GetContainerName(sharedPath) == this.Name)
|
||||
{
|
||||
element.Remove();
|
||||
entryRemoved = true;
|
||||
}
|
||||
}
|
||||
doc.Save(configFilePath);
|
||||
this.SessionState.Drive.Remove(this.Name, true, "local");
|
||||
if (this.Name == this.SessionState.Drive.Current.Name)
|
||||
this.SessionState.InvokeCommand.InvokeScript("cd c:");
|
||||
|
||||
return entryRemoved;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (RemoveSharedContainer() == true) return;
|
||||
|
||||
Collection<ChoiceDescription> choices = new Collection<ChoiceDescription>();
|
||||
choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
if (_forceDelete == false)
|
||||
{
|
||||
if (this.Host.UI.PromptForChoice("Confirm Action", "You are about to delete an entire Container. Are you sure about this?", choices, 0) == 0)
|
||||
{
|
||||
IContainerRepository repository = this.RepositoryFactory.CreateContainerRepository();
|
||||
StorageContainer storageContainer = new StorageContainer();
|
||||
storageContainer.Name = _name;
|
||||
|
||||
try
|
||||
{
|
||||
repository.DeleteContainer(storageContainer);
|
||||
if (_removeCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().DeleteContainer(_name);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// The container has content and the operation is in conflict. Destroy all contents then retry (the User knows what's up).
|
||||
|
||||
if (ex.Message == "Unknown Repository Error")
|
||||
{
|
||||
if (DeleteContainerContents(storageContainer))
|
||||
{
|
||||
repository.DeleteContainer(storageContainer);
|
||||
if (_removeCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().DeleteContainer(_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
this.SessionState.Drive.Remove(storageContainer.Name, true, "local");
|
||||
if (storageContainer.Name == this.SessionState.Drive.Current.Name)
|
||||
this.SessionState.InvokeCommand.InvokeScript("cd c:");
|
||||
}
|
||||
catch (DriveNotFoundException ex) { }
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IContainerRepository repository = this.RepositoryFactory.CreateContainerRepository();
|
||||
StorageContainer storageContainer = new StorageContainer();
|
||||
storageContainer.Name = _name;
|
||||
|
||||
try
|
||||
{
|
||||
repository.DeleteContainer(storageContainer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// The container has content and the operation is in conflict. Destroy all contents then retry (the User knows what's up).
|
||||
|
||||
if (ex.Message == "Unknown Repository Error")
|
||||
{
|
||||
if (DeleteContainerContents(storageContainer))
|
||||
{
|
||||
repository.DeleteContainer(storageContainer);
|
||||
if (_removeCDN)
|
||||
{
|
||||
this.RepositoryFactory.CreateCDNRepository().DeleteContainer(_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.Domain;
|
||||
using System.IO;
|
||||
using Openstack.Client.Powershell.Providers.Storage;
|
||||
using Openstack.Common;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Objects.Domain.Storage;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Containers
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Set, "Scope", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
public class SetScopeCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _containerName;
|
||||
private ContainerScope _scope;
|
||||
private string _permission;
|
||||
private string[] _users;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The Container name.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "scp1", Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = @"The Container name.")]
|
||||
[Alias("cn")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string ContainerName
|
||||
{
|
||||
get { return _containerName; }
|
||||
set { _containerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The Container name.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "scp2", Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = @"The Container name.")]
|
||||
[Alias("c")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Name
|
||||
{
|
||||
get { return _containerName; }
|
||||
set { _containerName = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "scp2", Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Containers Scope.")]
|
||||
[ValidateSet("Public", "Private")]
|
||||
[Alias("s")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public ContainerScope Scope
|
||||
{
|
||||
get { return _scope; }
|
||||
set { _scope = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "scp1", Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "c")]
|
||||
[Alias("u")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string[] Users
|
||||
{
|
||||
get { return _users; }
|
||||
set { _users = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// The location of the file to set permissions on.
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(ParameterSetName = "scp1", Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "v")]
|
||||
[ValidateSet("Read", "Write", "ReadWrite")]
|
||||
[Alias("p")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Permission
|
||||
{
|
||||
get { return _permission; }
|
||||
set { _permission = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="permission"></param>
|
||||
/// <returns></returns>
|
||||
//========================================================================================
|
||||
private ContainerPermissions GetPermission(string permission)
|
||||
{
|
||||
switch (permission)
|
||||
{
|
||||
case ("Read") :
|
||||
return ContainerPermissions.PublicRead;
|
||||
|
||||
case ("ReadWrite"):
|
||||
return ContainerPermissions.PublicReadWrite;
|
||||
|
||||
case ("Write"):
|
||||
return ContainerPermissions.PublicWrite;
|
||||
|
||||
default :
|
||||
return ContainerPermissions.PublicRead;
|
||||
}
|
||||
}
|
||||
//========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="users"></param>
|
||||
/// <returns></returns>
|
||||
//========================================================================================
|
||||
private List<string> GetUsers(string[] users)
|
||||
{
|
||||
List<string> userList = new List<string>();
|
||||
foreach (string user in users) {
|
||||
userList.Add("*:" + user);
|
||||
}
|
||||
return userList;
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
private void ShowUrl()
|
||||
{
|
||||
StoragePath path = this.CreateStoragePath(String.Empty);
|
||||
path.Volume = _containerName;
|
||||
string uri = path.AbsoluteURI.Remove(path.AbsoluteURI.LastIndexOf('/'));
|
||||
|
||||
if (this.Settings.PasteGetURIResultsToClipboard)
|
||||
OutClipboard.SetText(uri);
|
||||
|
||||
WriteObject("");
|
||||
WriteObject("Shared Container located at : " + uri);
|
||||
WriteObject("");
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
IContainerRepository repository = this.RepositoryFactory.CreateContainerRepository();
|
||||
|
||||
if (this.ParameterSetName == "scp2")
|
||||
{
|
||||
repository.SetScope(_containerName, _scope);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerACL acl = new ContainerACL();
|
||||
acl.Permission = this.GetPermission(_permission);
|
||||
acl.Users = this.GetUsers(_users);
|
||||
repository.SetScope(_containerName, acl);
|
||||
this.ShowUrl();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,260 @@
|
||||
///* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//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 Openstack.Objects;
|
||||
//using Openstack.Objects.Domain;
|
||||
//using Openstack.Client.Powershell.Providers.Storage;
|
||||
//using System;
|
||||
//using Openstack.Objects.DataAccess.Storage;
|
||||
//using Openstack.Client.Powershell.Providers.Common;
|
||||
//using System.IO;
|
||||
|
||||
//namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
//{
|
||||
// [Cmdlet(VerbsCommon.Copy, "Item", SupportsShouldProcess = true)]
|
||||
// [RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
// public class CopyItemCmdlet : BasePSCmdlet
|
||||
// {
|
||||
// public const string cDelimiter = "/";
|
||||
// const string cFolderMarker = "folder.txt";
|
||||
// private string _sourcePath;
|
||||
// private string _targetPath;
|
||||
// private SwitchParameter _recursive;
|
||||
// private long _bytesCopied = 0;
|
||||
// private int _filesCopied = 0;
|
||||
// private long _totalBytesCopied = 0;
|
||||
// private int _totalFilesCopied = 0;
|
||||
|
||||
// #region Ctors
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// public CopyItemCmdlet()
|
||||
// { }
|
||||
// #endregion
|
||||
// #region Parameters
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Mandatory = false, ParameterSetName = "aa", ValueFromPipelineByPropertyName = true, HelpMessage = "oih")]
|
||||
// [Alias("recurse")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public SwitchParameter Recursive
|
||||
// {
|
||||
// get { return _recursive; }
|
||||
// set { _recursive = value; }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The location of the file to copy.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = "aa", ValueFromPipeline = true, HelpMessage = "Help Text")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public string SourcePath
|
||||
// {
|
||||
// get { return _sourcePath; }
|
||||
// set { _sourcePath = value; }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The destination of the file to copy.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 2, Mandatory = false, ValueFromPipeline = true, ParameterSetName = "aa", ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public string TargetPath
|
||||
// {
|
||||
// get { return _targetPath; }
|
||||
// set
|
||||
// {
|
||||
// if (value.StartsWith(@"/") || value.StartsWith(@"\"))
|
||||
// {
|
||||
// _targetPath = value.Substring(1, _targetPath.Length - 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _targetPath = value;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// #region Properties
|
||||
////==================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////==================================================================================================
|
||||
// private string StorageServiceURL
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// if (((OSDriveInfo)this.Drive).SharePath == null)
|
||||
// return this.Context.ServiceCatalog.GetService("object-store").Url;
|
||||
// else
|
||||
// //return ((OSDriveInfo)this.Drive).SharePath;
|
||||
// return ((OSDriveInfo)this.Drive).SharePath.Replace(this.Drive.Name, string.Empty);
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// #region Methods
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// private void PrintTotals()
|
||||
// {
|
||||
// Console.ForegroundColor = ConsoleColor.Gray;
|
||||
// Console.WriteLine("");
|
||||
// Console.WriteLine("--------------------------------------");
|
||||
// Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
// Console.WriteLine("Operation Summary");
|
||||
// Console.ForegroundColor = ConsoleColor.Gray;
|
||||
// Console.WriteLine("--------------------------------------");
|
||||
// Console.WriteLine("");
|
||||
// Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
// Console.WriteLine("Total Files Copied : " + Convert.ToString(_totalFilesCopied));
|
||||
// Console.WriteLine("Total Bytes Copied : " + Convert.ToString(_totalBytesCopied));
|
||||
// Console.WriteLine("");
|
||||
// Console.ForegroundColor = ConsoleColor.Green;
|
||||
|
||||
// }
|
||||
////=================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param ---name="path"></param>
|
||||
///// <returns></returns>
|
||||
////=================================================================================================
|
||||
// private bool IsFolderPath(string path)
|
||||
// {
|
||||
// if (path.EndsWith(@"\") || path.EndsWith("/"))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
////=================================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="sourcePath"></param>
|
||||
///// <param name="targetPath"></param>
|
||||
///// <returns></returns>
|
||||
////=================================================================================================
|
||||
// private StoragePath CreateValidTargetPath(StoragePath sourcePath, string targetPath)
|
||||
// {
|
||||
// if (targetPath == null && sourcePath != null)
|
||||
// {
|
||||
// // The user has supplied a source but no target at all (we should use the current folder)
|
||||
|
||||
// return new StoragePath(this.StorageServiceURL + cDelimiter + this.Drive.Name + cDelimiter + this.Drive.CurrentLocation + cDelimiter + sourcePath.FileName);
|
||||
// }
|
||||
// else if (System.IO.Path.GetFileName(targetPath) == "" && this.IsFolderPath(targetPath) == true)
|
||||
// {
|
||||
// // The user supplied a target path but no filename (we will use the Source filename)
|
||||
|
||||
// return this.CreateStoragePath(targetPath + sourcePath.FileName);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // The user has supplied a target path and target filename so create the StoragePath against that...
|
||||
|
||||
// return this.CreateStoragePath(targetPath);
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
////=========================================================================================
|
||||
// private void ListChanged(object sender, CopyOperationInfoEventArgs e)
|
||||
// {
|
||||
// if (e.ExceptionMessage == null)
|
||||
// {
|
||||
// if (e.Filename != null || e.Filename != string.Empty)
|
||||
// {
|
||||
// Console.WriteLine("Copying file " + e.Filename);
|
||||
// _bytesCopied = _bytesCopied + e.BytesCopied;
|
||||
// ++_filesCopied;
|
||||
// _totalBytesCopied = _totalBytesCopied + e.BytesCopied;
|
||||
// ++_totalFilesCopied;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.ForegroundColor = ConsoleColor.Red;
|
||||
// Console.WriteLine("Error : " + e.ExceptionMessage);
|
||||
// Console.ForegroundColor = ConsoleColor.Green;
|
||||
// }
|
||||
// }
|
||||
////=================================================================================================
|
||||
///// <summary>
|
||||
///// Direct the operation based on the types of paths supplied for both target and source locations.
|
||||
///// </summary>
|
||||
////=================================================================================================
|
||||
// private void ProcessNonQueuedCopy()
|
||||
// {
|
||||
// StoragePath sourcePath = this.CreateStoragePath(this.SourcePath);
|
||||
// StoragePath targetPath = this.CreateValidTargetPath(sourcePath, this.TargetPath);
|
||||
// IStorageObjectRepository repository = this.RepositoryFactory.CreateStorageObjectRepository();
|
||||
|
||||
|
||||
// if (sourcePath.PathType == Openstack.Common.PathType.Local && targetPath.PathType == Openstack.Common.PathType.Remote)
|
||||
// {
|
||||
// long lastSegment = repository.GetLastSegmentId(targetPath);
|
||||
// if (lastSegment != 0)
|
||||
// {
|
||||
// Console.WriteLine("");
|
||||
// Console.WriteLine(" You've already uploaded a portion of this file.");
|
||||
// Console.WriteLine(" Would you like to resume your previous upload? [Y/N]");
|
||||
// ConsoleKeyInfo response = Console.ReadKey();
|
||||
// if (response.Key != ConsoleKey.Y)
|
||||
// {
|
||||
// repository.DeleteStorageObject(targetPath.AbsoluteURI + @"_temp\");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// ((StorageObjectRepository)repository).Changed += new StorageObjectRepository.CopyOperationCompleteEventHandler(ListChanged);
|
||||
// Console.WriteLine("");
|
||||
// repository.Copy(sourcePath.AbsoluteURI, targetPath.AbsoluteURI, true);
|
||||
// this.PrintTotals();
|
||||
// ((StorageObjectRepository)repository).Changed -= new StorageObjectRepository.CopyOperationCompleteEventHandler(ListChanged);
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The main driver..
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected override void ProcessRecord()
|
||||
// {
|
||||
// OSDriveInfo drive = this.SessionState.Drive.Current as OSDriveInfo;
|
||||
// this.ProcessNonQueuedCopy();
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
@ -0,0 +1,194 @@
|
||||
///* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//============================================================================ */
|
||||
//using System;
|
||||
//using System.Management.Automation;
|
||||
//using Openstack.Client.Powershell.Providers.Common;
|
||||
//using System.Security.Cryptography;
|
||||
//using System.Text;
|
||||
//using System.Web;
|
||||
//using Openstack.Objects.Domain;
|
||||
|
||||
//namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
//{
|
||||
// [Cmdlet(VerbsCommon.Get, "URI", SupportsShouldProcess = true)]
|
||||
// [RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
// public class GetURICmdlet : BasePSCmdlet
|
||||
// {
|
||||
// private string _sourcePath;
|
||||
// private int _daysValid = 0;
|
||||
// private int _secondsValid = 0;
|
||||
|
||||
// #region Parameters
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The location of the file to set permissions on.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 0, ParameterSetName = "qA", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text is here")]
|
||||
// [Alias("s")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public string SourcePath
|
||||
// {
|
||||
// get { return _sourcePath; }
|
||||
// set { _sourcePath = value; }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The location of the file to set permissions on.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 1, ParameterSetName = "qA", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text is here")]
|
||||
// [Alias("dv")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public int DaysValid
|
||||
// {
|
||||
// get { return _daysValid; }
|
||||
// set { _daysValid = value; }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// The location of the file to set permissions on.
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 2, ParameterSetName = "qA", Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text is here")]
|
||||
// [Alias("sv")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// public int SecondsValid
|
||||
// {
|
||||
// get { return _secondsValid; }
|
||||
// set { _secondsValid = value; }
|
||||
// }
|
||||
// #endregion
|
||||
// #region Methods
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// private string ConvertSignatureToHex(string signature)
|
||||
// {
|
||||
// string hexaHash = "";
|
||||
// foreach (byte b in signature)
|
||||
// {
|
||||
// hexaHash += String.Format("{0:x2}", b);
|
||||
// }
|
||||
// return hexaHash;
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// private string GenerateTempUrl(string signatureString)
|
||||
// {
|
||||
// var hmac = new HMACSHA1(Encoding.UTF8.GetBytes(this.Settings.Username));
|
||||
// var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(signatureString));
|
||||
// return BitConverter.ToString(hash).Replace("-", "").ToLower();
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// private string GetFormattedUri(StoragePath path)
|
||||
// {
|
||||
// string[] elements = this.CreateStoragePath(this.SourcePath).ToString().Split('/');
|
||||
// return String.Join("/", elements).Replace(elements[0] + "/" + elements[1] + "/" + elements[2], string.Empty);
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// public long GetEpochTime()
|
||||
// {
|
||||
// long baseTicks = 621355968000000000;
|
||||
// long tickResolution = 10000000;
|
||||
// long epoch = (DateTime.Now.ToUniversalTime().Ticks - baseTicks) / tickResolution;
|
||||
|
||||
// return epoch;
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
////=========================================================================================
|
||||
// private long GetExpirationInSeconds()
|
||||
// {
|
||||
// if (_daysValid != 0)
|
||||
// {
|
||||
// return GetEpochTime() + (86400 * _daysValid);
|
||||
// }
|
||||
// else if (_secondsValid != 0)
|
||||
// {
|
||||
// return GetEpochTime() + _secondsValid;
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// private void GetTempUrl()
|
||||
// {
|
||||
// string uri = null;
|
||||
// long expiration = this.GetExpirationInSeconds();
|
||||
// string totalSeconds = Convert.ToString(expiration);
|
||||
// StoragePath fullPath = this.CreateStoragePath(this.SourcePath);
|
||||
// uri = this.GetFormattedUri(fullPath);
|
||||
// string signedString = this.GenerateTempUrl("GET" + "\n" + totalSeconds + "\n" + uri);
|
||||
// string signature = HttpUtility.UrlEncode(this.Settings.DefaultTenantId + ":" + this.Settings.Username + ":" + signedString);
|
||||
// string tempUrl = fullPath.BasePath + "?temp_url_sig=" + signature + "&temp_url_expires=" + totalSeconds;
|
||||
|
||||
// WriteObject("");
|
||||
// WriteObject("Object located at : " + tempUrl);
|
||||
// WriteObject("Url Expiration Date : " + DateTime.Now.AddDays(_daysValid).ToShortDateString() + ". [" + _daysValid + @" day(s) \ " + expiration + " seconds.]");
|
||||
// WriteObject("");
|
||||
|
||||
// if (this.Settings.PasteGetURIResultsToClipboard)
|
||||
// OutClipboard.SetText(tempUrl);
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
///// 1347472640
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected override void ProcessRecord()
|
||||
// {
|
||||
// if (_daysValid != 0 || _secondsValid != 0)
|
||||
// {
|
||||
// this.GetTempUrl();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string uri = this.CreateStoragePath(this.SourcePath).ToString();
|
||||
|
||||
// if (this.Settings.PasteGetURIResultsToClipboard)
|
||||
// OutClipboard.SetText(uri);
|
||||
|
||||
// WriteObject("");
|
||||
// WriteObject("Object located at : " + uri);
|
||||
// WriteObject("");
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
//}
|
@ -0,0 +1,133 @@
|
||||
///* ============================================================================
|
||||
//Copyright 2014 Hewlett Packard
|
||||
|
||||
//Licensed under the Apache License, Version 2.0 (the "License");
|
||||
//you may not use this file except in compliance with the License.
|
||||
//You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
//Unless required by applicable law or agreed to in writing, software
|
||||
//distributed under the License is distributed on an "AS IS" BASIS,
|
||||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//See the License for the specific language governing permissions and
|
||||
//limitations under the License.
|
||||
//============================================================================ */
|
||||
//using System;
|
||||
//using System.Management.Automation;
|
||||
//using Openstack.Objects.DataAccess;
|
||||
//using Openstack.Objects.Domain;
|
||||
//using Openstack.Client.Powershell.Providers.Storage;
|
||||
//using Openstack.Common;
|
||||
//using System.Management.Automation.Host;
|
||||
//using System.Collections.ObjectModel;
|
||||
//using System.Diagnostics.Contracts;
|
||||
//using Openstack.Client.Powershell.Providers.Common;
|
||||
|
||||
//namespace Openstack.Client.Powershell.Cmdlets.Common
|
||||
//{
|
||||
// [Cmdlet(VerbsCommon.Remove, "Item", SupportsShouldProcess = true)]
|
||||
// [RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.ObjectStorage)]
|
||||
// public class RemoveItemCmdlet : BasePSCmdlet
|
||||
// {
|
||||
// public const string cDelimiter = "/";
|
||||
// private string _targetPath;
|
||||
|
||||
// #region Parameters
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// [Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Help Text")]
|
||||
// [ValidateNotNullOrEmpty]
|
||||
// [Alias("t")]
|
||||
// public string TargetPath
|
||||
// {
|
||||
// get { return _targetPath; }
|
||||
// set { _targetPath = value; }
|
||||
// }
|
||||
// #endregion
|
||||
// #region Methods
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// private void DeleteFolder(StoragePath targetPath, bool recurse)
|
||||
// {
|
||||
// Contract.Requires(targetPath.IsFolderPathOnly);
|
||||
|
||||
// string confirmationMsg;
|
||||
// IStorageObjectRepository repository = null;
|
||||
// OSDriveInfo kvsDrive = null;
|
||||
// Collection<ChoiceDescription> choices;
|
||||
|
||||
// #if (DEBUG)
|
||||
|
||||
// // We can't prompt for confirmation as this jacks up the unit test..
|
||||
|
||||
// repository = this.RepositoryFactory.CreateStorageObjectRepository();
|
||||
// repository.DeleteFolder(targetPath.AbsoluteURI + "/");
|
||||
// kvsDrive = (OSDriveInfo)this.SessionState.Drive.Current;
|
||||
|
||||
// if (kvsDrive.PathCache.Exists(p => p == targetPath.Path))
|
||||
// {
|
||||
// kvsDrive.PathCache.Remove(targetPath.Path);
|
||||
// }
|
||||
// return;
|
||||
|
||||
// #endif
|
||||
|
||||
// choices = new Collection<ChoiceDescription>();
|
||||
// choices.Add(new ChoiceDescription("Y", "Yes"));
|
||||
// choices.Add(new ChoiceDescription("N", "No"));
|
||||
|
||||
// if (recurse) confirmationMsg = "You are about to delete an entire folder and all of its decendant folders. Are you sure about this?";
|
||||
// else confirmationMsg = "You are about to delete a folder and its Storage Objects Are you sure about this?";
|
||||
|
||||
// if (this.Host.UI.PromptForChoice("Confirmation Required." , confirmationMsg, choices, 0) == 0)
|
||||
// {
|
||||
// repository = this.RepositoryFactory.CreateStorageObjectRepository();
|
||||
// repository.DeleteFolder(targetPath.AbsoluteURI);
|
||||
|
||||
// kvsDrive = (OSDriveInfo)this.SessionState.Drive.Current;
|
||||
|
||||
// if (kvsDrive.PathCache.Exists(p => p == targetPath.Path))
|
||||
// {
|
||||
// kvsDrive.PathCache.Remove(targetPath.Path);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
////=========================================================================================
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
////=========================================================================================
|
||||
// protected override void ProcessRecord()
|
||||
// {
|
||||
// Contract.Requires(this.Drive != null);
|
||||
// StoragePath targetPath = this.CreateStoragePath(this.TargetPath);
|
||||
|
||||
// if (targetPath.IsFolderPathOnly)
|
||||
// {
|
||||
// this.DeleteFolder(targetPath, true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// this.RepositoryFactory.CreateStorageObjectRepository().DeleteStorageObject(targetPath.AbsoluteURI);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine("");
|
||||
// Console.WriteLine(ex.Message);
|
||||
// Console.WriteLine("");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
// }
|
||||
|
176
Openstack.Client.Powershell/Cmdlets/Security/AddRuleCmdlet.cs
Normal file
176
Openstack.Client.Powershell/Cmdlets/Security/AddRuleCmdlet.cs
Normal file
@ -0,0 +1,176 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Collections;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Security
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Add, "Rule", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class AddRuleCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _direction;
|
||||
private string _etherType;
|
||||
private string _portRangeMax;
|
||||
private string _portRangeMin;
|
||||
private string _protocol;
|
||||
private string _remoteGroupId;
|
||||
private string _remoteIPPrefix;
|
||||
private string _securityGroupId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
//add-rule -ipr "iprTest" -IP "100.0.0.0" -tp "80" -fp "81" -sg "2302"
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, Mandatory = true, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Direction
|
||||
{
|
||||
get { return _direction; }
|
||||
set { _direction = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
// add-rule -ipr "iprTest" -IP "tcp" -tp "81" -fp "80"
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 4, Mandatory = false, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("et")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string EtherType
|
||||
{
|
||||
get { return _etherType; }
|
||||
set { _etherType = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 2, Mandatory = true, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("max")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string PortRangeMax
|
||||
{
|
||||
get { return _portRangeMax; }
|
||||
set { _portRangeMax = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("min")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string PortRangeMin
|
||||
{
|
||||
get { return _portRangeMin; }
|
||||
set { _portRangeMin = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 3, Mandatory = true, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("p")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Protocol
|
||||
{
|
||||
get { return _protocol; }
|
||||
set { _protocol = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
//add-rule -ipr "iprTest" -IP "100.0.0.0" -tp "80" -fp "81" -sg "2302"
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, Mandatory = true, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("sid")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SecurityGroupId
|
||||
{
|
||||
get { return _securityGroupId; }
|
||||
set { _securityGroupId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
//add-rule -ipr "iprTest" -IP "100.0.0.0" -tp "80" -fp "81" -sg "2302"
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, Mandatory = false, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("rgid")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string RemoteGroupId
|
||||
{
|
||||
get { return _remoteGroupId; }
|
||||
set { _remoteGroupId = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
//add-rule -ipr "iprTest" -IP "100.0.0.0" -tp "80" -fp "81" -sg "2302"
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 5, Mandatory = false, ParameterSetName = "AddRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("ripp")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string RemoteIPPrefix
|
||||
{
|
||||
get { return _remoteIPPrefix; }
|
||||
set { _remoteIPPrefix = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewSecurityGroupRule rule = new NewSecurityGroupRule();
|
||||
rule.PortRangeMin = this.PortRangeMin;
|
||||
rule.PortRangeMax = this.PortRangeMax;
|
||||
rule.Protocol = this.Protocol;
|
||||
rule.SecurityGroupId = this.SecurityGroupId;
|
||||
rule.RemoteGroupId = this.RemoteGroupId;
|
||||
rule.RemoteIPPrefix = this.RemoteIPPrefix;
|
||||
rule.EtherType = this.EtherType;
|
||||
rule.Direction = this.Direction;
|
||||
|
||||
SecurityGroupRule result = this.RepositoryFactory.CreateSecurityRepository().SaveSecurityRule(rule);
|
||||
this.UpdateCache<SecurityGroupUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Security
|
||||
{
|
||||
[Cmdlet(VerbsCommon.New, "SecurityGroup", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class NewSecurityGroupCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _name;
|
||||
private string _description;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "NewSecurityGroup", ValueFromPipelineByPropertyName = true, HelpMessage = "ww")]
|
||||
[Alias("d")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string Description
|
||||
{
|
||||
get { return _description; }
|
||||
set { _description = value; }
|
||||
}
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 0, ParameterSetName = "NewSecurityGroup", Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "www")]
|
||||
[Alias("n")]
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
NewSecurityGroup newGroup = new NewSecurityGroup();
|
||||
newGroup.Description = this.Description;
|
||||
newGroup.Name = this.Name;
|
||||
|
||||
SecurityGroup securityGroup = this.RepositoryFactory.CreateSecurityRepository().SaveSecurityGroup(newGroup);
|
||||
this.UpdateCache<SecurityGroupsUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
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 Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Compute;
|
||||
using System.Linq;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using System.Collections;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Security
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "Rule", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveRuleCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _securityGroupRuleId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "RemoveRule", ValueFromPipelineByPropertyName = true, HelpMessage = "cfgn")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SecurityGroupRuleId
|
||||
{
|
||||
get { return _securityGroupRuleId; }
|
||||
set { _securityGroupRuleId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
this.RepositoryFactory.CreateSecurityRepository().DeleteSecurityRule(this.SecurityGroupRuleId);
|
||||
this.UpdateCache<SecurityGroupUIContainer>();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
/* ============================================================================
|
||||
Copyright 2014 Hewlett Packard
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
============================================================================ */
|
||||
using System;
|
||||
using System.Management.Automation;
|
||||
using Openstack.Client.Powershell.Cmdlets.Common;
|
||||
using Openstack.Objects.Domain.Security;
|
||||
using Openstack.Client.Powershell.Providers.Common;
|
||||
using Openstack.Client.Powershell.Providers.Security;
|
||||
using Openstack.Objects.DataAccess;
|
||||
using Openstack.Objects.DataAccess.Security;
|
||||
|
||||
namespace Openstack.Client.Powershell.Cmdlets.Security
|
||||
{
|
||||
[Cmdlet(VerbsCommon.Remove, "SecurityGroup", SupportsShouldProcess = true)]
|
||||
[RequiredServiceIdentifierAttribute(Openstack.Objects.Domain.Admin.Services.Compute)]
|
||||
public class RemoveSecurityGroupCmdlet : BasePSCmdlet
|
||||
{
|
||||
private string _securityGroupId;
|
||||
|
||||
#region Parameters
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "RemoveSecurityGroup", ValueFromPipelineByPropertyName = true, HelpMessage = "ww")]
|
||||
[Alias("id")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
public string SecurityGroupId
|
||||
{
|
||||
get { return _securityGroupId; }
|
||||
set { _securityGroupId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Methods
|
||||
//=========================================================================================
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//=========================================================================================
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
string id = this.TranslateQuickPickNumber(this.SecurityGroupId);
|
||||
ISecurityRepository repository = this.RepositoryFactory.CreateSecurityRepository();
|
||||
|
||||
SecurityGroup group = repository.GetSecurityGroup(id);
|
||||
|
||||
if (group.Name != "default")
|
||||
{
|
||||
repository.DeleteSecurityGroup(id);
|
||||
this.UpdateCache<SecurityGroupsUIContainer>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("Invalid SecurityGroupId : Unable to delete the Default Security Group.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
BIN
Openstack.Client.Powershell/Dependencies/Microsoft.Http.dll
Normal file
BIN
Openstack.Client.Powershell/Dependencies/Microsoft.Http.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Openstack.Client.Powershell/Deployment/Aliases.txt
Normal file
BIN
Openstack.Client.Powershell/Deployment/Aliases.txt
Normal file
Binary file not shown.
170
Openstack.Client.Powershell/Deployment/ApacheLicense.rtf
Normal file
170
Openstack.Client.Powershell/Deployment/ApacheLicense.rtf
Normal file
@ -0,0 +1,170 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f39\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
|
||||
{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
|
||||
{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f410\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f411\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
|
||||
{\f413\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f414\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f417\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f418\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
|
||||
{\f430\fbidi \fmodern\fcharset238\fprq1 Consolas CE;}{\f431\fbidi \fmodern\fcharset204\fprq1 Consolas Cyr;}{\f433\fbidi \fmodern\fcharset161\fprq1 Consolas Greek;}{\f434\fbidi \fmodern\fcharset162\fprq1 Consolas Tur;}
|
||||
{\f437\fbidi \fmodern\fcharset186\fprq1 Consolas Baltic;}{\f438\fbidi \fmodern\fcharset163\fprq1 Consolas (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
|
||||
{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}
|
||||
{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}
|
||||
{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
|
||||
\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp \f31506\fs22 }{\*\defpap
|
||||
\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1
|
||||
\af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
|
||||
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}{
|
||||
\s15\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs21\alang1025 \ltrch\fcs0 \f39\fs21\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \slink16 \sunhideused Plain Text;}
|
||||
{\*\cs16 \additive \rtlch\fcs1 \af0\afs21 \ltrch\fcs0 \f39\fs21 \sbasedon10 \slink15 \slocked Plain Text Char;}}{\*\rsidtbl \rsid8006177\rsid10242273\rsid13443570}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1
|
||||
\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author tplummer}{\operator tplummer}{\creatim\yr2012\mo9\dy6\hr10\min42}{\revtim\yr2012\mo9\dy6\hr10\min42}{\version2}{\edmins1}{\nofpages1}{\nofwords86}{\nofchars494}{\nofcharsws579}{\vern49273}}
|
||||
{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1501\margr1502\margt1440\margb1440\gutter0\ltrsect
|
||||
\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen
|
||||
\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1501\dgvorigin1440\dghshow1\dgvshow1
|
||||
\jexpand\viewkind1\viewscale210\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
|
||||
\asianbrkrule\rsidroot13443570\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
|
||||
{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sectrsid1316550\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2
|
||||
\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6
|
||||
\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
|
||||
{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid8006177 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0
|
||||
\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid8006177 Copyright }{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid8006177 2012 Hewlett-Packard}{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid8006177
|
||||
\par Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\par you may not use this file except in compliance with the License.
|
||||
\par You may obtain a copy of the License at
|
||||
\par http://www.apache.org/licenses/LICENSE-2.0
|
||||
\par Unless required by applicable law or agreed to in writing, software
|
||||
\par distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\par WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\par See the License for the specific language governing permissions and
|
||||
\par limitations under the License.}{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid10242273\charrsid8006177
|
||||
\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
|
||||
9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
|
||||
5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
|
||||
b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
|
||||
0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
|
||||
a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
|
||||
c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
|
||||
0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
|
||||
a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
|
||||
6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
|
||||
4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
|
||||
4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f
|
||||
7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87
|
||||
615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad
|
||||
79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b
|
||||
5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab
|
||||
999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9
|
||||
699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586
|
||||
8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6
|
||||
0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f
|
||||
9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be
|
||||
15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979
|
||||
3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d
|
||||
32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a
|
||||
f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86
|
||||
e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90
|
||||
fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2
|
||||
ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae
|
||||
a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1
|
||||
399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5
|
||||
4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84
|
||||
0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b
|
||||
c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7
|
||||
689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20
|
||||
5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0
|
||||
aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d
|
||||
316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840
|
||||
545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a
|
||||
c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100
|
||||
0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7
|
||||
8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89
|
||||
d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500
|
||||
1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f
|
||||
bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6
|
||||
a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a
|
||||
0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021
|
||||
0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008
|
||||
00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000}
|
||||
{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
|
||||
617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
|
||||
6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
|
||||
656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
|
||||
{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
|
||||
\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;
|
||||
\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7;
|
||||
\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000
|
||||
4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
|
||||
d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000090e7
|
||||
0a31468ccd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000105000000000000}}
|
15
Openstack.Client.Powershell/Deployment/ApacheLicense.txt
Normal file
15
Openstack.Client.Powershell/Deployment/ApacheLicense.txt
Normal file
@ -0,0 +1,15 @@
|
||||
Copyright 2012 Hewlett-Packard
|
||||
|
||||
The Migrate-Drive cmdlet is licensed under the following agreement
|
||||
|
||||
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.
|
52
Openstack.Client.Powershell/Deployment/CLI.config
Normal file
52
Openstack.Client.Powershell/Deployment/CLI.config
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<Testing>
|
||||
<add key="TestServerName" value="TestServer" />
|
||||
<add key="TestNetworkName" value="TestNetwork" />
|
||||
<add key="TestPortName" value="TestPort" />
|
||||
<add key="TestRouterName" value="TestRouter" />
|
||||
<add key="TestSecurityGroupName" value="TestSecurityGroup" />
|
||||
<add key="TestSnapshotName" value="TestSnapshot" />
|
||||
<add key="TestStorageContainerName" value="TestContainer" />
|
||||
<add key="TestSubnetName" value="TestSubnet" />
|
||||
<add key="TestVolumeName" value="TestVolume" />
|
||||
<add key="TestFilePath" value="e:\Projects\Testing\Anothertest.txt" />
|
||||
<add key="TestStorageContainerSecondaryName" value="b10" />
|
||||
<add key="LocalTestDirectory" value="e:\Projects\Testing\" />
|
||||
<add key="TestImageId" value="5a1408cb-25f2-43a6-b1d9-931f5e47c871" />
|
||||
<add key="TestFlavorId" value="100" />
|
||||
</Testing>
|
||||
<StorageManagement>
|
||||
<add key="largeFileSize" value="314572800" />
|
||||
<add key="defSegmentNumber" value="16" />
|
||||
<add key="MaxSegmentCopyRetries" value="3" />
|
||||
<add key="UseCleanLargeFileCopies" value="false" />
|
||||
<add key="delimiter" value="/" />
|
||||
<add key="max-keys" value="10000" />
|
||||
<add key="HttpTimeoutInterval" value="9200000" />
|
||||
<add key="PasteGetURIResultsToClipboard" value="true" />
|
||||
<add key="ReleaseNotesURI" value="https://region-a.geo-1.objects.hpcloudsvc.com/v1/AUTH_2485a207-71a4-4429-9e24-f7bf49e207fc/Builds/ReleaseManifest.xml" />
|
||||
<add key="NewReleaseFolder" value="e:\" />
|
||||
<SharedContainers></SharedContainers>
|
||||
</StorageManagement>
|
||||
<IdentityServices>
|
||||
<ServiceProvider name="" isDefault="True">
|
||||
<add key="AuthenticationServiceURI" value="" />
|
||||
<add key="Username" value="" />
|
||||
<add key="Password" value="" />
|
||||
<add key="DefaultTenantId" value="" />
|
||||
</ServiceProvider>
|
||||
</IdentityServices>
|
||||
<ComputeServices>
|
||||
<add key="LogReadAttemptsMax" value="20" />
|
||||
<add key="LogReadAttemptIntervalInMilliSeconds" value="40000" />
|
||||
<add key="EnableCredentialTracking" value="true" />
|
||||
<add key="SSHClientPath" value="C:\Users\tplummer\Desktop\Utilities\Putty.exe" />
|
||||
</ComputeServices>
|
||||
<AvailabilityZones>
|
||||
<AvailabilityZone id="1" isDefault="True" name="region-a.geo-1" shellForegroundColor="Green" />
|
||||
<AvailabilityZone id="2" isDefault="False" name="region-b.geo-1" shellForegroundColor="Green" />
|
||||
</AvailabilityZones>
|
||||
</appSettings>
|
||||
</configuration>
|
52
Openstack.Client.Powershell/Deployment/CLI.config.example
Normal file
52
Openstack.Client.Powershell/Deployment/CLI.config.example
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<Testing>
|
||||
<add key="TestServerName" value="TestServer" />
|
||||
<add key="TestNetworkName" value="TestNetwork" />
|
||||
<add key="TestPortName" value="TestPort" />
|
||||
<add key="TestRouterName" value="TestRouter" />
|
||||
<add key="TestSecurityGroupName" value="TestSecurityGroup" />
|
||||
<add key="TestSnapshotName" value="TestSnapshot" />
|
||||
<add key="TestStorageContainerName" value="TestContainer" />
|
||||
<add key="TestSubnetName" value="TestSubnet" />
|
||||
<add key="TestVolumeName" value="TestVolume" />
|
||||
<add key="TestFilePath" value="e:\Projects\Testing\Anothertest.txt" />
|
||||
<add key="TestStorageContainerSecondaryName" value="b10" />
|
||||
<add key="LocalTestDirectory" value="e:\Projects\Testing\" />
|
||||
<add key="TestImageId" value="5a1408cb-25f2-43a6-b1d9-931f5e47c871" />
|
||||
<add key="TestFlavorId" value="100" />
|
||||
</Testing>
|
||||
<StorageManagement>
|
||||
<add key="largeFileSize" value="314572800" />
|
||||
<add key="defSegmentNumber" value="16" />
|
||||
<add key="MaxSegmentCopyRetries" value="3" />
|
||||
<add key="UseCleanLargeFileCopies" value="false" />
|
||||
<add key="delimiter" value="/" />
|
||||
<add key="max-keys" value="10000" />
|
||||
<add key="HttpTimeoutInterval" value="9200000" />
|
||||
<add key="PasteGetURIResultsToClipboard" value="true" />
|
||||
<add key="ReleaseNotesURI" value="https://region-a.geo-1.objects.hpcloudsvc.com/v1/AUTH_2485a207-71a4-4429-9e24-f7bf49e207fc/Builds/ReleaseManifest.xml" />
|
||||
<add key="NewReleaseFolder" value="e:\" />
|
||||
<SharedContainers>
|
||||
</SharedContainers>
|
||||
</StorageManagement>
|
||||
<IdentityServices>
|
||||
<!--Pro-->
|
||||
<add key="AuthenticationServiceURI" value="https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens" />
|
||||
<add key="Username" value="" />
|
||||
<add key="Password" value="" />
|
||||
<add key="DefaultTenantId" value="" />
|
||||
</IdentityServices>
|
||||
<ComputeServices>
|
||||
<add key="LogReadAttemptsMax" value="20" />
|
||||
<add key="LogReadAttemptIntervalInMilliSeconds" value="40000" />
|
||||
<add key="EnableCredentialTracking" value="true" />
|
||||
<add key="SSHClientPath" value="C:\Users\tplummer\Desktop\Utilities\Putty.exe" />
|
||||
</ComputeServices>
|
||||
<AvailabilityZones>
|
||||
<AvailabilityZone id="1" isDefault="True" name="region-a.geo-1" shellForegroundColor="Green" />
|
||||
<AvailabilityZone id="2" isDefault="False" name="region-b.geo-1" shellForegroundColor="Green" />
|
||||
</AvailabilityZones>
|
||||
</appSettings>
|
||||
</configuration>
|
21
Openstack.Client.Powershell/Deployment/CLIManifest.psd1
Normal file
21
Openstack.Client.Powershell/Deployment/CLIManifest.psd1
Normal file
@ -0,0 +1,21 @@
|
||||
@{
|
||||
ModuleToProcess = 'Openstack.Client.Powershell.dll'
|
||||
GUID="{847a28a4-6407-4aa6-8070-a4a51396db70}"
|
||||
Author="Travis Plummer"
|
||||
CompanyName="Hewlett-Packard Corporation"
|
||||
Copyright="© Hewlett-Packard. All rights reserved."
|
||||
ModuleVersion="1.0.0.0"
|
||||
PowerShellVersion="2.0"
|
||||
CLRVersion="4.0.30319"
|
||||
FormatsToProcess="OpenstackShell.format.ps1xml"
|
||||
FileList='CLI.config'
|
||||
RequiredAssemblies = 'Openstack.dll', 'Openstack.Common.dll'
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CredentialList>
|
||||
|
||||
</CredentialList>
|
79
Openstack.Client.Powershell/Deployment/DevProfile.ps1
Normal file
79
Openstack.Client.Powershell/Deployment/DevProfile.ps1
Normal file
@ -0,0 +1,79 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Set up the default windows size and color....
|
||||
# ---------------------------------------------------------------
|
||||
#$DebugPreference=$VerbosePreference="Continue"
|
||||
#$DebugPreference = "Continue"
|
||||
$a = (Get-Host).UI.RawUI
|
||||
$b = $a.WindowSize
|
||||
$b.Width = 109
|
||||
$b.Height = 61
|
||||
$a.WindowSize = $b
|
||||
cls
|
||||
# -----------------------------------------------------------------
|
||||
# Register known providers, write out welcome and status messages..
|
||||
# -----------------------------------------------------------------
|
||||
$a.BackgroundColor = "black"
|
||||
Echo ''
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
$a.ForegroundColor = "yellow"
|
||||
Echo 'Welcome to the OpenStack Powershell Environment.333'
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
Echo ''
|
||||
$a.ForegroundColor = "green"
|
||||
echo ' ==> Registering Providers...'
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
# ACTION REQUIRED! ==> Substitute the example CD commands path below to match your setup. This should be the final output of the Solution as dictated by the
|
||||
# $(TargetDir) macro in the Post-Build Script.
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#cd C:\Users\tplummer\Source\Repos\OpenStack-CLI\Openstack.Client.Powershell\bin\Release
|
||||
cd C:\Users\tplummer\Source\Repos\OpenStack-NewCLI\Openstack.Client.Powershell\bin\Release
|
||||
|
||||
import-module .\CLIManifest.psd1 -DisableNameChecking
|
||||
cd Builds:
|
||||
cd 1-3-4-5
|
||||
|
||||
|
||||
#cd OpenStack:
|
||||
#cd Networks
|
||||
#get-sp
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Let the User know what's going on..
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
echo ' ==> Applying Command Aliases...'
|
||||
echo ' ==> Registering Views...'
|
||||
echo ''
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
# Issue any startup commands you would like to execute after everything loads.
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
#cd BlockStorage
|
||||
#cd Volumes
|
||||
#ls
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Reset Shell to default colors..
|
||||
# ---------------------------------------------------------------
|
||||
#$a.ForegroundColor = "yellow"
|
||||
echo 'Ready..'
|
||||
#$a.ForegroundColor = "green"
|
||||
echo ''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,73 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Set up the default windows size and color....
|
||||
# ---------------------------------------------------------------
|
||||
#$DebugPreference=$VerbosePreference="Continue"
|
||||
#$DebugPreference = "Continue"
|
||||
$a = (Get-Host).UI.RawUI
|
||||
$b = $a.WindowSize
|
||||
$b.Width = 109
|
||||
$b.Height = 61
|
||||
$a.WindowSize = $b
|
||||
cls
|
||||
# -----------------------------------------------------------------
|
||||
# Register known providers, write out welcome and status messages..
|
||||
# -----------------------------------------------------------------
|
||||
$a.BackgroundColor = "black"
|
||||
Echo ''
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
$a.ForegroundColor = "yellow"
|
||||
Echo 'Welcome to the OpenStack Powershell Environment.'
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
Echo ''
|
||||
$a.ForegroundColor = "green"
|
||||
echo ' ==> Registering Providers...'
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
# ACTION REQUIRED! ==> Substitute the example CD commands path below to match your setup. This should be the final output of the Solution as dictated by the
|
||||
# $(TargetDir) macro in the Post-Build Script.
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# cd 'Your Target Directory Here!'...
|
||||
|
||||
import-module .\CLIManifest.psd1 -DisableNameChecking
|
||||
cd OpenStack:
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Let the User know what's going on..
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
echo ' ==> Applying Command Aliases...'
|
||||
echo ' ==> Registering Views...'
|
||||
echo ''
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
# Issue any startup commands you would like to execute after everything loads.
|
||||
# -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
#cd BlockStorage
|
||||
#cd Volumes
|
||||
#ls
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Reset Shell to default colors..
|
||||
# ---------------------------------------------------------------
|
||||
#$a.ForegroundColor = "yellow"
|
||||
echo 'Ready..'
|
||||
#$a.ForegroundColor = "green"
|
||||
echo ''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
217
Openstack.Client.Powershell/Deployment/License.rtf
Normal file
217
Openstack.Client.Powershell/Deployment/License.rtf
Normal file
@ -0,0 +1,217 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
|
||||
{\f34\fbidi \froman\fcharset1\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}
|
||||
{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
|
||||
{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f60\fbidi \fmodern\fcharset238\fprq1 Courier New CE;}{\f61\fbidi \fmodern\fcharset204\fprq1 Courier New Cyr;}
|
||||
{\f63\fbidi \fmodern\fcharset161\fprq1 Courier New Greek;}{\f64\fbidi \fmodern\fcharset162\fprq1 Courier New Tur;}{\f65\fbidi \fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f66\fbidi \fmodern\fcharset178\fprq1 Courier New (Arabic);}
|
||||
{\f67\fbidi \fmodern\fcharset186\fprq1 Courier New Baltic;}{\f68\fbidi \fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f410\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f411\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
|
||||
{\f413\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f414\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\f417\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f418\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}
|
||||
{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhimajor\f31528\fbidi \fswiss\fcharset238\fprq2 Calibri Light CE;}{\fhimajor\f31529\fbidi \fswiss\fcharset204\fprq2 Calibri Light Cyr;}
|
||||
{\fhimajor\f31531\fbidi \fswiss\fcharset161\fprq2 Calibri Light Greek;}{\fhimajor\f31532\fbidi \fswiss\fcharset162\fprq2 Calibri Light Tur;}{\fhimajor\f31535\fbidi \fswiss\fcharset186\fprq2 Calibri Light Baltic;}
|
||||
{\fhimajor\f31536\fbidi \fswiss\fcharset163\fprq2 Calibri Light (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}
|
||||
{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}
|
||||
{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}
|
||||
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
|
||||
\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025
|
||||
\ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
|
||||
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa160\sl259\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused Normal Table;}}{\*\pgptbl {\pgp
|
||||
\ipgp5\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp2\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp3\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp4\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid11606679\rsid12599557\rsid15035048}{\mmathPr\mmathFont34\mbrkBin0
|
||||
\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Travis Plummer}{\operator Travis Plummer}{\creatim\yr2014\mo2\dy11\hr13\min24}{\revtim\yr2014\mo2\dy11\hr13\min25}{\version1}{\edmins1}
|
||||
{\nofpages1}{\nofwords82}{\nofchars469}{\nofcharsws550}{\vern57435}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
|
||||
\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen
|
||||
\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
|
||||
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
|
||||
\asianbrkrule\rsidroot11606679\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
|
||||
{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang
|
||||
{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang
|
||||
{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
|
||||
\pard\plain \ltrpar\ql \li0\ri0\widctlpar\tx916\tx1832\tx2748\tx3664\tx4580\tx5496\tx6412\tx7328\tx8244\tx9160\tx10076\tx10992\tx11908\tx12824\tx13740\tx14656\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11606679 \rtlch\fcs1
|
||||
\af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af2\afs20 \ltrch\fcs0 \f2\fs20\lang9\langfe1033\langnp9\insrsid11606679\charrsid11606679 Copyright }{\rtlch\fcs1 \af2\afs20 \ltrch\fcs0
|
||||
\f2\fs20\lang9\langfe1033\langnp9\insrsid11606679 2014 Openstack}{\rtlch\fcs1 \af2\afs20 \ltrch\fcs0 \f2\fs20\lang9\langfe1033\langnp9\insrsid11606679\charrsid11606679
|
||||
\par
|
||||
\par Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\par you may not use this file except in compliance with the License.
|
||||
\par You may obtain a copy of the License at
|
||||
\par
|
||||
\par http://www.apache.org/licenses/LICENSE-2.0
|
||||
\par
|
||||
\par Unless required by applicable law or agreed to in writing, software
|
||||
\par distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\par WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\par See the License for the specific language governing permissions and
|
||||
\par limitations under the License.
|
||||
\par }\pard \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid12599557
|
||||
\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a
|
||||
9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad
|
||||
5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6
|
||||
b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0
|
||||
0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6
|
||||
a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f
|
||||
c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512
|
||||
0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462
|
||||
a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865
|
||||
6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b
|
||||
4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b
|
||||
4757e8d3f729e245eb2b260a0238fd010000ffff0300504b030414000600080000002100aa5225dfc60600008b1a0000160000007468656d652f7468656d652f
|
||||
7468656d65312e786d6cec595d8bdb46147d2ff43f08bd3bfe92fcb1c41b6cd9ceb6d94d42eca4e4716c8fadc98e344633de8d0981923c160aa569e943037deb
|
||||
43691b48a02fe9afd936a54d217fa17746b63c638fbb9b2585a5640d8b343af7ce997bafce1d4997afdc8fa87384134e58dc708b970aae83e3211b9178d2706f
|
||||
f7bbb99aeb7081e211a22cc60d778eb97b65f7c30f2ea31d11e2083b601ff31dd4704321a63bf93c1fc230e297d814c7706dcc920809384d26f951828ec16f44
|
||||
f3a542a1928f10895d274611b8bd311e932176fad2a5bbbb74dea1701a0b2e078634e949d7d8b050d8d1615122f89c0734718e106db830cf881df7f17de13a14
|
||||
7101171a6e41fdb9f9ddcb79b4b330a2628bad66d7557f0bbb85c1e8b0a4e64c26836c52cff3bd4a33f3af00546ce23ad54ea553c9fc29001a0e61a52917dda7
|
||||
dfaab7dafe02ab81d2438bef76b55d2e1a78cd7f798373d3973f03af40a97f6f03dfed06104503af4029dedfc07b5eb51478065e81527c65035f2d34db5ed5c0
|
||||
2b5048497cb8812ef89572b05c6d061933ba6785d77daf5b2d2d9caf50500d5975c929c62c16db6a2d42f758d2058004522448ec88f9148fd110aa3840940c12
|
||||
e2ec93490885374531e3305c2815ba8532fc973f4f1da988a01d8c346bc90b98f08d21c9c7e1c3844c45c3fd18bcba1ae4cdcb1fdfbc7cee9c3c7a71f2e89793
|
||||
c78f4f1efd9c3a32acf6503cd1ad5e7fffc5df4f3f75fe7afeddeb275fd9f15cc7fffed367bffdfaa51d082b5d85e0d5d7cffe78f1ecd5379ffff9c3130bbc99
|
||||
a0810eef930873e73a3e766eb10816a6426032c783e4ed2cfa2122ba45339e701423398bc57f478406fafa1c5164c1b5b019c13b09488c0d787576cf20dc0b93
|
||||
9920168fd7c2c8001e30465b2cb146e19a9c4b0b737f164fec9327331d770ba123dbdc018a8dfc766653d05662731984d8a07993a258a0098eb170e4357688b1
|
||||
6575770931e27a408609e36c2c9cbbc46921620d499f0c8c6a5a19ed9108f232b711847c1bb139b8e3b418b5adba8d8f4c24dc15885ac8f73135c27815cd048a
|
||||
6c2efb28a27ac0f791086d247bf364a8e33a5c40a6279832a733c29cdb6c6e24b05e2de9d7405eec693fa0f3c84426821cda7cee23c674649b1d06218aa6366c
|
||||
8fc4a18efd881f428922e7261336f80133ef10790e7940f1d674df21d848f7e96a701b9455a7b42a107965965872791533a37e7b733a4658490d08bfa1e71189
|
||||
4f15f73559f7ff5b5907217df5ed53cbaa2eaaa0371362bda3f6d6647c1b6e5dbc03968cc8c5d7ee369ac53731dc2e9b0decbd74bf976ef77f2fdddbeee7772f
|
||||
d82b8d06f9965bc574abae36eed1d67dfb9850da13738af7b9daba73e84ca32e0c4a3bf5cc8ab3e7b8690887f24e86090cdc2441cac64998f88488b017a229ec
|
||||
ef8bae7432e10bd713ee4c19876dbf1ab6fa96783a8b0ed8287d5c2d16e5a3692a1e1c89d578c1cfc6e15143a4e84a75f50896b9576c27ea51794940dabe0d09
|
||||
6d329344d942a2ba1c9441520fe610340b09b5b277c2a26e615193ee97a9da6001d4b2acc0d6c9810d57c3f53d30012378a242148f649ed2542fb3ab92f92e33
|
||||
bd2d984605c03e625901ab4cd725d7adcb93ab4b4bed0c99364868e566925091513d8c87688417d52947cf42e36d735d5fa5d4a02743a1e683d25ad1a8d6fe8d
|
||||
c579730d76ebda40635d2968ec1c37dc4ad9879219a269c31dc3633f1c4653a81d2eb7bc884ee0ddd95024e90d7f1e6599265cb4110fd3802bd149d520220227
|
||||
0e2551c395cbcfd24063a5218a5bb104827061c9d541562e1a3948ba99643c1ee3a1d0d3ae8dc848a7a7a0f0a95658af2af3f383a5259b41ba7be1e8d819d059
|
||||
720b4189f9d5a20ce0887078fb534ca33922f03a3313b255fdad35a685eceaef13550da5e3884e43b4e828ba98a77025e5191d7596c5403b5bac1902aa8564d1
|
||||
080713d960f5a01add34eb1a2987ad5df7742319394d34573dd35015d935ed2a66ccb06c036bb13c5f93d7582d430c9aa677f854bad725b7bed4bab57d42d625
|
||||
20e059fc2c5df70c0d41a3b69acca026196fcab0d4ecc5a8d93b960b3c85da599a84a6fa95a5dbb5b8653dc23a1d0c9eabf383dd7ad5c2d078b9af549156df3d
|
||||
f44f136c700fc4a30d2f81675470954af8f09020d810f5d49e24950db845ee8bc5ad0147ce2c210df741c16f7a41c90f72859adfc97965af90abf9cd72aee9fb
|
||||
e562c72f16daadd243682c228c8a7efacda50bafa2e87cf1e5458d6f7c7d89966fdb2e0d599467eaeb4a5e11575f5f8aa5ed5f5f1c02a2f3a052ead6cbf55625
|
||||
572f37bb39afddaae5ea41a5956b57826abbdb0efc5abdfbd0758e14d86b9603afd2a9e52ac520c8799582a45fabe7aa5ea9d4f4aacd5ac76b3e5c6c6360e5a9
|
||||
7c2c6201e155bc76ff010000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f
|
||||
7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be
|
||||
9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980
|
||||
ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5b
|
||||
babac4df000000ffff0300504b01022d0014000600080000002100e9de0fbfff0000001c0200001300000000000000000000000000000000005b436f6e74656e
|
||||
745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f
|
||||
2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000190200007468656d652f7468656d652f74
|
||||
68656d654d616e616765722e786d6c504b01022d0014000600080000002100aa5225dfc60600008b1a00001600000000000000000000000000d6020000746865
|
||||
6d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b0100002700000000000000000000000000d00900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000cb0a00000000}
|
||||
{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
|
||||
617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
|
||||
6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
|
||||
656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
|
||||
{\*\latentstyles\lsdstimax371\lsdlockeddef0\lsdsemihiddendef0\lsdunhideuseddef0\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 5;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 6;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index 9;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 1;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 2;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 4;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 5;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 6;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 7;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 8;\lsdsemihidden1 \lsdunhideused1 \lsdpriority39 \lsdlocked0 toc 9;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Indent;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 header;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footer;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 index heading;\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of figures;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 envelope return;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 footnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation reference;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 line number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 page number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote reference;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 endnote text;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 table of authorities;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 macro;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 toa heading;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Bullet 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Number 5;\lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Closing;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Signature;\lsdsemihidden1 \lsdunhideused1 \lsdpriority1 \lsdlocked0 Default Paragraph Font;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 4;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 List Continue 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Message Header;\lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Salutation;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Date;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text First Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Note Heading;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Body Text Indent 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Block Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Hyperlink;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 FollowedHyperlink;\lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;
|
||||
\lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Document Map;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Plain Text;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 E-mail Signature;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Top of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Bottom of Form;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal (Web);\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Acronym;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Address;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Cite;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Code;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Definition;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Keyboard;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Preformatted;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Sample;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Typewriter;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 HTML Variable;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Normal Table;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 annotation subject;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 No List;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Outline List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 1;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Simple 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Classic 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Colorful 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 3;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Columns 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 6;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Grid 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 4;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 5;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 6;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 7;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table List 8;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table 3D effects 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Contemporary;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Elegant;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Professional;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Subtle 2;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 1;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 2;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Web 3;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Balloon Text;\lsdpriority39 \lsdlocked0 Table Grid;\lsdsemihidden1 \lsdunhideused1 \lsdlocked0 Table Theme;\lsdsemihidden1 \lsdlocked0 Placeholder Text;
|
||||
\lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;\lsdpriority60 \lsdlocked0 Light Shading;\lsdpriority61 \lsdlocked0 Light List;\lsdpriority62 \lsdlocked0 Light Grid;\lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdpriority64 \lsdlocked0 Medium Shading 2;
|
||||
\lsdpriority65 \lsdlocked0 Medium List 1;\lsdpriority66 \lsdlocked0 Medium List 2;\lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdpriority68 \lsdlocked0 Medium Grid 2;\lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdpriority70 \lsdlocked0 Dark List;
|
||||
\lsdpriority71 \lsdlocked0 Colorful Shading;\lsdpriority72 \lsdlocked0 Colorful List;\lsdpriority73 \lsdlocked0 Colorful Grid;\lsdpriority60 \lsdlocked0 Light Shading Accent 1;\lsdpriority61 \lsdlocked0 Light List Accent 1;
|
||||
\lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdsemihidden1 \lsdlocked0 Revision;
|
||||
\lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;
|
||||
\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;\lsdpriority72 \lsdlocked0 Colorful List Accent 1;
|
||||
\lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdpriority60 \lsdlocked0 Light Shading Accent 2;\lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
|
||||
\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;
|
||||
\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;\lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdpriority72 \lsdlocked0 Colorful List Accent 2;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;
|
||||
\lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdpriority61 \lsdlocked0 Light List Accent 3;\lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
|
||||
\lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;
|
||||
\lsdpriority70 \lsdlocked0 Dark List Accent 3;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;\lsdpriority60 \lsdlocked0 Light Shading Accent 4;
|
||||
\lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdpriority62 \lsdlocked0 Light Grid Accent 4;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
|
||||
\lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdpriority70 \lsdlocked0 Dark List Accent 4;
|
||||
\lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;\lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdpriority60 \lsdlocked0 Light Shading Accent 5;\lsdpriority61 \lsdlocked0 Light List Accent 5;
|
||||
\lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;\lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 5;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdpriority61 \lsdlocked0 Light List Accent 6;\lsdpriority62 \lsdlocked0 Light Grid Accent 6;
|
||||
\lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;\lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;
|
||||
\lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;\lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdpriority70 \lsdlocked0 Dark List Accent 6;\lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;
|
||||
\lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;\lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
|
||||
\lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;\lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdsemihidden1 \lsdunhideused1 \lsdpriority37 \lsdlocked0 Bibliography;
|
||||
\lsdsemihidden1 \lsdunhideused1 \lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;\lsdpriority41 \lsdlocked0 Plain Table 1;\lsdpriority42 \lsdlocked0 Plain Table 2;\lsdpriority43 \lsdlocked0 Plain Table 3;\lsdpriority44 \lsdlocked0 Plain Table 4;
|
||||
\lsdpriority45 \lsdlocked0 Plain Table 5;\lsdpriority40 \lsdlocked0 Grid Table Light;\lsdpriority46 \lsdlocked0 Grid Table 1 Light;\lsdpriority47 \lsdlocked0 Grid Table 2;\lsdpriority48 \lsdlocked0 Grid Table 3;\lsdpriority49 \lsdlocked0 Grid Table 4;
|
||||
\lsdpriority50 \lsdlocked0 Grid Table 5 Dark;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 1;
|
||||
\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 1;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 1;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 1;
|
||||
\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 1;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 2;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 2;
|
||||
\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 2;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 2;
|
||||
\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 3;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 3;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 3;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 3;
|
||||
\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 3;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 4;
|
||||
\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 4;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 4;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 4;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 4;
|
||||
\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 4;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 5;
|
||||
\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 5;\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 5;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 5;
|
||||
\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 5;\lsdpriority46 \lsdlocked0 Grid Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 Grid Table 2 Accent 6;\lsdpriority48 \lsdlocked0 Grid Table 3 Accent 6;
|
||||
\lsdpriority49 \lsdlocked0 Grid Table 4 Accent 6;\lsdpriority50 \lsdlocked0 Grid Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 Grid Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 Grid Table 7 Colorful Accent 6;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light;\lsdpriority47 \lsdlocked0 List Table 2;\lsdpriority48 \lsdlocked0 List Table 3;\lsdpriority49 \lsdlocked0 List Table 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark;
|
||||
\lsdpriority51 \lsdlocked0 List Table 6 Colorful;\lsdpriority52 \lsdlocked0 List Table 7 Colorful;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 1;\lsdpriority47 \lsdlocked0 List Table 2 Accent 1;\lsdpriority48 \lsdlocked0 List Table 3 Accent 1;
|
||||
\lsdpriority49 \lsdlocked0 List Table 4 Accent 1;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 1;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 1;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 1;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 2;\lsdpriority47 \lsdlocked0 List Table 2 Accent 2;\lsdpriority48 \lsdlocked0 List Table 3 Accent 2;\lsdpriority49 \lsdlocked0 List Table 4 Accent 2;
|
||||
\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 2;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 2;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 2;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 3;
|
||||
\lsdpriority47 \lsdlocked0 List Table 2 Accent 3;\lsdpriority48 \lsdlocked0 List Table 3 Accent 3;\lsdpriority49 \lsdlocked0 List Table 4 Accent 3;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 3;
|
||||
\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 3;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 3;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 4;\lsdpriority47 \lsdlocked0 List Table 2 Accent 4;
|
||||
\lsdpriority48 \lsdlocked0 List Table 3 Accent 4;\lsdpriority49 \lsdlocked0 List Table 4 Accent 4;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 4;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 4;
|
||||
\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 4;\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 5;\lsdpriority47 \lsdlocked0 List Table 2 Accent 5;\lsdpriority48 \lsdlocked0 List Table 3 Accent 5;
|
||||
\lsdpriority49 \lsdlocked0 List Table 4 Accent 5;\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 5;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 5;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 5;
|
||||
\lsdpriority46 \lsdlocked0 List Table 1 Light Accent 6;\lsdpriority47 \lsdlocked0 List Table 2 Accent 6;\lsdpriority48 \lsdlocked0 List Table 3 Accent 6;\lsdpriority49 \lsdlocked0 List Table 4 Accent 6;
|
||||
\lsdpriority50 \lsdlocked0 List Table 5 Dark Accent 6;\lsdpriority51 \lsdlocked0 List Table 6 Colorful Accent 6;\lsdpriority52 \lsdlocked0 List Table 7 Colorful Accent 6;}}{\*\datastore 010500000200000018000000
|
||||
4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000
|
||||
d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000000c4
|
||||
b60a5f27cf01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000105000000000000}}
|
@ -0,0 +1,81 @@
|
||||
# ---------------------------------------------------------------
|
||||
# Set up support methods first..
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
function is64bit() {
|
||||
return ([IntPtr]::Size -eq 8)
|
||||
}
|
||||
|
||||
function get-programfilesdir() {
|
||||
if (is64bit -eq $true) {
|
||||
(Get-Item "Env:ProgramFiles(x86)").Value
|
||||
}
|
||||
else {
|
||||
(Get-Item "Env:ProgramFiles").Value
|
||||
}
|
||||
}
|
||||
# ---------------------------------------------------------------
|
||||
# Set up the default windows size and color....
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
#$DebugPreference=$VerbosePreference="Continue"
|
||||
#$DebugPreference = "Continue"
|
||||
$a = (Get-Host).UI.RawUI
|
||||
$b = $a.WindowSize
|
||||
$b.Width = 109
|
||||
$b.Height = 61
|
||||
$a.WindowSize = $b
|
||||
$a.BackgroundColor = "black"
|
||||
$a.ForegroundColor = "green"
|
||||
|
||||
cls
|
||||
# ---------------------------------------------------------------
|
||||
# Register known providers, write out welcome and status messages..
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
$a.BackgroundColor = "black"
|
||||
Echo ''
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
$a.ForegroundColor = "yellow"
|
||||
Echo 'Welcome to the OpenStack Powershell Environment.'
|
||||
$a.ForegroundColor = "gray"
|
||||
Echo '========================================================================================'
|
||||
Echo ''
|
||||
$a.ForegroundColor = "green"
|
||||
echo ' ==> Registering Providers...'
|
||||
|
||||
$tempvar = get-programfilesdir
|
||||
$tempvar = $tempvar + "\Openstack\OpenStack-Powershell"
|
||||
cd $tempvar
|
||||
import-module .\CLIManifest.psd1 -DisableNameChecking
|
||||
|
||||
echo ' ==> Applying Command Aliases...'
|
||||
echo ' ==> Registering Views...'
|
||||
echo ''
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Reset Shell to default colors..
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
$a.ForegroundColor = "yellow"
|
||||
echo 'Ready..'
|
||||
$a.ForegroundColor = "green"
|
||||
echo ''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user