Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
7790 lines (7130 sloc) 336 KB
//
// Copyright (c) Microsoft. All rights reserved.
//
// 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.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Common;
using Microsoft.WindowsAzure.Common.Internals;
using Microsoft.WindowsAzure.Management.VirtualNetworks;
using Microsoft.WindowsAzure.Management.VirtualNetworks.Models;
namespace Microsoft.WindowsAzure.Management.VirtualNetworks.Models
{
public partial class ClientRootCertificateCreateParameters
{
private string _certificate;
/// <summary>
/// The new client root certificate to upload, represented as a hex
/// encoded string
/// </summary>
public string Certificate
{
get { return this._certificate; }
set { this._certificate = value; }
}
/// <summary>
/// Initializes a new instance of the
/// ClientRootCertificateCreateParameters class.
/// </summary>
public ClientRootCertificateCreateParameters()
{
}
}
/// <summary>
/// A standard storage response including an HTTP status code and request
/// ID.
/// </summary>
public partial class ClientRootCertificateGetResponse : OperationResponse
{
private string _certificate;
/// <summary>
/// The current client root certificate for the network gateway
/// </summary>
public string Certificate
{
get { return this._certificate; }
set { this._certificate = value; }
}
/// <summary>
/// Initializes a new instance of the ClientRootCertificateGetResponse
/// class.
/// </summary>
public ClientRootCertificateGetResponse()
{
}
}
/// <summary>
/// The response to the list client root certificates request
/// </summary>
public partial class ClientRootCertificateListResponse : OperationResponse, IEnumerable<ClientRootCertificateListResponse.ClientRootCertificate>
{
private IList<ClientRootCertificateListResponse.ClientRootCertificate> _clientRootCertificates;
/// <summary>
/// The list of client root certificates
/// </summary>
public IList<ClientRootCertificateListResponse.ClientRootCertificate> ClientRootCertificates
{
get { return this._clientRootCertificates; }
set { this._clientRootCertificates = value; }
}
/// <summary>
/// Initializes a new instance of the ClientRootCertificateListResponse
/// class.
/// </summary>
public ClientRootCertificateListResponse()
{
this._clientRootCertificates = new List<ClientRootCertificateListResponse.ClientRootCertificate>();
}
/// <summary>
/// Gets the sequence of ClientRootCertificates.
/// </summary>
public IEnumerator<ClientRootCertificateListResponse.ClientRootCertificate> GetEnumerator()
{
return this.ClientRootCertificates.GetEnumerator();
}
/// <summary>
/// Gets the sequence of ClientRootCertificates.
/// </summary>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public partial class ClientRootCertificate
{
private DateTime _expirationTime;
/// <summary>
/// Specifies the time that the certificate will expire.
/// </summary>
public DateTime ExpirationTime
{
get { return this._expirationTime; }
set { this._expirationTime = value; }
}
private string _subject;
/// <summary>
/// Specifies the distinguished name of the certificate issuer.
/// </summary>
public string Subject
{
get { return this._subject; }
set { this._subject = value; }
}
private string _thumbprint;
/// <summary>
/// Specifies the thumbprint of the certificate.
/// </summary>
public string Thumbprint
{
get { return this._thumbprint; }
set { this._thumbprint = value; }
}
/// <summary>
/// Initializes a new instance of the ClientRootCertificate class.
/// </summary>
public ClientRootCertificate()
{
}
}
}
/// <summary>
/// The parameters for the Connect, Disconnect, or Test request
/// </summary>
public partial class GatewayConnectDisconnectOrTestParameters
{
private GatewayConnectionUpdateOperation _operation;
/// <summary>
/// Required. Specifies the operation to perform on the connection. Can
/// be set to Connect, Disconnect or Test to connect to a local
/// network, disconnect from a local network, or test the gateway’s
/// connection to a local network site.
/// </summary>
public GatewayConnectionUpdateOperation Operation
{
get { return this._operation; }
set { this._operation = value; }
}
private string _iPAddress;
/// <summary>
/// Required if operation is set to Test; otherwise not used. Specifies
/// the IP address of the target local network site with which the
/// gateway will test connectivity.
/// </summary>
public string IPAddress
{
get { return this._iPAddress; }
set { this._iPAddress = value; }
}
/// <summary>
/// Initializes a new instance of the
/// GatewayConnectDisconnectOrTestParameters class.
/// </summary>
public GatewayConnectDisconnectOrTestParameters()
{
}
}
/// <summary>
/// Specifies the operation to perform on the connection. Can be set to
/// Connect, Disconnect or Test to connect to a local network, disconnect
/// from a local network, or test the gateway’s connection to a local
/// network site.
/// </summary>
public enum GatewayConnectionUpdateOperation
{
Connect = 0,
Disconnect = 1,
Test = 2,
}
public enum GatewayConnectivityState
{
Connected = 0,
Connecting = 1,
NotConnected = 2,
}
/// <summary>
/// The parameters to the Gateway Create request
/// </summary>
public partial class GatewayCreateParameters
{
private GatewayType _gatewayType;
/// <summary>
/// The routing type for this virtual network gateway.
/// </summary>
public GatewayType GatewayType
{
get { return this._gatewayType; }
set { this._gatewayType = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayCreateParameters class.
/// </summary>
public GatewayCreateParameters()
{
}
}
/// <summary>
/// A management event for the virtual network gateway
/// </summary>
public partial class GatewayEvent
{
private DateTime _timestamp;
/// <summary>
/// The date and time when the event occurred
/// </summary>
public DateTime Timestamp
{
get { return this._timestamp; }
set { this._timestamp = value; }
}
private string _id;
/// <summary>
/// The event ID
/// </summary>
public string Id
{
get { return this._id; }
set { this._id = value; }
}
private string _message;
/// <summary>
/// The event message
/// </summary>
public string Message
{
get { return this._message; }
set { this._message = value; }
}
private string _data;
/// <summary>
/// Additional data associated with this event
/// </summary>
public string Data
{
get { return this._data; }
set { this._data = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayEvent class.
/// </summary>
public GatewayEvent()
{
}
}
/// <summary>
/// The parameters to the Generate VPN Client Package request.
/// </summary>
public partial class GatewayGenerateVpnClientPackageParameters
{
private GatewayProcessorArchitecture _processorArchitecture;
/// <summary>
/// The client processor architecture.
/// </summary>
public GatewayProcessorArchitecture ProcessorArchitecture
{
get { return this._processorArchitecture; }
set { this._processorArchitecture = value; }
}
/// <summary>
/// Initializes a new instance of the
/// GatewayGenerateVpnClientPackageParameters class.
/// </summary>
public GatewayGenerateVpnClientPackageParameters()
{
}
}
/// <summary>
/// The vendor, platform, and os family ofthe requested device
/// configuration script.
/// </summary>
public partial class GatewayGetDeviceConfigurationScriptParameters
{
private string _vendor;
/// <summary>
/// The name of the device vendor
/// </summary>
public string Vendor
{
get { return this._vendor; }
set { this._vendor = value; }
}
private string _platform;
/// <summary>
/// The device platform
/// </summary>
public string Platform
{
get { return this._platform; }
set { this._platform = value; }
}
private string _oSFamily;
/// <summary>
/// The device OS Family
/// </summary>
public string OSFamily
{
get { return this._oSFamily; }
set { this._oSFamily = value; }
}
/// <summary>
/// Initializes a new instance of the
/// GatewayGetDeviceConfigurationScriptParameters class.
/// </summary>
public GatewayGetDeviceConfigurationScriptParameters()
{
}
}
/// <summary>
/// The configuration script returned from the get device configuration
/// script request
/// </summary>
public partial class GatewayGetDeviceConfigurationScriptResponse : OperationResponse
{
private string _configurationScript;
/// <summary>
/// The requested configuration script for the local network device
/// </summary>
public string ConfigurationScript
{
get { return this._configurationScript; }
set { this._configurationScript = value; }
}
/// <summary>
/// Initializes a new instance of the
/// GatewayGetDeviceConfigurationScriptResponse class.
/// </summary>
public GatewayGetDeviceConfigurationScriptResponse()
{
}
}
/// <summary>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or has
/// failed. Note that this status is distinct from the HTTP status code
/// returned for the Get Operation Status operation itself. If the
/// asynchronous operation succeeded, the response body includes the HTTP
/// status code for the successful request. If the asynchronous operation
/// failed, the response body includes the HTTP status code for the failed
/// request, and also includes error information regarding the failure.
/// </summary>
public partial class GatewayGetOperationStatusResponse : OperationResponse
{
private string _id;
/// <summary>
/// The request ID of the asynchronous request. This value is returned
/// in the x-ms-request-id response header of the asynchronous request.
/// </summary>
public string Id
{
get { return this._id; }
set { this._id = value; }
}
private GatewayOperationStatus _status;
/// <summary>
/// The status of the asynchronous request.
/// </summary>
public GatewayOperationStatus Status
{
get { return this._status; }
set { this._status = value; }
}
private HttpStatusCode _httpStatusCode;
/// <summary>
/// The HTTP status code for the asynchronous request.
/// </summary>
public HttpStatusCode HttpStatusCode
{
get { return this._httpStatusCode; }
set { this._httpStatusCode = value; }
}
private GatewayGetOperationStatusResponse.ErrorDetails _error;
/// <summary>
/// If the asynchronous operation failed, the response body includes
/// the HTTP status code for the failed request, and also includes
/// error information regarding the failure.
/// </summary>
public GatewayGetOperationStatusResponse.ErrorDetails Error
{
get { return this._error; }
set { this._error = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayGetOperationStatusResponse
/// class.
/// </summary>
public GatewayGetOperationStatusResponse()
{
}
/// <summary>
/// If the asynchronous operation failed, the response body includes
/// the HTTP status code for the failed request, and also includes
/// error information regarding the failure.
/// </summary>
public partial class ErrorDetails
{
private string _code;
/// <summary>
/// The management service error code returned if the asynchronous
/// request failed.
/// </summary>
public string Code
{
get { return this._code; }
set { this._code = value; }
}
private string _message;
/// <summary>
/// The management service error message returned if the
/// asynchronous request failed.
/// </summary>
public string Message
{
get { return this._message; }
set { this._message = value; }
}
/// <summary>
/// Initializes a new instance of the ErrorDetails class.
/// </summary>
public ErrorDetails()
{
}
}
}
/// <summary>
/// A standard storage response including an HTTP status code and request
/// ID.
/// </summary>
public partial class GatewayGetResponse : OperationResponse
{
private string _state;
/// <summary>
/// The provisioning state of the virtual network gateway
/// </summary>
public string State
{
get { return this._state; }
set { this._state = value; }
}
private string _vipAddress;
/// <summary>
/// The virtual IP address for this virtual network gateway
/// </summary>
public string VipAddress
{
get { return this._vipAddress; }
set { this._vipAddress = value; }
}
private GatewayEvent _lastEvent;
/// <summary>
/// The last recorded event for this virtual network gateway
/// </summary>
public GatewayEvent LastEvent
{
get { return this._lastEvent; }
set { this._lastEvent = value; }
}
private GatewayType _gatewayType;
/// <summary>
/// The type of gateway routing used for this virtual network
/// </summary>
public GatewayType GatewayType
{
get { return this._gatewayType; }
set { this._gatewayType = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayGetResponse class.
/// </summary>
public GatewayGetResponse()
{
}
}
/// <summary>
/// The response to the get shared key request
/// </summary>
public partial class GatewayGetSharedKeyResponse : OperationResponse
{
private string _sharedKey;
/// <summary>
/// Contains the shared key used by the gateway to authenticate
/// connections to sites on a virtual network
/// </summary>
public string SharedKey
{
get { return this._sharedKey; }
set { this._sharedKey = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayGetSharedKeyResponse class.
/// </summary>
public GatewayGetSharedKeyResponse()
{
}
}
/// <summary>
/// The response to a ListConnections request to a Virtual Network Gateway
/// </summary>
public partial class GatewayListConnectionsResponse : OperationResponse, IEnumerable<GatewayListConnectionsResponse.GatewayConnection>
{
private IList<GatewayListConnectionsResponse.GatewayConnection> _connections;
/// <summary>
/// The list of connections
/// </summary>
public IList<GatewayListConnectionsResponse.GatewayConnection> Connections
{
get { return this._connections; }
set { this._connections = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayListConnectionsResponse
/// class.
/// </summary>
public GatewayListConnectionsResponse()
{
this._connections = new List<GatewayListConnectionsResponse.GatewayConnection>();
}
/// <summary>
/// Gets the sequence of Connections.
/// </summary>
public IEnumerator<GatewayListConnectionsResponse.GatewayConnection> GetEnumerator()
{
return this.Connections.GetEnumerator();
}
/// <summary>
/// Gets the sequence of Connections.
/// </summary>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
public partial class GatewayConnection
{
private string _localNetworkSiteName;
/// <summary>
/// The name of the local network site represented by the connection
/// </summary>
public string LocalNetworkSiteName
{
get { return this._localNetworkSiteName; }
set { this._localNetworkSiteName = value; }
}
private GatewayConnectivityState _connectivityState;
/// <summary>
/// The connection state of the site. You can set the connection
/// state to Connected, Connecting or NotConnected.
/// </summary>
public GatewayConnectivityState ConnectivityState
{
get { return this._connectivityState; }
set { this._connectivityState = value; }
}
private GatewayEvent _lastEvent;
/// <summary>
/// A record of the last provisioning event for this connection.
/// </summary>
public GatewayEvent LastEvent
{
get { return this._lastEvent; }
set { this._lastEvent = value; }
}
private long _ingressBytesTransferred;
/// <summary>
/// The number of bytes of data transferred in through this
/// connection since it was started
/// </summary>
public long IngressBytesTransferred
{
get { return this._ingressBytesTransferred; }
set { this._ingressBytesTransferred = value; }
}
private long _egressBytesTransferred;
/// <summary>
/// The number of bytes of data transferred out through this
/// connection since it was started
/// </summary>
public long EgressBytesTransferred
{
get { return this._egressBytesTransferred; }
set { this._egressBytesTransferred = value; }
}
private DateTime _lastConnectionEstablished;
public DateTime LastConnectionEstablished
{
get { return this._lastConnectionEstablished; }
set { this._lastConnectionEstablished = value; }
}
private IList<string> _allocatedIPAddresses;
/// <summary>
/// If LocalNetworkSiteName is defined as VPNClientConnection, this
/// element contains a list of IP addresses (represented as
/// strings) that are assigned to currently connected VPN clients.
/// </summary>
public IList<string> AllocatedIPAddresses
{
get { return this._allocatedIPAddresses; }
set { this._allocatedIPAddresses = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayConnection class.
/// </summary>
public GatewayConnection()
{
this._allocatedIPAddresses = new List<string>();
}
}
}
/// <summary>
/// The respoonse to the get supported platform configuration request
/// </summary>
public partial class GatewayListSupportedDevicesResponse : OperationResponse
{
private string _version;
/// <summary>
/// The version for this device configuration list.
/// </summary>
public string Version
{
get { return this._version; }
set { this._version = value; }
}
private IList<GatewayListSupportedDevicesResponse.Vendor> _vendors;
/// <summary>
/// The set of supported vendors
/// </summary>
public IList<GatewayListSupportedDevicesResponse.Vendor> Vendors
{
get { return this._vendors; }
set { this._vendors = value; }
}
/// <summary>
/// Initializes a new instance of the
/// GatewayListSupportedDevicesResponse class.
/// </summary>
public GatewayListSupportedDevicesResponse()
{
this._vendors = new List<GatewayListSupportedDevicesResponse.Vendor>();
}
/// <summary>
/// The name and supported platforms for the vendor.
/// </summary>
public partial class Vendor
{
private string _name;
/// <summary>
/// The vendor name
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private IList<GatewayListSupportedDevicesResponse.Platform> _platforms;
/// <summary>
/// The supported platforms for the vendor.
/// </summary>
public IList<GatewayListSupportedDevicesResponse.Platform> Platforms
{
get { return this._platforms; }
set { this._platforms = value; }
}
/// <summary>
/// Initializes a new instance of the Vendor class.
/// </summary>
public Vendor()
{
this._platforms = new List<GatewayListSupportedDevicesResponse.Platform>();
}
}
/// <summary>
/// The name and supported OS Families for this vendor on the platform
/// </summary>
public partial class Platform
{
private string _name;
/// <summary>
/// The platform name.
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private IList<GatewayListSupportedDevicesResponse.OSFamily> _oSFamilies;
/// <summary>
/// The supported OS Families for this platform
/// </summary>
public IList<GatewayListSupportedDevicesResponse.OSFamily> OSFamilies
{
get { return this._oSFamilies; }
set { this._oSFamilies = value; }
}
/// <summary>
/// Initializes a new instance of the Platform class.
/// </summary>
public Platform()
{
this._oSFamilies = new List<GatewayListSupportedDevicesResponse.OSFamily>();
}
}
public partial class OSFamily
{
private string _name;
/// <summary>
/// The name of the os family
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
/// <summary>
/// Initializes a new instance of the OSFamily class.
/// </summary>
public OSFamily()
{
}
}
}
/// <summary>
/// A standard storage response including an HTTP status code and request
/// ID.
/// </summary>
public partial class GatewayOperationResponse : OperationResponse
{
private string _operationId;
public string OperationId
{
get { return this._operationId; }
set { this._operationId = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayOperationResponse class.
/// </summary>
public GatewayOperationResponse()
{
}
}
/// <summary>
/// The status of the asynchronous request.
/// </summary>
public enum GatewayOperationStatus
{
/// <summary>
/// The asynchronous request is in progress.
/// </summary>
InProgress = 0,
/// <summary>
/// The asynchronous request succeeded.
/// </summary>
Successful = 1,
/// <summary>
/// The asynchronous request failed.
/// </summary>
Failed = 2,
}
/// <summary>
/// The processor architecture for the generated vpn client package
/// </summary>
public enum GatewayProcessorArchitecture
{
Amd64 = 0,
X86 = 1,
}
/// <summary>
/// Possible values for Gateway Profile
/// </summary>
public enum GatewayProfile
{
Small = 0,
Medium = 1,
Large = 2,
ExtraLarge = 3,
}
/// <summary>
/// Standard states for Virtual Network Gateway Provisioning Events
/// </summary>
public static partial class GatewayProvisioningEventStates
{
public const string NotProvisioned = "NotProvisioned";
public const string Deprovisioning = "Deprovisioning";
public const string Provisioning = "Provisioning";
public const string Provisioned = "Provisioned";
}
/// <summary>
/// The length of shared key to generate
/// </summary>
public partial class GatewayResetSharedKeyParameters
{
private int _keyLength;
/// <summary>
/// The number of bytes in the shared key. Minimum is 1 and maximum is
/// 128
/// </summary>
public int KeyLength
{
get { return this._keyLength; }
set { this._keyLength = value; }
}
/// <summary>
/// Initializes a new instance of the GatewayResetSharedKeyParameters
/// class.
/// </summary>
public GatewayResetSharedKeyParameters()
{
}
}
public enum GatewayType
{
StaticRouting = 0,
DynamicRouting = 1,
}
public enum LocalNetworkConnectionType
{
IPSecurity = 0,
Dedicated = 1,
}
/// <summary>
/// The Get Network Configuration operation response.
/// </summary>
public partial class NetworkGetConfigurationResponse : OperationResponse
{
private string _configuration;
/// <summary>
/// The network configuration for this subscription.
/// </summary>
public string Configuration
{
get { return this._configuration; }
set { this._configuration = value; }
}
/// <summary>
/// Initializes a new instance of the NetworkGetConfigurationResponse
/// class.
/// </summary>
public NetworkGetConfigurationResponse()
{
}
}
/// <summary>
/// The response structure for the Server List operation
/// </summary>
public partial class NetworkListResponse : OperationResponse, IEnumerable<NetworkListResponse.VirtualNetworkSite>
{
private IList<NetworkListResponse.VirtualNetworkSite> _virtualNetworkSites;
public IList<NetworkListResponse.VirtualNetworkSite> VirtualNetworkSites
{
get { return this._virtualNetworkSites; }
set { this._virtualNetworkSites = value; }
}
/// <summary>
/// Initializes a new instance of the NetworkListResponse class.
/// </summary>
public NetworkListResponse()
{
this._virtualNetworkSites = new List<NetworkListResponse.VirtualNetworkSite>();
}
/// <summary>
/// Gets the sequence of VirtualNetworkSites.
/// </summary>
public IEnumerator<NetworkListResponse.VirtualNetworkSite> GetEnumerator()
{
return this.VirtualNetworkSites.GetEnumerator();
}
/// <summary>
/// Gets the sequence of VirtualNetworkSites.
/// </summary>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>
/// Contains the collections of parameters used to configure a virtual
/// network space that is dedicated to your subscription without
/// overlapping with other networks
/// </summary>
public partial class VirtualNetworkSite
{
private string _name;
/// <summary>
/// Name of the virtual network site.
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private string _label;
/// <summary>
/// The friendly identifier of the site.
/// </summary>
public string Label
{
get { return this._label; }
set { this._label = value; }
}
private string _id;
/// <summary>
/// A unique string identifier that represents the virtual network
/// site.
/// </summary>
public string Id
{
get { return this._id; }
set { this._id = value; }
}
private string _affinityGroup;
/// <summary>
/// An affinity group, which indirectly refers to the location
/// where the virtual network exists.
/// </summary>
public string AffinityGroup
{
get { return this._affinityGroup; }
set { this._affinityGroup = value; }
}
private string _state;
/// <summary>
/// Current status of the virtual network. (Created, Creating,
/// Updating, Deleting, Unavailable)
/// </summary>
public string State
{
get { return this._state; }
set { this._state = value; }
}
private NetworkListResponse.AddressSpace _addressSpace;
/// <summary>
/// The list of network address spaces for a virtual network site.
/// This represents the overall network space contained within the
/// virtual network site.
/// </summary>
public NetworkListResponse.AddressSpace AddressSpace
{
get { return this._addressSpace; }
set { this._addressSpace = value; }
}
private IList<NetworkListResponse.Subnet> _subnets;
/// <summary>
/// The list of network subnets for a virtual network site. All
/// network subnets must be contained within the overall virtual
/// network address spaces.
/// </summary>
public IList<NetworkListResponse.Subnet> Subnets
{
get { return this._subnets; }
set { this._subnets = value; }
}
private IList<NetworkListResponse.DnsServer> _dnsServers;
/// <summary>
/// The list of on DNS Servers associated with the virtual network
/// site.
/// </summary>
public IList<NetworkListResponse.DnsServer> DnsServers
{
get { return this._dnsServers; }
set { this._dnsServers = value; }
}
private NetworkListResponse.Gateway _gateway;
/// <summary>
/// Gateway that contains a list of Local Network Sites which
/// enables the Virtual network site to communicate with a
/// customer’s on premise networks.
/// </summary>
public NetworkListResponse.Gateway Gateway
{
get { return this._gateway; }
set { this._gateway = value; }
}
/// <summary>
/// Initializes a new instance of the VirtualNetworkSite class.
/// </summary>
public VirtualNetworkSite()
{
this._subnets = new List<NetworkListResponse.Subnet>();
this._dnsServers = new List<NetworkListResponse.DnsServer>();
}
}
public partial class AddressSpace
{
private IList<string> _addressPrefixes;
/// <summary>
/// Address spaces, in CIDR format in the virtual network
/// </summary>
public IList<string> AddressPrefixes
{
get { return this._addressPrefixes; }
set { this._addressPrefixes = value; }
}
/// <summary>
/// Initializes a new instance of the AddressSpace class.
/// </summary>
public AddressSpace()
{
this._addressPrefixes = new List<string>();
}
}
public partial class Subnet
{
private string _name;
/// <summary>
/// Name for the subnet
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private string _addressPrefix;
/// <summary>
/// Represents an address space, in CIDR format that defines the
/// subnet
/// </summary>
public string AddressPrefix
{
get { return this._addressPrefix; }
set { this._addressPrefix = value; }
}
/// <summary>
/// Initializes a new instance of the Subnet class.
/// </summary>
public Subnet()
{
}
}
public partial class DnsServer
{
private string _name;
/// <summary>
/// The name of the DNS server
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private string _address;
/// <summary>
/// The IPv4 address of the DNS server
/// </summary>
public string Address
{
get { return this._address; }
set { this._address = value; }
}
/// <summary>
/// Initializes a new instance of the DnsServer class.
/// </summary>
public DnsServer()
{
}
}
/// <summary>
/// Contains gateway references to the local network sites that the
/// virtual network can connect to.
/// </summary>
public partial class Gateway
{
private GatewayProfile _profile;
/// <summary>
/// The gateway connection size
/// </summary>
public GatewayProfile Profile
{
get { return this._profile; }
set { this._profile = value; }
}
private IList<NetworkListResponse.LocalNetworkSite> _sites;
/// <summary>
/// The list of local network sites that the virtual network can
/// connect to.
/// </summary>
public IList<NetworkListResponse.LocalNetworkSite> Sites
{
get { return this._sites; }
set { this._sites = value; }
}
private NetworkListResponse.VPNClientAddressPool _vPNClientAddressPool;
/// <summary>
/// The VPNClientAddressPool reserves a pool of IP addresses for
/// VPN clients. This object is used for point-to-site
/// connectivity.
/// </summary>
public NetworkListResponse.VPNClientAddressPool VPNClientAddressPool
{
get { return this._vPNClientAddressPool; }
set { this._vPNClientAddressPool = value; }
}
/// <summary>
/// Initializes a new instance of the Gateway class.
/// </summary>
public Gateway()
{
this._sites = new List<NetworkListResponse.LocalNetworkSite>();
}
}
/// <summary>
/// Contains the list of parameters defining the local network site.
/// </summary>
public partial class LocalNetworkSite
{
private string _name;
/// <summary>
/// The name of the local network site
/// </summary>
public string Name
{
get { return this._name; }
set { this._name = value; }
}
private string _vpnGatewayAddress;
/// <summary>
/// The IPv4 address of the local network site
/// </summary>
public string VpnGatewayAddress
{
get { return this._vpnGatewayAddress; }
set { this._vpnGatewayAddress = value; }
}
private NetworkListResponse.AddressSpace _addressSpace;
/// <summary>
/// The address space of the local network site
/// </summary>
public NetworkListResponse.AddressSpace AddressSpace
{
get { return this._addressSpace; }
set { this._addressSpace = value; }
}
private IList<NetworkListResponse.Connection> _connections;
/// <summary>
/// Specifies the types of connections to the local network site
/// </summary>
public IList<NetworkListResponse.Connection> Connections
{
get { return this._connections; }
set { this._connections = value; }
}
/// <summary>
/// Initializes a new instance of the LocalNetworkSite class.
/// </summary>
public LocalNetworkSite()
{
this._connections = new List<NetworkListResponse.Connection>();
}
}
/// <summary>
/// Specifies the type of connection of the local network site. The
/// value of this element can be either IPsec or Dedicated. The
/// default value is IPsec.
/// </summary>
public partial class Connection
{
private LocalNetworkConnectionType _type;
public LocalNetworkConnectionType Type
{
get { return this._type; }
set { this._type = value; }
}
/// <summary>
/// Initializes a new instance of the Connection class.
/// </summary>
public Connection()
{
}
}
/// <summary>
/// The VPNClientAddressPool reserves a pool of IP addresses for VPN
/// clients. This object is used for point-to-site connectivity.
/// </summary>
public partial class VPNClientAddressPool
{
private IList<string> _addressPrefixes;
/// <summary>
/// The CIDR identifiers that identify addresses in the pool.
/// </summary>
public IList<string> AddressPrefixes
{
get { return this._addressPrefixes; }
set { this._addressPrefixes = value; }
}
/// <summary>
/// Initializes a new instance of the VPNClientAddressPool class.
/// </summary>
public VPNClientAddressPool()
{
this._addressPrefixes = new List<string>();
}
}
}
/// <summary>
/// Parameters supplied to the Set Network Configuration operation.
/// </summary>
public partial class NetworkSetConfigurationParameters
{
private string _configuration;
/// <summary>
/// The network configuration for this subscription.
/// </summary>
public string Configuration
{
get { return this._configuration; }
set { this._configuration = value; }
}
/// <summary>
/// Initializes a new instance of the NetworkSetConfigurationParameters
/// class.
/// </summary>
public NetworkSetConfigurationParameters()
{
}
}
/// <summary>
/// The status of the asynchronous request.
/// </summary>
public enum OperationStatus
{
/// <summary>
/// The asynchronous request is in progress.
/// </summary>
InProgress = 0,
/// <summary>
/// The asynchronous request succeeded.
/// </summary>
Succeeded = 1,
/// <summary>
/// The asynchronous request failed.
/// </summary>
Failed = 2,
}
/// <summary>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or has
/// failed. Note that this status is distinct from the HTTP status code
/// returned for the Get Operation Status operation itself. If the
/// asynchronous operation succeeded, the response body includes the HTTP
/// status code for the successful request. If the asynchronous operation
/// failed, the response body includes the HTTP status code for the failed
/// request, and also includes error information regarding the failure.
/// </summary>
public partial class VirtualNetworkOperationStatusResponse : OperationResponse
{
private string _id;
/// <summary>
/// The request ID of the asynchronous request. This value is returned
/// in the x-ms-request-id response header of the asynchronous request.
/// </summary>
public string Id
{
get { return this._id; }
set { this._id = value; }
}
private OperationStatus _status;
/// <summary>
/// The status of the asynchronous request.
/// </summary>
public OperationStatus Status
{
get { return this._status; }
set { this._status = value; }
}
private HttpStatusCode _httpStatusCode;
/// <summary>
/// The HTTP status code for the asynchronous request.
/// </summary>
public HttpStatusCode HttpStatusCode
{
get { return this._httpStatusCode; }
set { this._httpStatusCode = value; }
}
private VirtualNetworkOperationStatusResponse.ErrorDetails _error;
/// <summary>
/// If the asynchronous operation failed, the response body includes
/// the HTTP status code for the failed request, and also includes
/// error information regarding the failure.
/// </summary>
public VirtualNetworkOperationStatusResponse.ErrorDetails Error
{
get { return this._error; }
set { this._error = value; }
}
/// <summary>
/// Initializes a new instance of the
/// VirtualNetworkOperationStatusResponse class.
/// </summary>
public VirtualNetworkOperationStatusResponse()
{
}
/// <summary>
/// If the asynchronous operation failed, the response body includes
/// the HTTP status code for the failed request, and also includes
/// error information regarding the failure.
/// </summary>
public partial class ErrorDetails
{
private string _code;
/// <summary>
/// The management service error code returned if the asynchronous
/// request failed.
/// </summary>
public string Code
{
get { return this._code; }
set { this._code = value; }
}
private string _message;
/// <summary>
/// The management service error message returned if the
/// asynchronous request failed.
/// </summary>
public string Message
{
get { return this._message; }
set { this._message = value; }
}
/// <summary>
/// Initializes a new instance of the ErrorDetails class.
/// </summary>
public ErrorDetails()
{
}
}
}
public static partial class VirtualNetworkState
{
public const string Created = "Created";
public const string Creating = "Creating";
public const string Updating = "Updating";
public const string Deleting = "Deleting";
public const string Unavailable = "Unavailable";
}
}
namespace Microsoft.WindowsAzure.Management.VirtualNetworks
{
/// <summary>
/// The Service Management API includes operations for managing the virtual
/// networks your subscription. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj157182.aspx for
/// more information)
/// </summary>
public partial interface IVirtualNetworkManagementClient
{
/// <summary>
/// When you create a Windows Azure subscription, it is uniquely
/// identified by a subscription ID. The subscription ID forms part of
/// the URI for every call that you make to the Service Management
/// API. The Windows Azure Service ManagementAPI use mutual
/// authentication of management certificates over SSL to ensure that
/// a request made to the service is secure. No anonymous requests
/// are allowed.
/// </summary>
SubscriptionCloudCredentials Credentials
{
get;
}
/// <summary>
/// The URI used as the base for all SQL requests.
/// </summary>
Uri BaseUri
{
get;
}
IClientRootCertificateOperations ClientRootCertificates
{
get;
}
IGatewayOperations Gateways
{
get;
}
INetworkOperations Networks
{
get;
}
/// <summary>
/// The Get Operation Status operation returns the status of
/// thespecified operation. After calling an asynchronous operation,
/// you can call Get Operation Status to determine whether the
/// operation has succeeded, failed, or is still in progress. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx
/// for more information)
/// </summary>
/// <param name='requestId'>
/// The request ID for the request you wish to track. The request ID is
/// returned in the x-ms-request-id response header for every request.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<VirtualNetworkOperationStatusResponse> GetOperationStatusAsync(string requestId, CancellationToken cancellationToken);
}
/// <summary>
/// The Service Management API includes operations for managing the virtual
/// networks your subscription. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj157182.aspx for
/// more information)
/// </summary>
public static partial class VirtualNetworkManagementClientExtensions
{
/// <summary>
/// The Get Operation Status operation returns the status of
/// thespecified operation. After calling an asynchronous operation,
/// you can call Get Operation Status to determine whether the
/// operation has succeeded, failed, or is still in progress. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IVirtualNetworkManagementClient.
/// </param>
/// <param name='requestId'>
/// The request ID for the request you wish to track. The request ID is
/// returned in the x-ms-request-id response header for every request.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static VirtualNetworkOperationStatusResponse GetOperationStatus(this IVirtualNetworkManagementClient operations, string requestId)
{
try
{
return operations.GetOperationStatusAsync(requestId).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Get Operation Status operation returns the status of
/// thespecified operation. After calling an asynchronous operation,
/// you can call Get Operation Status to determine whether the
/// operation has succeeded, failed, or is still in progress. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IVirtualNetworkManagementClient.
/// </param>
/// <param name='requestId'>
/// The request ID for the request you wish to track. The request ID is
/// returned in the x-ms-request-id response header for every request.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static Task<VirtualNetworkOperationStatusResponse> GetOperationStatusAsync(this IVirtualNetworkManagementClient operations, string requestId)
{
return operations.GetOperationStatusAsync(requestId, CancellationToken.None);
}
}
/// <summary>
/// The Service Management API includes operations for managing the virtual
/// networks your subscription. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj157182.aspx for
/// more information)
/// </summary>
public partial class VirtualNetworkManagementClient : ServiceClient<VirtualNetworkManagementClient>, IVirtualNetworkManagementClient
{
private SubscriptionCloudCredentials _credentials;
/// <summary>
/// When you create a Windows Azure subscription, it is uniquely
/// identified by a subscription ID. The subscription ID forms part of
/// the URI for every call that you make to the Service Management
/// API. The Windows Azure Service ManagementAPI use mutual
/// authentication of management certificates over SSL to ensure that
/// a request made to the service is secure. No anonymous requests
/// are allowed.
/// </summary>
public SubscriptionCloudCredentials Credentials
{
get { return this._credentials; }
}
private Uri _baseUri;
/// <summary>
/// The URI used as the base for all SQL requests.
/// </summary>
public Uri BaseUri
{
get { return this._baseUri; }
}
private IClientRootCertificateOperations _clientRootCertificates;
public virtual IClientRootCertificateOperations ClientRootCertificates
{
get { return this._clientRootCertificates; }
}
private IGatewayOperations _gateways;
public virtual IGatewayOperations Gateways
{
get { return this._gateways; }
}
private INetworkOperations _networks;
public virtual INetworkOperations Networks
{
get { return this._networks; }
}
/// <summary>
/// Initializes a new instance of the VirtualNetworkManagementClient
/// class.
/// </summary>
private VirtualNetworkManagementClient()
: base()
{
this._clientRootCertificates = new ClientRootCertificateOperations(this);
this._gateways = new GatewayOperations(this);
this._networks = new NetworkOperations(this);
this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
}
/// <summary>
/// Initializes a new instance of the VirtualNetworkManagementClient
/// class.
/// </summary>
/// <param name='credentials'>
/// When you create a Windows Azure subscription, it is uniquely
/// identified by a subscription ID. The subscription ID forms part of
/// the URI for every call that you make to the Service Management
/// API. The Windows Azure Service ManagementAPI use mutual
/// authentication of management certificates over SSL to ensure that
/// a request made to the service is secure. No anonymous requests
/// are allowed.
/// </param>
/// <param name='baseUri'>
/// The URI used as the base for all SQL requests.
/// </param>
public VirtualNetworkManagementClient(SubscriptionCloudCredentials credentials, Uri baseUri)
: this()
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (baseUri == null)
{
throw new ArgumentNullException("baseUri");
}
this._credentials = credentials;
this._baseUri = baseUri;
this.Credentials.InitializeServiceClient(this);
}
/// <summary>
/// Initializes a new instance of the VirtualNetworkManagementClient
/// class.
/// </summary>
/// <param name='credentials'>
/// When you create a Windows Azure subscription, it is uniquely
/// identified by a subscription ID. The subscription ID forms part of
/// the URI for every call that you make to the Service Management
/// API. The Windows Azure Service ManagementAPI use mutual
/// authentication of management certificates over SSL to ensure that
/// a request made to the service is secure. No anonymous requests
/// are allowed.
/// </param>
public VirtualNetworkManagementClient(SubscriptionCloudCredentials credentials)
: this()
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
this._credentials = credentials;
this._baseUri = new Uri("https://management.core.windows.net");
this.Credentials.InitializeServiceClient(this);
}
/// <summary>
/// The Get Operation Status operation returns the status of
/// thespecified operation. After calling an asynchronous operation,
/// you can call Get Operation Status to determine whether the
/// operation has succeeded, failed, or is still in progress. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx
/// for more information)
/// </summary>
/// <param name='requestId'>
/// The request ID for the request you wish to track. The request ID is
/// returned in the x-ms-request-id response header for every request.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public async Task<VirtualNetworkOperationStatusResponse> GetOperationStatusAsync(string requestId, CancellationToken cancellationToken)
{
// Validate
if (requestId == null)
{
throw new ArgumentNullException("requestId");
}
// Tracing
bool shouldTrace = CloudContext.Configuration.Tracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = Tracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("requestId", requestId);
Tracing.Enter(invocationId, this, "GetOperationStatusAsync", tracingParameters);
}
// Construct URL
string url = this.BaseUri + "/" + this.Credentials.SubscriptionId + "/operations/" + requestId;
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.Add("x-ms-version", "2012-03-01");
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
Tracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
Tracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.CreateFromXml(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
Tracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
VirtualNetworkOperationStatusResponse result = new VirtualNetworkOperationStatusResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
XDocument responseDoc = XDocument.Parse(responseContent);
XElement operationElement = responseDoc.Element(XName.Get("Operation", "http://schemas.microsoft.com/windowsazure"));
if (operationElement != null)
{
XElement idElement = operationElement.Element(XName.Get("ID", "http://schemas.microsoft.com/windowsazure"));
if (idElement != null)
{
string idInstance = idElement.Value;
result.Id = idInstance;
}
XElement statusElement = operationElement.Element(XName.Get("Status", "http://schemas.microsoft.com/windowsazure"));
if (statusElement != null)
{
OperationStatus statusInstance = (OperationStatus)Enum.Parse(typeof(OperationStatus), statusElement.Value, false);
result.Status = statusInstance;
}
XElement httpStatusCodeElement = operationElement.Element(XName.Get("HttpStatusCode", "http://schemas.microsoft.com/windowsazure"));
if (httpStatusCodeElement != null)
{
HttpStatusCode httpStatusCodeInstance = (HttpStatusCode)Enum.Parse(typeof(HttpStatusCode), httpStatusCodeElement.Value, false);
result.HttpStatusCode = httpStatusCodeInstance;
}
XElement errorElement = operationElement.Element(XName.Get("Error", "http://schemas.microsoft.com/windowsazure"));
if (errorElement != null)
{
VirtualNetworkOperationStatusResponse.ErrorDetails errorInstance = new VirtualNetworkOperationStatusResponse.ErrorDetails();
result.Error = errorInstance;
XElement codeElement = errorElement.Element(XName.Get("Code", "http://schemas.microsoft.com/windowsazure"));
if (codeElement != null)
{
string codeInstance = codeElement.Value;
errorInstance.Code = codeInstance;
}
XElement messageElement = errorElement.Element(XName.Get("Message", "http://schemas.microsoft.com/windowsazure"));
if (messageElement != null)
{
string messageInstance = messageElement.Value;
errorInstance.Message = messageInstance;
}
}
}
if (shouldTrace)
{
Tracing.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// Parse enum values for type LocalNetworkConnectionType.
/// </summary>
/// <param name='value'>
/// The value to parse.
/// </param>
/// <returns>
/// The enum value.
/// </returns>
internal static LocalNetworkConnectionType ParseLocalNetworkConnectionType(string value)
{
if (value == "IPsec")
{
return LocalNetworkConnectionType.IPSecurity;
}
if (value == "Dedicated")
{
return LocalNetworkConnectionType.Dedicated;
}
throw new ArgumentOutOfRangeException("value");
}
/// <summary>
/// Convert an enum of type LocalNetworkConnectionType to a string.
/// </summary>
/// <param name='value'>
/// The value to convert to a string.
/// </param>
/// <returns>
/// The enum value as a string.
/// </returns>
internal static string LocalNetworkConnectionTypeToString(LocalNetworkConnectionType value)
{
if (value == LocalNetworkConnectionType.IPSecurity)
{
return "IPsec";
}
if (value == LocalNetworkConnectionType.Dedicated)
{
return "Dedicated";
}
throw new ArgumentOutOfRangeException("value");
}
}
public partial interface IClientRootCertificateOperations
{
/// <summary>
/// The Delete Client Root Certificate operation deletes a previously
/// uploaded client root certificate. from Windows Azure (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205128.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> DeleteAsync(string virtualNetworkName, string certificateThumbprint, CancellationToken cancellationToken);
/// <summary>
/// The Get Client Root Certificate operation returns the public
/// portion of a previously uploaded client root certificate in a
/// base-64 encoded format from Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205127.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<ClientRootCertificateGetResponse> GetAsync(string virtualNetworkName, string certificateThumbprint, CancellationToken cancellationToken);
/// <summary>
/// The List Client Root Certificates operation returns a list of all
/// the client root certificates that are associated with the
/// specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205130.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response to the list client root certificates request
/// </returns>
Task<ClientRootCertificateListResponse> ListAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Upload Client Root Certificate operation is used to upload a
/// new client root certificate to Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205129.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Upload client certificate Virtual
/// Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> CreateAsync(string virtualNetworkName, ClientRootCertificateCreateParameters parameters, CancellationToken cancellationToken);
}
public static partial class ClientRootCertificateOperationsExtensions
{
/// <summary>
/// The Delete Client Root Certificate operation deletes a previously
/// uploaded client root certificate. from Windows Azure (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205128.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static GatewayOperationResponse Delete(this IClientRootCertificateOperations operations, string virtualNetworkName, string certificateThumbprint)
{
try
{
return operations.DeleteAsync(virtualNetworkName, certificateThumbprint).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Delete Client Root Certificate operation deletes a previously
/// uploaded client root certificate. from Windows Azure (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205128.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static Task<GatewayOperationResponse> DeleteAsync(this IClientRootCertificateOperations operations, string virtualNetworkName, string certificateThumbprint)
{
return operations.DeleteAsync(virtualNetworkName, certificateThumbprint, CancellationToken.None);
}
/// <summary>
/// The Get Client Root Certificate operation returns the public
/// portion of a previously uploaded client root certificate in a
/// base-64 encoded format from Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205127.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static ClientRootCertificateGetResponse Get(this IClientRootCertificateOperations operations, string virtualNetworkName, string certificateThumbprint)
{
try
{
return operations.GetAsync(virtualNetworkName, certificateThumbprint).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Get Client Root Certificate operation returns the public
/// portion of a previously uploaded client root certificate in a
/// base-64 encoded format from Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205127.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static Task<ClientRootCertificateGetResponse> GetAsync(this IClientRootCertificateOperations operations, string virtualNetworkName, string certificateThumbprint)
{
return operations.GetAsync(virtualNetworkName, certificateThumbprint, CancellationToken.None);
}
/// <summary>
/// The List Client Root Certificates operation returns a list of all
/// the client root certificates that are associated with the
/// specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205130.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <returns>
/// The response to the list client root certificates request
/// </returns>
public static ClientRootCertificateListResponse List(this IClientRootCertificateOperations operations, string virtualNetworkName)
{
try
{
return operations.ListAsync(virtualNetworkName).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The List Client Root Certificates operation returns a list of all
/// the client root certificates that are associated with the
/// specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205130.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <returns>
/// The response to the list client root certificates request
/// </returns>
public static Task<ClientRootCertificateListResponse> ListAsync(this IClientRootCertificateOperations operations, string virtualNetworkName)
{
return operations.ListAsync(virtualNetworkName, CancellationToken.None);
}
/// <summary>
/// The Upload Client Root Certificate operation is used to upload a
/// new client root certificate to Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205129.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Upload client certificate Virtual
/// Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static GatewayOperationResponse Create(this IClientRootCertificateOperations operations, string virtualNetworkName, ClientRootCertificateCreateParameters parameters)
{
try
{
return operations.CreateAsync(virtualNetworkName, parameters).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Upload Client Root Certificate operation is used to upload a
/// new client root certificate to Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205129.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IClientRootCertificateOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Upload client certificate Virtual
/// Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static Task<GatewayOperationResponse> CreateAsync(this IClientRootCertificateOperations operations, string virtualNetworkName, ClientRootCertificateCreateParameters parameters)
{
return operations.CreateAsync(virtualNetworkName, parameters, CancellationToken.None);
}
}
internal partial class ClientRootCertificateOperations : IServiceOperations<VirtualNetworkManagementClient>, IClientRootCertificateOperations
{
/// <summary>
/// Initializes a new instance of the ClientRootCertificateOperations
/// class.
/// </summary>
/// <param name='client'>
/// Reference to the service client.
/// </param>
internal ClientRootCertificateOperations(VirtualNetworkManagementClient client)
{
this._client = client;
}
private VirtualNetworkManagementClient _client;
/// <summary>
/// Gets a reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.VirtualNetworkManagementClient.
/// </summary>
public VirtualNetworkManagementClient Client
{
get { return this._client; }
}
/// <summary>
/// The Delete Client Root Certificate operation deletes a previously
/// uploaded client root certificate. from Windows Azure (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205128.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public async Task<GatewayOperationResponse> DeleteAsync(string virtualNetworkName, string certificateThumbprint, CancellationToken cancellationToken)
{
// Validate
if (virtualNetworkName == null)
{
throw new ArgumentNullException("virtualNetworkName");
}
if (certificateThumbprint == null)
{
throw new ArgumentNullException("certificateThumbprint");
}
// Tracing
bool shouldTrace = CloudContext.Configuration.Tracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = Tracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("virtualNetworkName", virtualNetworkName);
tracingParameters.Add("certificateThumbprint", certificateThumbprint);
Tracing.Enter(invocationId, this, "DeleteAsync", tracingParameters);
}
// Construct URL
string url = this.Client.BaseUri + "/" + this.Client.Credentials.SubscriptionId + "/services/networking/" + virtualNetworkName + "/gateway/clientrootcertificates/" + certificateThumbprint;
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Delete;
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.Add("x-ms-version", "2012-03-01");
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
Tracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
Tracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.CreateFromXml(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
Tracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
GatewayOperationResponse result = new GatewayOperationResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
XDocument responseDoc = XDocument.Parse(responseContent);
XElement gatewayOperationAsyncResponseElement = responseDoc.Element(XName.Get("GatewayOperationAsyncResponse", "http://schemas.microsoft.com/windowsazure"));
if (gatewayOperationAsyncResponseElement != null)
{
XElement idElement = gatewayOperationAsyncResponseElement.Element(XName.Get("ID", "http://schemas.microsoft.com/windowsazure"));
if (idElement != null)
{
string idInstance = idElement.Value;
result.OperationId = idInstance;
}
}
if (shouldTrace)
{
Tracing.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// The Get Client Root Certificate operation returns the public
/// portion of a previously uploaded client root certificate in a
/// base-64 encoded format from Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205127.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='certificateThumbprint'>
/// The X509 certificate thumbprint
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public async Task<ClientRootCertificateGetResponse> GetAsync(string virtualNetworkName, string certificateThumbprint, CancellationToken cancellationToken)
{
// Validate
if (virtualNetworkName == null)
{
throw new ArgumentNullException("virtualNetworkName");
}
if (certificateThumbprint == null)
{
throw new ArgumentNullException("certificateThumbprint");
}
// Tracing
bool shouldTrace = CloudContext.Configuration.Tracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = Tracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("virtualNetworkName", virtualNetworkName);
tracingParameters.Add("certificateThumbprint", certificateThumbprint);
Tracing.Enter(invocationId, this, "GetAsync", tracingParameters);
}
// Construct URL
string url = this.Client.BaseUri + "/" + this.Client.Credentials.SubscriptionId + "/services/networking/" + virtualNetworkName + "/gateway/clientrootcertificates/" + certificateThumbprint;
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.Add("x-ms-version", "2012-03-01");
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
Tracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
Tracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.CreateFromXml(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
Tracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
ClientRootCertificateGetResponse result = new ClientRootCertificateGetResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
result.Certificate = responseContent;
if (shouldTrace)
{
Tracing.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// The List Client Root Certificates operation returns a list of all
/// the client root certificates that are associated with the
/// specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205130.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response to the list client root certificates request
/// </returns>
public async Task<ClientRootCertificateListResponse> ListAsync(string virtualNetworkName, CancellationToken cancellationToken)
{
// Validate
if (virtualNetworkName == null)
{
throw new ArgumentNullException("virtualNetworkName");
}
// Tracing
bool shouldTrace = CloudContext.Configuration.Tracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = Tracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("virtualNetworkName", virtualNetworkName);
Tracing.Enter(invocationId, this, "ListAsync", tracingParameters);
}
// Construct URL
string url = this.Client.BaseUri + "/" + this.Client.Credentials.SubscriptionId + "/services/networking/" + virtualNetworkName + "/gateway/clientrootcertificates";
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.Add("x-ms-version", "2012-03-01");
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
Tracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
Tracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.OK)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.CreateFromXml(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
Tracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
ClientRootCertificateListResponse result = new ClientRootCertificateListResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
XDocument responseDoc = XDocument.Parse(responseContent);
XElement clientRootCertificatesSequenceElement = responseDoc.Element(XName.Get("ClientRootCertificates", "http://schemas.microsoft.com/windowsazure"));
if (clientRootCertificatesSequenceElement != null)
{
foreach (XElement clientRootCertificatesElement in clientRootCertificatesSequenceElement.Elements(XName.Get("ClientRootCertificate", "http://schemas.microsoft.com/windowsazure")))
{
ClientRootCertificateListResponse.ClientRootCertificate clientRootCertificateInstance = new ClientRootCertificateListResponse.ClientRootCertificate();
result.ClientRootCertificates.Add(clientRootCertificateInstance);
XElement expirationTimeElement = clientRootCertificatesElement.Element(XName.Get("ExpirationTime", "http://schemas.microsoft.com/windowsazure"));
if (expirationTimeElement != null)
{
DateTime expirationTimeInstance = DateTime.Parse(expirationTimeElement.Value, CultureInfo.InvariantCulture);
clientRootCertificateInstance.ExpirationTime = expirationTimeInstance;
}
XElement subjectElement = clientRootCertificatesElement.Element(XName.Get("Subject", "http://schemas.microsoft.com/windowsazure"));
if (subjectElement != null)
{
string subjectInstance = subjectElement.Value;
clientRootCertificateInstance.Subject = subjectInstance;
}
XElement thumbprintElement = clientRootCertificatesElement.Element(XName.Get("Thumbprint", "http://schemas.microsoft.com/windowsazure"));
if (thumbprintElement != null)
{
string thumbprintInstance = thumbprintElement.Value;
clientRootCertificateInstance.Thumbprint = thumbprintInstance;
}
}
}
if (shouldTrace)
{
Tracing.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
/// <summary>
/// The Upload Client Root Certificate operation is used to upload a
/// new client root certificate to Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205129.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Upload client certificate Virtual
/// Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public async Task<GatewayOperationResponse> CreateAsync(string virtualNetworkName, ClientRootCertificateCreateParameters parameters, CancellationToken cancellationToken)
{
// Validate
if (virtualNetworkName == null)
{
throw new ArgumentNullException("virtualNetworkName");
}
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
if (parameters.Certificate == null)
{
throw new ArgumentNullException("parameters.Certificate");
}
// Tracing
bool shouldTrace = CloudContext.Configuration.Tracing.IsEnabled;
string invocationId = null;
if (shouldTrace)
{
invocationId = Tracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("virtualNetworkName", virtualNetworkName);
tracingParameters.Add("parameters", parameters);
Tracing.Enter(invocationId, this, "CreateAsync", tracingParameters);
}
// Construct URL
string url = this.Client.BaseUri + "/" + this.Client.Credentials.SubscriptionId + "/services/networking/" + virtualNetworkName + "/gateway/clientrootcertificates";
// Create HTTP transport objects
HttpRequestMessage httpRequest = null;
try
{
httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Post;
httpRequest.RequestUri = new Uri(url);
// Set Headers
httpRequest.Headers.Add("x-ms-version", "2012-03-01");
// Set Credentials
cancellationToken.ThrowIfCancellationRequested();
await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
// Serialize Request
string requestContent = null;
requestContent = parameters.Certificate;
httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
httpRequest.Content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
// Send Request
HttpResponseMessage httpResponse = null;
try
{
if (shouldTrace)
{
Tracing.SendRequest(invocationId, httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
if (shouldTrace)
{
Tracing.ReceiveResponse(invocationId, httpResponse);
}
HttpStatusCode statusCode = httpResponse.StatusCode;
if (statusCode != HttpStatusCode.Accepted)
{
cancellationToken.ThrowIfCancellationRequested();
CloudException ex = CloudException.CreateFromXml(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
if (shouldTrace)
{
Tracing.Error(invocationId, ex);
}
throw ex;
}
// Create Result
GatewayOperationResponse result = new GatewayOperationResponse();
result.StatusCode = statusCode;
if (httpResponse.Headers.Contains("x-ms-request-id"))
{
result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
cancellationToken.ThrowIfCancellationRequested();
string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
XDocument responseDoc = XDocument.Parse(responseContent);
XElement gatewayOperationAsyncResponseElement = responseDoc.Element(XName.Get("GatewayOperationAsyncResponse", "http://schemas.microsoft.com/windowsazure"));
if (gatewayOperationAsyncResponseElement != null)
{
XElement idElement = gatewayOperationAsyncResponseElement.Element(XName.Get("ID", "http://schemas.microsoft.com/windowsazure"));
if (idElement != null)
{
string idInstance = idElement.Value;
result.OperationId = idInstance;
}
}
if (shouldTrace)
{
Tracing.Exit(invocationId, result);
}
return result;
}
finally
{
if (httpResponse != null)
{
httpResponse.Dispose();
}
}
}
finally
{
if (httpRequest != null)
{
httpRequest.Dispose();
}
}
}
}
public partial interface IGatewayOperations
{
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> BeginConnectDisconnectOrTestingAsync(string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> ConnectDisconnectOrTestAsync(string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> BeginCreatingAsync(string virtualNetworkName, GatewayCreateParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> CreateAsync(string virtualNetworkName, GatewayCreateParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Delete Virtual network Gateway operation deletes a network
/// gateway for the specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154129.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> BeginDeletingAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Delete Virtual network Gateway operation deletes a network
/// gateway for the specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154129.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> DeleteAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Failover Virtual network Gateway operation causes a network
/// gateway failover for the specified virtual network in Windows
/// Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154118.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network in Azure.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> BeginFailoverAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Failover Virtual network Gateway operation causes a network
/// gateway failover for the specified virtual network in Windows
/// Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154118.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network in Azure.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> FailoverAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Generate VPN Client Package creates a VPN client package for
/// the specified virtual network and gateway in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/dn205126.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> GenerateVpnClientPackageAsync(string virtualNetworkName, GatewayGenerateVpnClientPackageParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Get Virtual network Gateway operation gets information on the
/// network gateway for the specified vitrual network in Windows
/// Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154109.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayGetResponse> GetAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The Get Device Configuration Script operation returns a script that
/// you can use to configure local VPN devices to connect to the
/// gateway. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154115.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// The parameters for the GetDeviceConfigurationScript request
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The configuration script returned from the get device configuration
/// script request
/// </returns>
Task<GatewayGetDeviceConfigurationScriptResponse> GetDeviceConfigurationScriptAsync(string virtualNetworkName, GatewayGetDeviceConfigurationScriptParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Get Virtual network Gateway operation status gets information
/// on the status of network gateway operations in Windows Azure.
/// (see http://msdn.microsoft.com/en-us/library/windowsazure/jj154112.aspx
/// for more information)
/// </summary>
/// <param name='operationId'>
/// The id of the virtualnetwork operation
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> GetOperationStatusAsync(string operationId, CancellationToken cancellationToken);
/// <summary>
/// The Get Virtual network Gateway shared key operation gets the
/// shared key on the virtual network gateway for the specified
/// vitrual network connection to the specified local network in
/// Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154122.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkName'>
/// The name of the local network
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response to the get shared key request
/// </returns>
Task<GatewayGetSharedKeyResponse> GetSharedKeyAsync(string virtualNetworkName, string localNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The List Connections operation returns a list of the local network
/// connections that can be accessed through the gateway. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154120.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response to a ListConnections request to a Virtual Network
/// Gateway
/// </returns>
Task<GatewayListConnectionsResponse> ListConnectionsAsync(string virtualNetworkName, CancellationToken cancellationToken);
/// <summary>
/// The List Virtual Network Gateway Supported Devices operation lists
/// the supported, on-premise network devices that can connect to the
/// gateway. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154102.aspx
/// for more information)
/// </summary>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The respoonse to the get supported platform configuration request
/// </returns>
Task<GatewayListSupportedDevicesResponse> ListSupportedDevicesAsync(CancellationToken cancellationToken);
/// <summary>
/// The Reset Virtual network Gateway shared key operation resets the
/// shared key on the virtual network gateway for the specified
/// vitrual network connection to the specified local network in
/// Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154114.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkName'>
/// The name of the local network
/// </param>
/// <param name='parameters'>
/// The parameters to the Virtual Network Gateway Reset Shared Key
/// request
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
Task<GatewayOperationResponse> BeginResetSharedKeyAsync(string virtualNetworkName, string localNetworkName, GatewayResetSharedKeyParameters parameters, CancellationToken cancellationToken);
/// <summary>
/// The Reset Virtual network Gateway shared key operation resets the
/// shared key on the virtual network gateway for the specified
/// vitrual network connection to the specified local network in
/// Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154114.aspx
/// for more information)
/// </summary>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkName'>
/// The name of the local network
/// </param>
/// <param name='parameters'>
/// The parameters to the Virtual Network Gateway Reset Shared Key
/// request
/// </param>
/// <param name='cancellationToken'>
/// Cancellation token.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
Task<GatewayGetOperationStatusResponse> ResetSharedKeyAsync(string virtualNetworkName, string localNetworkName, GatewayResetSharedKeyParameters parameters, CancellationToken cancellationToken);
}
public static partial class GatewayOperationsExtensions
{
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static GatewayOperationResponse BeginConnectDisconnectOrTesting(this IGatewayOperations operations, string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters)
{
try
{
return operations.BeginConnectDisconnectOrTestingAsync(virtualNetworkName, localNetworkSiteName, parameters).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static Task<GatewayOperationResponse> BeginConnectDisconnectOrTestingAsync(this IGatewayOperations operations, string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters)
{
return operations.BeginConnectDisconnectOrTestingAsync(virtualNetworkName, localNetworkSiteName, parameters, CancellationToken.None);
}
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static GatewayGetOperationStatusResponse ConnectDisconnectOrTest(this IGatewayOperations operations, string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters)
{
try
{
return operations.ConnectDisconnectOrTestAsync(virtualNetworkName, localNetworkSiteName, parameters).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// To connect to, disconnect from, or test your connection to a local
/// network site, access the connection resource representing the
/// local network and specify Connect, Disconnect or Test to perform
/// the desired operation. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154107.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='localNetworkSiteName'>
/// The name of the site to connect to
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static Task<GatewayGetOperationStatusResponse> ConnectDisconnectOrTestAsync(this IGatewayOperations operations, string virtualNetworkName, string localNetworkSiteName, GatewayConnectDisconnectOrTestParameters parameters)
{
return operations.ConnectDisconnectOrTestAsync(virtualNetworkName, localNetworkSiteName, parameters, CancellationToken.None);
}
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static GatewayOperationResponse BeginCreating(this IGatewayOperations operations, string virtualNetworkName, GatewayCreateParameters parameters)
{
try
{
return operations.BeginCreatingAsync(virtualNetworkName, parameters).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static Task<GatewayOperationResponse> BeginCreatingAsync(this IGatewayOperations operations, string virtualNetworkName, GatewayCreateParameters parameters)
{
return operations.BeginCreatingAsync(virtualNetworkName, parameters, CancellationToken.None);
}
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static GatewayGetOperationStatusResponse Create(this IGatewayOperations operations, string virtualNetworkName, GatewayCreateParameters parameters)
{
try
{
return operations.CreateAsync(virtualNetworkName, parameters).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Create Virtual network Gateway operation creates a new network
/// gateways account in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154119.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network for this gateway
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the Create Virtual Network Gateway operation.
/// </param>
/// <returns>
/// The response body contains the status of the specified asynchronous
/// operation, indicating whether it has succeeded, is inprogress, or
/// has failed. Note that this status is distinct from the HTTP status
/// code returned for the Get Operation Status operation itself. If
/// the asynchronous operation succeeded, the response body includes
/// the HTTP status code for the successful request. If the
/// asynchronous operation failed, the response body includes the HTTP
/// status code for the failed request, and also includes error
/// information regarding the failure.
/// </returns>
public static Task<GatewayGetOperationStatusResponse> CreateAsync(this IGatewayOperations operations, string virtualNetworkName, GatewayCreateParameters parameters)
{
return operations.CreateAsync(virtualNetworkName, parameters, CancellationToken.None);
}
/// <summary>
/// The Delete Virtual network Gateway operation deletes a network
/// gateway for the specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154129.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>
/// The name of the virtual network.
/// </param>
/// <returns>
/// A standard storage response including an HTTP status code and
/// request ID.
/// </returns>
public static GatewayOperationResponse BeginDeleting(this IGatewayOperations operations, string virtualNetworkName)
{
try
{
return operations.BeginDeletingAsync(virtualNetworkName).Result;
}
catch (AggregateException ex)
{
if (ex.InnerExceptions.Count > 1)
{
throw;
}
else
{
throw ex.InnerException;
}
}
}
/// <summary>
/// The Delete Virtual network Gateway operation deletes a network
/// gateway for the specified virtual network in Windows Azure. (see
/// http://msdn.microsoft.com/en-us/library/windowsazure/jj154129.aspx
/// for more information)
/// </summary>
/// <param name='operations'>
/// Reference to the
/// Microsoft.WindowsAzure.Management.VirtualNetworks.IGatewayOperations.
/// </param>
/// <param name='virtualNetworkName'>