Skip to content

Commit 9609437

Browse files
committed
Adding container instance
2 parents cfc6a96 + 5cb285a commit 9609437

File tree

107 files changed

+498121
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+498121
-202
lines changed

setup/azurecmdfiles.wxi

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,77 @@
850850
<File Id="fil43E7D73F6ECD4DDE822875DD34FA9D18" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Consumption\System.Net.Http.Primitives.dll" />
851851
</Component>
852852
</Directory>
853+
<Directory Id="dir47A2B39B0611B6E373E033267EB15BCF" Name="AzureRM.ContainerInstance">
854+
<Component Id="cmpF014F858B00AE0B720A7FE08B30B3EB1" Guid="*">
855+
<File Id="filA3480B87C156A4B5C660366228905B48" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\AutoMapper.dll" />
856+
</Component>
857+
<Component Id="cmpEAD7343C628BB6448D8B9C23FEED2670" Guid="*">
858+
<File Id="fil4C1875FFDC2574CDEF54CD6706765B30" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\AzureRM.ContainerInstance.psd1" />
859+
</Component>
860+
<Component Id="cmp9C5A7356715B6922CF2C6EF6678E5438" Guid="*">
861+
<File Id="fil17D0ED50A53E62367F3286ABD14DDEC2" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Hyak.Common.dll" />
862+
</Component>
863+
<Component Id="cmpFB234DD31894792E945113104A74B825" Guid="*">
864+
<File Id="filBF689F649386FDA6CD3F22A1CD1BB06C" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.ApplicationInsights.dll" />
865+
</Component>
866+
<Component Id="cmp713E95E10701AE42E677F85985EF5EFD" Guid="*">
867+
<File Id="filEB670CA530978EB77CA8657A94F7212E" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Commands.Common.Authentication.Abstractions.dll" />
868+
</Component>
869+
<Component Id="cmp290EA0EFCA235BE56E601E04CD55529C" Guid="*">
870+
<File Id="fil4CF74C3BA5429133456D18D7895E422E" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Commands.ContainerInstance.dll" />
871+
</Component>
872+
<Component Id="cmp9DF62AE934C12CD1C2509F5CBC7ACCC2" Guid="*">
873+
<File Id="filCD73415FDBD8F38F74623E2DC0F1758B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Commands.ContainerInstance.dll-Help.xml" />
874+
</Component>
875+
<Component Id="cmpBD05C950174A0082397685E34790466C" Guid="*">
876+
<File Id="fil687FC6362D3733DF54D19745F6898B46" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Commands.ContainerInstance.format.ps1xml" />
877+
</Component>
878+
<Component Id="cmp0839FD185FCF6A5CB3FD2D5B60F3F7F9" Guid="*">
879+
<File Id="filD5406DCF89D3C5A76D9EA77005684213" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Commands.ResourceManager.Common.dll" />
880+
</Component>
881+
<Component Id="cmpEEDB2B1FAA819BCCB82AACA4DBB55454" Guid="*">
882+
<File Id="filEB24599000D85A431C894221C6F4ABF0" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Common.dll" />
883+
</Component>
884+
<Component Id="cmpEA35AAE5DB03CF2BDF02C837A44F245E" Guid="*">
885+
<File Id="fil9B44C5476D525617574E913FA6E99686" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Common.NetFramework.dll" />
886+
</Component>
887+
<Component Id="cmpD1FC76E65489062469C50C713650E4DA" Guid="*">
888+
<File Id="fil2BF3EA7D7A52A62039B2AF8AFE8623CE" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.KeyVault.Core.dll" />
889+
</Component>
890+
<Component Id="cmp8B109EB15D9BB6477BF9438D6CE54F36" Guid="*">
891+
<File Id="filA188F1FF463167665B7A961607A69DA0" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Azure.Management.ContainerInstance.dll" />
892+
</Component>
893+
<Component Id="cmpC67DEF5E50A9AC7AD357BBD3E42D17F0" Guid="*">
894+
<File Id="fil5E1F1EAEC87906893C3456C40A4B9A66" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Rest.ClientRuntime.Azure.dll" />
895+
</Component>
896+
<Component Id="cmp85D9C31F44298BF955EC36A6CF524A23" Guid="*">
897+
<File Id="filC73C1847AA3E2151FF8C4C7F78D064C3" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Rest.ClientRuntime.dll" />
898+
</Component>
899+
<Component Id="cmp1386DCAB186033CD6702183584069933" Guid="*">
900+
<File Id="fil9DA46CF5EAEEAECB23C52D6060EA45EC" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Threading.Tasks.dll" />
901+
</Component>
902+
<Component Id="cmp5F18344CC8AB2D812EB3916ADE3F495D" Guid="*">
903+
<File Id="fil85D7D9A30921923B5F5C93CBA45AD222" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Threading.Tasks.Extensions.Desktop.dll" />
904+
</Component>
905+
<Component Id="cmpC2EE61265356949E676F1A497AC0DE81" Guid="*">
906+
<File Id="fil0501D3D13A3ABC6CACED297A83834C60" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.Threading.Tasks.Extensions.dll" />
907+
</Component>
908+
<Component Id="cmpC2C9E25520A28FDDCB431F0388998F5C" Guid="*">
909+
<File Id="fil3D758CBAD5B24EFB59A567E6173F622B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.WindowsAzure.Commands.Common.dll" />
910+
</Component>
911+
<Component Id="cmp0F08B96A6FF8A3A0A48A28BA2EB965F1" Guid="*">
912+
<File Id="filCE22D9182723076A891431081DCDEA93" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Microsoft.WindowsAzure.Management.dll" />
913+
</Component>
914+
<Component Id="cmp4001D1BFC966874B8BC51BE05E07CFC2" Guid="*">
915+
<File Id="fil503F12C964F560A02C60BD8871978D28" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\Newtonsoft.Json.dll" />
916+
</Component>
917+
<Component Id="cmp95D2D9407E5DE8CF2C557678B0A4C8FD" Guid="*">
918+
<File Id="filADF98961A4980BB7051AA3B0619B262B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\System.Net.Http.Extensions.dll" />
919+
</Component>
920+
<Component Id="cmp90E88367AB3AF00FB328850E89F31F3F" Guid="*">
921+
<File Id="filD8804EFBBEC402CD4E328C4D1039C7A9" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerInstance\System.Net.Http.Primitives.dll" />
922+
</Component>
923+
</Directory>
853924
<Directory Id="dir78B1ED8DBB1AADB6D8A971F20091A708" Name="AzureRM.ContainerRegistry">
854925
<Component Id="cmp70A64104F3BC8D22E626DD19299FC6D6" Guid="*">
855926
<File Id="filD282EDCE8F330B66F678059D8DAF1650" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.ContainerRegistry\AzureRM.ContainerRegistry.psd1" />
@@ -5610,6 +5681,29 @@
56105681
<ComponentRef Id="cmp7E5FC780611F3C956F9AB6247B7ED1C5" />
56115682
<ComponentRef Id="cmp70BCD0155B7651BB65B36D61A0B86C88" />
56125683
<ComponentRef Id="cmpF7A00EAE5F90CF43F0CFB2C84DD981B1" />
5684+
<ComponentRef Id="cmpF014F858B00AE0B720A7FE08B30B3EB1" />
5685+
<ComponentRef Id="cmpEAD7343C628BB6448D8B9C23FEED2670" />
5686+
<ComponentRef Id="cmp9C5A7356715B6922CF2C6EF6678E5438" />
5687+
<ComponentRef Id="cmpFB234DD31894792E945113104A74B825" />
5688+
<ComponentRef Id="cmp713E95E10701AE42E677F85985EF5EFD" />
5689+
<ComponentRef Id="cmp290EA0EFCA235BE56E601E04CD55529C" />
5690+
<ComponentRef Id="cmp9DF62AE934C12CD1C2509F5CBC7ACCC2" />
5691+
<ComponentRef Id="cmpBD05C950174A0082397685E34790466C" />
5692+
<ComponentRef Id="cmp0839FD185FCF6A5CB3FD2D5B60F3F7F9" />
5693+
<ComponentRef Id="cmpEEDB2B1FAA819BCCB82AACA4DBB55454" />
5694+
<ComponentRef Id="cmpEA35AAE5DB03CF2BDF02C837A44F245E" />
5695+
<ComponentRef Id="cmpD1FC76E65489062469C50C713650E4DA" />
5696+
<ComponentRef Id="cmp8B109EB15D9BB6477BF9438D6CE54F36" />
5697+
<ComponentRef Id="cmpC67DEF5E50A9AC7AD357BBD3E42D17F0" />
5698+
<ComponentRef Id="cmp85D9C31F44298BF955EC36A6CF524A23" />
5699+
<ComponentRef Id="cmp1386DCAB186033CD6702183584069933" />
5700+
<ComponentRef Id="cmp5F18344CC8AB2D812EB3916ADE3F495D" />
5701+
<ComponentRef Id="cmpC2EE61265356949E676F1A497AC0DE81" />
5702+
<ComponentRef Id="cmpC2C9E25520A28FDDCB431F0388998F5C" />
5703+
<ComponentRef Id="cmp0F08B96A6FF8A3A0A48A28BA2EB965F1" />
5704+
<ComponentRef Id="cmp4001D1BFC966874B8BC51BE05E07CFC2" />
5705+
<ComponentRef Id="cmp95D2D9407E5DE8CF2C557678B0A4C8FD" />
5706+
<ComponentRef Id="cmp90E88367AB3AF00FB328850E89F31F3F" />
56135707
<ComponentRef Id="cmp70A64104F3BC8D22E626DD19299FC6D6" />
56145708
<ComponentRef Id="cmp557D6FF644755BCB1B0DFE0484A5D177" />
56155709
<ComponentRef Id="cmpBE0E3E756638CA19D98E7AF1B3F91F4C" />
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
16+
using Microsoft.WindowsAzure.Storage;
17+
using Microsoft.WindowsAzure.Storage.Auth;
18+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
19+
using Microsoft.WindowsAzure.Commands.Common.Storage;
20+
using System.Linq;
21+
using System;
22+
using System.Text;
23+
24+
namespace Microsoft.WindowsAzure.Commands.Storage.Adapters
25+
{
26+
public static class AzureContextAdapterExtensions
27+
{
28+
/// <summary>
29+
/// Get the current storage account.
30+
/// </summary>
31+
/// <param name="context">The current Azure context.</param>
32+
/// <returns>The current storage account, or null, if no current storage account is set.</returns>
33+
public static CloudStorageAccount GetCurrentStorageAccount(this IAzureContext context, IStorageServiceProvider provider)
34+
{
35+
if (context != null)
36+
{
37+
var storageConnectionString = context.GetCurrentStorageAccountConnectionString();
38+
try
39+
{
40+
return
41+
CloudStorageAccount.Parse(storageConnectionString);
42+
}
43+
catch
44+
{
45+
var service = provider.GetStorageService(storageConnectionString, null);
46+
return service.GetCloudStorageAccount();
47+
}
48+
}
49+
50+
return null;
51+
}
52+
53+
/// <summary>
54+
/// Get a CloudStorageAccount client for the storage account represented by this context
55+
/// </summary>
56+
/// <param name="context">The storage context for the storage account</param>
57+
/// <returns>A CloudStorageAccount client for storage data plane tasks</returns>
58+
public static CloudStorageAccount GetCloudStorageAccount(this IStorageContext context)
59+
{
60+
CloudStorageAccount result = null;
61+
CloudStorageAccount.TryParse(context.ConnectionString, out result);
62+
return result;
63+
}
64+
65+
/// <summary>
66+
/// Get a CloudStorageAccount client for the storage account represented by this service
67+
/// </summary>
68+
/// <param name="service">The storage service</param>
69+
/// <returns>A CloudStorageAccount client for storage data plane tasks</returns>
70+
public static CloudStorageAccount GetCloudStorageAccount( this IStorageService service)
71+
{
72+
return new CloudStorageAccount(new StorageCredentials(service.Name, service.AuthenticationKeys.First()),
73+
new StorageUri(service.BlobEndpoint), new StorageUri(service.QueueEndpoint),
74+
new StorageUri(service.TableEndpoint), new StorageUri(service.FileEndpoint));
75+
}
76+
77+
/// <summary>
78+
/// Get a storage context client for the storage account represented by this service
79+
/// </summary>
80+
/// <param name="service">The storage service</param>
81+
/// <returns>A CloudStorageAccount client for storage data plane tasks</returns>
82+
public static IStorageContext GetStorageContext(this IStorageService service)
83+
{
84+
return new AzureStorageContext(new CloudStorageAccount(new StorageCredentials(service.Name, service.AuthenticationKeys.First()),
85+
new StorageUri(service.BlobEndpoint), new StorageUri(service.QueueEndpoint),
86+
new StorageUri(service.TableEndpoint), new StorageUri(service.FileEndpoint)));
87+
}
88+
89+
90+
/// <summary>
91+
/// Get a CloudStorageAccount client for the given storage service using the given storage service provider
92+
/// </summary>
93+
/// <param name="provider">The storage service provider to retrieve storage service details</param>
94+
/// <param name="accountName">The storage accoutn name</param>
95+
/// <returns>A CloudStorageAccount client for storage data plane tasks</returns>
96+
public static CloudStorageAccount GetCloudStorageAccount(this IStorageServiceProvider provider, string accountName, string resourceGroupName = null)
97+
{
98+
#if DEBUG
99+
if (TestMockSupport.RunningMocked)
100+
{
101+
return new CloudStorageAccount(new StorageCredentials(accountName,
102+
Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))), true);
103+
}
104+
#endif
105+
return provider.GetStorageService(accountName, resourceGroupName).GetCloudStorageAccount();
106+
}
107+
108+
109+
110+
/// <summary>
111+
/// Get a CloudStorageAccount client for the current storage service using the given storage service provider
112+
/// </summary>
113+
/// <param name="context">The current Azure context.</param>
114+
/// <param name="provider">The storage service provider to retrieve storage service details</param>
115+
/// <returns>A CloudStorageAccount client for storage data plane tasks</returns>
116+
public static CloudStorageAccount GetCloudStorageAccount(this IAzureContext context, IStorageServiceProvider provider)
117+
{
118+
CloudStorageAccount account;
119+
var storageConnectionString = context.GetCurrentStorageAccountConnectionString();
120+
if(!CloudStorageAccount.TryParse(storageConnectionString, out account))
121+
{
122+
if (null == provider)
123+
{
124+
throw new ArgumentNullException("provider");
125+
}
126+
127+
account = provider.GetCloudStorageAccount(storageConnectionString);
128+
}
129+
130+
return account;
131+
}
132+
133+
}
134+
}

0 commit comments

Comments
 (0)