Skip to content

Commit 9ad6ce5

Browse files
committed
Merge branch 'release/0.2.0'
2 parents f64e7b6 + 5a4b9fe commit 9ad6ce5

File tree

15 files changed

+182
-68
lines changed

15 files changed

+182
-68
lines changed

GitVersionConfig.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
assembly-versioning-scheme: Major
2+
branches:
3+
develop:
4+
tag: alpha
5+
mode: ContinuousDeployment

build/Rackspace.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<tags>openstack rackspace rackconnect</tags>
1616
<dependencies>
1717
<group targetFramework="4.5">
18-
<dependency id="openstack.net" version="[1.5.0,2.0)" />
18+
<dependency id="openstack.net" version="[1.5.0.1,2.0)" />
1919
</group>
2020
</dependencies>
2121
</metadata>

build/build.proj

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4+
<UsingTask TaskName="GitVersionTask.GetVersion" AssemblyFile="..\packages\GitVersionTask\GitVersionTask.dll"/>
5+
46
<PropertyGroup>
57
<Configuration>Debug</Configuration>
6-
<Version>0.1.0</Version>
7-
8+
<Version>$(bamboo_GitVersion_NuGetVersion)</Version>
89
<NuGet>$(LocalAppData)\NuGet\NuGet.exe</NuGet>
910
<Paket>..\.paket\paket.exe</Paket>
1011
<MSBuild>&quot;$(MSBuildToolsPath)\MSBuild.exe&quot;</MSBuild>
@@ -24,7 +25,13 @@
2425
<CallTarget Targets="Package" />
2526
</Target>
2627

27-
<Target Name="Build" DependsOnTargets="RestorePackages">
28+
<Target Name="GitVersion" DependsOnTargets="RestorePackages" Condition=" '$(Version)' == '' ">
29+
<GitVersionTask.GetVersion SolutionDirectory="..">
30+
<Output TaskParameter="NuGetVersion" PropertyName="Version" />
31+
</GitVersionTask.GetVersion>
32+
</Target>
33+
34+
<Target Name="Build" DependsOnTargets="RestorePackages;GitVersion">
2835
<Exec Command="$(MSBuild) ..\Rackspace.sln /p:Configuration=$(Configuration) /nologo /v:minimal" />
2936
</Target>
3037

@@ -37,6 +44,7 @@
3744
</Target>
3845

3946
<Target Name="RestorePackages" DependsOnTargets="DownloadPaket">
47+
<Delete Files="..\paket.lock" />
4048
<Exec Command="$(Paket) install"/>
4149
</Target>
4250

@@ -72,7 +80,7 @@
7280
<Exec Command="$(NuGet) pack Rackspace.nuspec -OutputDirectory ..\artifacts\packages -Prop Configuration=$(Configuration) -Version $(Version) -Symbols"/>
7381
</Target>
7482

75-
<Target Name="Publish" DependsOnTargets="DownloadNuGet">
83+
<Target Name="PublishNuGet" DependsOnTargets="DownloadNuGet;GitVersion">
7684
<Exec Command="@powershell -NoProfile -ExecutionPolicy unrestricted -File check-nuget-version-exists.ps1 $(Version)" ConsoleToMSBuild="true">
7785
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldPublishToNuGet" />
7886
</Exec>
@@ -83,4 +91,10 @@
8391
<Exec Command="$(NuGet) push ..\artifacts\packages\Rackspace.$(Version).nupkg %25BAMBOO_NUGET_PASSWORD%25"
8492
Condition=" '$(ShouldPublishToNuGet)' == 'True' " />
8593
</Target>
94+
95+
<Target Name="PublishMyGet" DependsOnTargets="DownloadNuGet;GitVersion">
96+
<!-- We don't need to check for existing versions because MyGet lets you overwrite -->
97+
<!-- The environment variable BAMBOO_MYGET_PASSWORD comes from the nuget.password variable defined on the rackspace.net plan in Bamboo -->
98+
<Exec Command="$(NuGet) push ..\artifacts\packages\Rackspace.$(Version).nupkg %25BAMBOO_MYGET_PASSWORD%25 -Source https://www.myget.org/F/rackspace/api/v2"/>
99+
</Target>
86100
</Project>

paket.dependencies

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
source https://www.myget.org/F/openstacknetsdk/api/v2
22
source https://nuget.org/api/v2
33

