Skip to content

Commit

Permalink
Merge release/1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs committed Jun 7, 2016
2 parents 0932254 + eec28e8 commit cc06c8f
Show file tree
Hide file tree
Showing 109 changed files with 2,634 additions and 18,382 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OpenStack.NET

Need Help? Email us at [[email protected]](mailto:[email protected]).

[![Join the chat at https://gitter.im/openstacknetsdk/openstack.net](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/openstacknetsdk/openstack.net?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

OpenStack.NET is an OpenStack .NET SDK, written for the Microsoft .NET platform, is designed to enable developers to seamlessly work with
Expand Down
8 changes: 5 additions & 3 deletions src/Documentation/AdditionalReferenceDocumentation.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
<Argument Key="maxVersionParts" Value="" xmlns="" />
</TransformComponentArguments>
<DocumentationSources>
<DocumentationSource sourceFile="..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll" />
<DocumentationSource sourceFile="..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.xml" />
<DocumentationSource sourceFile="..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll" />
<DocumentationSource sourceFile="..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.xml" />
<DocumentationSource sourceFile="..\packages\SimpleRESTServices.1.3.0.1\lib\net40\SimpleRESTServices.dll" />
<DocumentationSource sourceFile="..\packages\SimpleRESTServices.1.3.0.1\lib\net40\SimpleRESTServices.xml" />
</DocumentationSources>
<PlugInConfigurations>
</PlugInConfigurations>
</PropertyGroup>
<!-- There are no properties for these groups. AnyCPU needs to appear in order for Visual Studio to perform
the build. The others are optional common platform types that may appear. -->
Expand All @@ -56,4 +58,4 @@
</ItemGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
</Project>
</Project>
23 changes: 9 additions & 14 deletions src/Documentation/Documentation.v4.0.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,8 @@
</versions>
</configuration>
</PlugInConfig>
<PlugInConfig id="Additional Reference Links" enabled="True">
<configuration>
<targets>
<target htmlSdkLinkType="None" help2SdkLinkType="Index" helpViewerSdkLinkType="Id" websiteSdkLinkType="None" helpFileProject="AdditionalReferenceDocumentation.shfbproj" />
</targets>
</configuration>
</PlugInConfig>
</PlugInConfigurations>
<PlugInConfig id="Additional Reference Links" enabled="True"><configuration><targets><target htmlSdkLinkType="None" help2SdkLinkType="Index" helpViewerSdkLinkType="Id" websiteSdkLinkType="None" helpFileProject="AdditionalReferenceDocumentation.shfbproj" /></targets></configuration></PlugInConfig>
<PlugInConfig id="Assembly Binding Redirection" enabled="True"><configuration useGAC="false"><assemblyBinding><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /></dependentAssembly></assemblyBinding><ignoreIfUnresolved /></configuration></PlugInConfig></PlugInConfigurations>
<ApiFilter>
<Filter entryType="Namespace" fullName="Flurl.Extensions" isExposed="False" />
<Filter entryType="Namespace" fullName="Flurl.Http" isExposed="False" />
Expand All @@ -129,11 +123,12 @@
<HelpAttributes />
<NamespaceSummaries>
<NamespaceSummaryItem name="Flurl.Http" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Compute.v2_1.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Compute.v2_2.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Compute.v2_6.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Synchronous" isDocumented="True" /></NamespaceSummaries>
<NamespaceSummaryItem name="OpenStack.Compute.v2_1.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Compute.v2_2.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Compute.v2_6.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Serialization" isDocumented="False" />
<NamespaceSummaryItem name="OpenStack.Synchronous" isDocumented="True" />
</NamespaceSummaries>
<BuildLogFile />
<HtmlHelp1xCompilerPath />
<HtmlHelp2xCompilerPath />
Expand Down Expand Up @@ -190,4 +185,4 @@
</ItemGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
</Project>
</Project>
13 changes: 12 additions & 1 deletion src/Documentation/History/Current/Documentation.Current.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@
<HelpAttributes />
<NamespaceSummaries />
<PlugInConfigurations>
<PlugInConfig id="Assembly Binding Redirection" enabled="True">
<configuration useGAC="false">
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<ignoreIfUnresolved />
</configuration>
</PlugInConfig>
</PlugInConfigurations>
<BuildLogFile />
<HtmlHelp1xCompilerPath />
Expand All @@ -94,4 +105,4 @@
</PropertyGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Documentation/History/Current/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<package id="Flurl.Http.Signed" version="0.6.2.2015062601" targetFramework="net45" />
<package id="Flurl.Signed" version="1.0.8" targetFramework="net45" />
<package id="Marvin.JsonPatch.Signed" version="0.7.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="SimpleRESTServices" version="1.3.0.1" targetFramework="net40" />
</packages>
33 changes: 33 additions & 0 deletions src/corelib/Compute/v2_1/Actions/AssociateFloatingIPRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Newtonsoft.Json;
using OpenStack.Serialization;

namespace OpenStack.Compute.v2_1
{
/// <summary>
/// Associates a floating IP address to a server.
/// </summary>
[JsonConverterWithConstructor(typeof(RootWrapperConverter), "addFloatingIp")]
public class AssociateFloatingIPRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="AssociateFloatingIPRequest"/> class.
/// </summary>
/// <param name="floatingIPAddress">The floating ip address.</param>
public AssociateFloatingIPRequest(string floatingIPAddress)
{
FloatingIPAddress = floatingIPAddress;
}

/// <summary>
/// The floating IP address.
/// </summary>
[JsonProperty("address")]
public string FloatingIPAddress { get; set; }

/// <summary>
/// The fixed IP address with which you want to associate the floating IP address.
/// </summary>
[JsonProperty("fixed_address")]
public string FixedIPAddress { get; set; }
}
}
13 changes: 12 additions & 1 deletion src/corelib/Compute/v2_1/ComputeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public ComputeService(IAuthenticationProvider authenticationProvider, string reg
return _computeApi.DeleteServerMetadataAsync(serverId, key, cancellationToken);
}


/// <inheritdoc cref="ComputeApi.WaitUntilServerIsDeletedAsync{TServer,TStatus}" />
public Task WaitUntilServerIsDeletedAsync(Identifier serverId, TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null, CancellationToken cancellationToken = default(CancellationToken))
{
Expand Down Expand Up @@ -212,6 +211,18 @@ public ComputeService(IAuthenticationProvider authenticationProvider, string reg
return _computeApi.CancelResizeServerAsync(serverId, cancellationToken);
}

/// <inheritdoc cref="ComputeApi.AssociateFloatingIPAsync" />
public virtual Task AssociateFloatingIPAddressAsync(Identifier serverId, AssociateFloatingIPRequest request, CancellationToken cancellationToken = default(CancellationToken))
{
return _computeApi.AssociateFloatingIPAsync(serverId, request, cancellationToken);
}

/// <inheritdoc cref="ComputeApi.DisassociateFloatingIPAsync" />
public virtual Task DisassociateFloatingIPAsync(Identifier serverId, string floatingIPAddress, CancellationToken cancellationToken = default(CancellationToken))
{
return _computeApi.DisassociateFloatingIPAsync(serverId, floatingIPAddress, cancellationToken);
}

/// <inheritdoc cref="ComputeApi.ListServerActionSummariesAsync{T}" />
public virtual async Task<IEnumerable<ServerActionSummary>> ListServerActionSummariesAsync(Identifier serverId, CancellationToken cancellationToken = default(CancellationToken))
{
Expand Down
12 changes: 12 additions & 0 deletions src/corelib/Compute/v2_1/ComputeServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ public static void CancelResizeServer(this ComputeService service, Identifier se
service.CancelResizeServerAsync(serverId).ForceSynchronous();
}

/// <inheritdoc cref="ComputeService.AssociateFloatingIPAddressAsync" />
public static void AssociateFloatingIPAddressAsync(this ComputeService service, Identifier serverId, AssociateFloatingIPRequest request)
{
service.AssociateFloatingIPAddressAsync(serverId, request).ForceSynchronous();
}

/// <inheritdoc cref="ComputeService.DisassociateFloatingIPAsync" />
public static void DisassociateFloatingIPAsync(this ComputeService service, Identifier serverId, string floatingIPAddress)
{
service.DisassociateFloatingIPAsync(serverId, floatingIPAddress).ForceSynchronous();
}

/// <inheritdoc cref="ComputeService.ListServerActionSummariesAsync" />
public static IEnumerable<ServerActionSummary> ListServerActions(this ComputeService service, Identifier serverId)
{
Expand Down
26 changes: 2 additions & 24 deletions src/corelib/Compute/v2_1/IPProtocol.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
using OpenStack.Serialization;

namespace OpenStack.Compute.v2_1
{
/// <summary>
/// Internet Protocols.
/// </summary>
public class IPProtocol : StringEnumeration
{
/// <summary />
protected IPProtocol(string displayName)
: base(displayName)
{ }

/// <summary>
/// ICMP
/// </summary>
public static readonly IPProtocol ICMP = new IPProtocol("icmp");

/// <summary>
/// TCP
/// </summary>
public static readonly IPProtocol TCP = new IPProtocol("tcp");

/// <summary>
/// UDP
/// </summary>
public static readonly IPProtocol UDP = new IPProtocol("udp");
}
public class IPProtocol : Networking.v2.Serialization.IPProtocol<IPProtocol>
{ }
}
31 changes: 31 additions & 0 deletions src/corelib/Compute/v2_1/Serialization/ComputeApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,37 @@ protected ComputeApi(IServiceType serviceType, IAuthenticationProvider authentic
.SendAsync();
}

/// <summary>
/// Associates a floating IP address to the server.
/// </summary>
/// <param name="serverId">The server identifier.</param>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="ArgumentNullException"></exception>
public virtual Task AssociateFloatingIPAsync(string serverId, object request, CancellationToken cancellationToken = default(CancellationToken))
{
return BuildServerActionRequest(serverId, request, cancellationToken).SendAsync();
}

/// <summary>
/// Disassociate a floating IP address from a server.
/// </summary>
/// <param name="serverId">The server identifier.</param>
/// <param name="floatingIPAddress">The floating IP address to remove.</param>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <exception cref="ArgumentNullException"></exception>
public virtual Task DisassociateFloatingIPAsync(string serverId, string floatingIPAddress, CancellationToken cancellationToken = default(CancellationToken))
{
var request = new
{
removeFloatingIp = new
{
address = floatingIPAddress
}
};
return BuildServerActionRequest(serverId, request, cancellationToken).SendAsync();
}

/// <summary>
/// Builds a server action request, where the server operation is specified in the request body.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
base.WriteJson(writer, value, serializer);

// Serialize scheduler hints
var server = value as ServerCreateDefinition;
dynamic server = value; // Using dynamic so that other vendors can use this converter as well
if (server?.SchedulerHints != null)
{
writer.WritePropertyName("os:scheduler_hints");
base.WriteJson(writer, server.SchedulerHints, serializer);
base.WriteJson(writer, (object)server.SchedulerHints, serializer);
}

writer.WriteEndObject();
Expand Down
36 changes: 34 additions & 2 deletions src/corelib/Compute/v2_1/Server.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Extensions;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -231,15 +232,46 @@ public string AdminPassword

/// <inheritdoc cref="ComputeApi.AttachVolumeAsync{T}" />
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
public virtual async Task<ServerVolume> AttachVolumeAsync(ServerVolumeDefinition volume, CancellationToken cancellationToken = default(CancellationToken))
public async Task<ServerVolume> AttachVolumeAsync(ServerVolumeDefinition volume, CancellationToken cancellationToken = default(CancellationToken))
{
var compute = this.GetOwnerOrThrow<ComputeApi>();
var result = await compute.AttachVolumeAsync<ServerVolume>(Id, volume, cancellationToken).ConfigureAwait(false);
AttachedVolumes.Add(result);
((IChildResource)result).SetParent(this);
return result;
}


/// <inheritdoc cref="ComputeApi.AssociateFloatingIPAsync" />
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
public virtual async Task AssociateFloatingIPAsync(AssociateFloatingIPRequest request, CancellationToken cancellationToken = default(CancellationToken))
{
var compute = this.GetOwnerOrThrow<ComputeApi>();
await compute.AssociateFloatingIPAsync(Id, request, cancellationToken);

Addresses = await compute.ListServerAddressesAsync<ServerAddressCollection>(Id, cancellationToken);
}

/// <inheritdoc cref="ComputeApi.DisassociateFloatingIPAsync" />
/// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
public virtual async Task DisassociateFloatingIPAsync(string floatingIPAddress, CancellationToken cancellationToken = default(CancellationToken))
{
var compute = this.GetOwnerOrThrow<ComputeApi>();
await compute.DisassociateFloatingIPAsync(Id, floatingIPAddress, cancellationToken);

// Remove the address from the current instance immediately
foreach (KeyValuePair<string, IList<ServerAddress>> group in Addresses)
{
foreach (ServerAddress address in group.Value)
{
if (address.Type == AddressType.Floating && address.IP == floatingIPAddress)
{
Addresses[group.Key].Remove(address);
return;
}
}
}
}

/// <summary />
[OnDeserialized]
private void OnDeserializedMethod(StreamingContext context)
Expand Down
12 changes: 12 additions & 0 deletions src/corelib/Compute/v2_1/ServerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ public static void CancelResize(this ServerReference server)
server.CancelResizeAsync().ForceSynchronous();
}

/// <inheritdoc cref="Server.AssociateFloatingIPAsync"/>
public static void AssociateFloatingIP(this Server server, AssociateFloatingIPRequest request)
{
server.AssociateFloatingIPAsync(request).ForceSynchronous();
}

/// <inheritdoc cref="Server.DisassociateFloatingIPAsync"/>
public static void DisassociateFloatingIP(this Server server, string floatingIPAddress)
{
server.DisassociateFloatingIPAsync(floatingIPAddress).ForceSynchronous();
}

/// <inheritdoc cref="ServerReference.ListActionSummariesAsync"/>
public static IEnumerable<ServerActionSummary> ListActionSummaries(this ServerReference server)
{
Expand Down
8 changes: 8 additions & 0 deletions src/corelib/Networking/v2/IPProtocol.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using OpenStack.Networking.v2.Serialization;

namespace OpenStack.Networking.v2
{
/// <inheritdoc />
public class IPProtocol : IPProtocol<IPProtocol>
{ }
}
37 changes: 37 additions & 0 deletions src/corelib/Networking/v2/Layer3/ExternalGateway.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace OpenStack.Networking.v2.Layer3
{
/// <summary>
/// Defines a connection from a router to an external network.
/// </summary>
public class ExternalGateway
{
/// <summary>
/// Initializes a new instance of the <see cref="ExternalGateway"/> class.
/// </summary>
public ExternalGateway()
{
ExternalFixedIPs = new List<IPAddressAssociation>();
}

/// <summary>
/// The external network identifier.
/// </summary>
[JsonProperty("network_id")]
public Identifier ExternalNetworkId { get; set; }

/// <summary>
/// Specifies if source NAT is enabled
/// </summary>
[JsonProperty("enable_snat")]
public bool IsSourceNATEnabled { get; set; }

/// <summary>
/// External fixed IP addresses assigned to the router.
/// </summary>
[JsonProperty("external_fixed_ips")]
public IList<IPAddressAssociation> ExternalFixedIPs { get; set; }
}
}
Loading

0 comments on commit cc06c8f

Please sign in to comment.