public SetDefaultSites(IGatewayOperations gatewayClient, string virtualNetworkSiteName, GatewaySetDefaultSiteListParameters parameters)
        {
            this.gatewayClient = gatewayClient;
            this.virtualNetworkSiteName = virtualNetworkSiteName;
            this.parameters = parameters;

            GatewayGetResponse getGatewayResponse = gatewayClient.Get(virtualNetworkSiteName);
            if (getGatewayResponse.DefaultSite == null || string.IsNullOrEmpty(getGatewayResponse.DefaultSite.Name))
            {
                oldDefaultSite = "";
            }
            else
            {
                oldDefaultSite = getGatewayResponse.DefaultSite.Name;    
            }
        }
 /// <summary>
 /// The Begin Set Virtual Network Gateway Shared Key operation sets the
 /// default sites on the virtual network gateway for the specified
 /// virtual network.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='networkName'>
 /// Required. The name of the virtual network for this gateway.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set Default Sites request.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<GatewayOperationResponse> BeginSetDefaultSitesAsync(this IGatewayOperations operations, string networkName, GatewaySetDefaultSiteListParameters parameters)
 {
     return operations.BeginSetDefaultSitesAsync(networkName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Begin Set Virtual Network Gateway Shared Key operation sets the
 /// default sites on the virtual network gateway for the specified
 /// virtual network.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Network.IGatewayOperations.
 /// </param>
 /// <param name='networkName'>
 /// Required. The name of the virtual network for this gateway.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Begin Virtual Network Gateway
 /// Set Default Sites request.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static GatewayOperationResponse BeginSetDefaultSites(this IGatewayOperations operations, string networkName, GatewaySetDefaultSiteListParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IGatewayOperations)s).BeginSetDefaultSitesAsync(networkName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        public GatewayGetOperationStatusResponse SetDefaultSites(string virtualNetworkSiteName, GatewaySetDefaultSiteListParameters parameters)
        {
            SetDefaultSites operation = new SetDefaultSites(gatewayClient, virtualNetworkSiteName, parameters);

            testClient.InvokeTestOperation(operation);

            return operation.InvokeResponse;
        }