4-
nuget openstack.net !>= 1.5.0 prerelease
4+
nuget openstack.net !>= 1.5.0.1 prerelease
5+
6+
nuget GitVersionTask 3.1.1
57
nuget moq !>= 4.2
68
nuget EWSoftware.SHFB 2015.7.25
79
nuget EWSoftware.SHFB.NETFramework 4.6.0
810
nuget xunit !~> 2.0.0
911
nuget xunit.runner.console !~> 2.0.0
1012
nuget xunit.runner.visualstudio !~> 2.0.1
13+
14+
# For the samples
15+
source https://www.myget.org/F/rackspace/api/v2
16+
nuget Rackspace prerelease

samples/Rackspace.Samples/AssignPublicIPSamples.cs

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
using System.Threading.Tasks;
44
using net.openstack.Core.Domain;
55
using net.openstack.Providers.Rackspace;
6-
using Rackspace.CloudNetworks;
7-
using Rackspace.CloudNetworks.v2;
6+
using Rackspace.RackConnect.v3;
87

98
public class AssignPublicIPSamples : ISample
109
{
@@ -16,27 +15,54 @@ public async Task Run(string username, string apiKey, string region)
1615
Username = username,
1716
APIKey = apiKey
1817
};
19-
var rackConnectService = new RackConnectService(identity);
20-
var serverService = new CloudServersProvider(identity);
18+
var identityService = new CloudIdentityProvider(identity);
19+
var result = identityService.Authenticate();
2120

22-
Console.WriteLine("Looking up a RackConnect network...");
21+
var serverService = new CloudServersProvider(identity, region, null, null);
22+
var rackConnectService = new RackConnectService(identityService, region);
23+
24+
// Create a cloud server on your hybrid network
25+
Console.WriteLine($"Looking up your RackConnect network in {region}...");
26+
var networks = await rackConnectService.ListNetworksAsync();
27+
var network = networks.FirstOrDefault();
28+
if (network == null)
29+
throw new Exception($"You do not have a Hybrid Cloud / RackConnect network configured in the {region} which is required to run this sample.");
2330

2431
Console.WriteLine("Creating sample cloud server... ");
25-
26-
Console.WriteLine("Assigning a public ip address...");
27-
rackConnectService.AssignPublicIPAsync(server.Id);
32+
// Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
33+
const string ubuntuImageId = "09de0a66-3156-48b4-90a5-1cf25a905207";
34+
// 512MB Standard Instance
35+
const string standardFlavorId = "2";
36+
var requestedServer = serverService.CreateServer("sample", ubuntuImageId, standardFlavorId,
37+
networks: new string[] {network.Id});
38+
serverService.WaitForServerActive(requestedServer.Id);
39+
40+
Console.WriteLine("Allocating a public IP address...");
41+
var ip = await rackConnectService.CreatePublicIPAsync(
42+
new PublicIPCreateDefinition {ShouldRetain = true});
43+
await ip.WaitUntilActiveAsync();
44+
Console.WriteLine($"Acquired {ip.PublicIPv4Address}!");
45+
46+
Console.WriteLine("Assigning the public IP to the sample cloud server...");
47+
await ip.AssignAsync(requestedServer.Id);
48+
await ip.WaitUntilActiveAsync();
49+
2850
Console.WriteLine("Deleting sample cloud server...");
29-
await networkService.DeletePortAsync(samplePort.Id);
30-
await networkService.DeleteNetworkAsync(sampleNetwork.Id);
51+
serverService.DeleteServer(requestedServer.Id);
52+
53+
Console.WriteLine("Deallocating the public IP address...");
54+
await ip.DeleteAsync();
3155
}
3256

3357
public void PrintTasks()
3458
{
3559
Console.WriteLine("This sample will perform the following tasks:");
36-
Console.WriteLine("\t* Create a network");
37-
Console.WriteLine("\t* Add a subnet to the network");
38-
Console.WriteLine("\t* Attach a port to the network");
39-
Console.WriteLine("\t* Delete the network");
60+
Console.WriteLine("\t* Locate a hybrid/RackConnect network");
61+
Console.WriteLine("\t* Create a cloud server on the network");
62+
Console.WriteLine("\t* Allocate a public IP on the network");
63+
Console.WriteLine("\t* Assign the public IP to the cloud server");
64+
Console.WriteLine("\t* Remove the public IP from the cloud server");
65+
Console.WriteLine("\t* Remove the cloud server");
4066
}
4167

4268
}

samples/Rackspace.Samples/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ internal class Program
66
private static readonly Dictionary<int, ISample> _samples = new Dictionary<int, ISample>
77
{
88
{1, new CloudNetworkSamples()},
9-
{1, new AssignPublicIPSamples()}
9+
{2, new AssignPublicIPSamples()}
1010
};
1111

1212
private static void Main()
@@ -37,7 +37,10 @@ private static void Main()
3737
ISample sample = _samples[sampleId];
3838

3939
Console.WriteLine();
40-
Console.WriteLine("Do you want to proceed? [y/N]: ");
40+
sample.PrintTasks();
41+
Console.WriteLine();
42+
43+
Console.Write("Do you want to proceed? [y/N]: ");
4144
var shouldProceed = Console.ReadLine();
4245
if (shouldProceed.ToLower() == "y")
4346
sample.Run(username, apiKey, region).Wait();

samples/Rackspace.Samples/Rackspace.Samples.csproj

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,33 @@
3333
<WarningLevel>4</WarningLevel>
3434
</PropertyGroup>
3535
<ItemGroup>
36-
<Reference Include="openstacknet, Version=1.5.0.0, Culture=neutral, PublicKeyToken=a7b9d24dda86d33e, processorArchitecture=MSIL">
37-
<HintPath>packages\openstack.net.1.5.0-beta-1\lib\net45\openstacknet.dll</HintPath>
36+
<Reference Include="Flurl">
37+
<HintPath>..\..\packages\Flurl.Signed\lib\portable-net40+sl50+win+wpa81+wp80+MonoAndroid10+MonoTouch10\Flurl.dll</HintPath>
38+
</Reference>
39+
<Reference Include="Flurl.Http">
40+
<HintPath>..\..\packages\Flurl.Http.Signed\lib\net45\Flurl.Http.dll</HintPath>
41+
<Private>True</Private>
42+
<Paket>True</Paket>
43+
</Reference>
44+
<Reference Include="Marvin.JsonPatch">
45+
<HintPath>..\..\packages\Marvin.JsonPatch.Signed\lib\portable-net40+win+wpa81\Marvin.JsonPatch.dll</HintPath>
46+
<Private>True</Private>
47+
<Paket>True</Paket>
48+
</Reference>
49+
<Reference Include="Newtonsoft.Json">
50+
<HintPath>..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll</HintPath>
3851
<Private>True</Private>
52+
<Paket>True</Paket>
3953
</Reference>
40-
<Reference Include="Rackspace, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
41-
<HintPath>packages\Rackspace.0.1.0-beta1\lib\net45\Rackspace.dll</HintPath>
54+
<Reference Include="openstacknet">
55+
<HintPath>..\..\packages\openstack.net\lib\net45\openstacknet.dll</HintPath>
4256
<Private>True</Private>
57+
<Paket>True</Paket>
4358
</Reference>
44-
<Reference Include="SimpleRESTServices, Version=1.3.0.0, Culture=neutral, PublicKeyToken=8965cea5c205d3a3, processorArchitecture=MSIL">
45-
<HintPath>packages\SimpleRESTServices.1.3.0.1\lib\net40\SimpleRESTServices.dll</HintPath>
59+
<Reference Include="Rackspace">
60+
<HintPath>..\..\packages\Rackspace\lib\net45\Rackspace.dll</HintPath>
4661
<Private>True</Private>
62+
<Paket>True</Paket>
4763
</Reference>
4864
<Reference Include="System" />
4965
<Reference Include="System.Core" />
@@ -62,14 +78,17 @@
6278
</ItemGroup>
6379
<ItemGroup>
6480
<None Include="App.config" />
65-
<None Include="packages.config" />
81+
<None Include="paket.references" />
6682
</ItemGroup>
6783
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
84+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6985
Other similar extension points exist, see Microsoft.Common.targets.
7086
<Target Name="BeforeBuild">
7187
</Target>
7288
<Target Name="AfterBuild">
7389
</Target>
7490
-->
75-
</Project>
91+
92+
93+
94+
</Project>

samples/Rackspace.Samples/packages.config

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rackspace

src/Rackspace/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
2323
[assembly: Guid("333ac1cb-9b60-4135-b19c-4d9e7fc9762b")]
2424

25-
// Version information for an assembly consists of the following four values:
26-
//
27-
// Major Version
28-
// Minor Version
29-
// Build Number
30-
// Revision
31-
//
32-
[assembly: AssemblyVersion("0.1.0.0")]
33-
[assembly: AssemblyFileVersion("0.1.0.0")]
25+
// Version information is supplied at build time by GitVersion
3426

3527
[assembly: InternalsVisibleTo("Rackspace.UnitTests")]

0 commit comments

Comments
 (0)