/// <summary> /// Add an internal load balancer to a an existing deployment. When /// used by an input endpoint, the internal load balancer will provide /// an additional private VIP that can be used for load balancing to /// the roles in this deployment. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.ILoadBalancerOperations. /// </param> /// <param name='serviceName'> /// Required. The name of the service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Create Load Balancer 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 error information regarding /// the failure. /// </returns> public static OperationStatusResponse BeginCreating(this ILoadBalancerOperations operations, string serviceName, string deploymentName, LoadBalancerCreateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((ILoadBalancerOperations)s).BeginCreatingAsync(serviceName, deploymentName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
protected override void OnProcessRecord() { ServiceManagementProfile.Initialize(); var parameters = new LoadBalancerCreateParameters { Name = this.InternalLoadBalancerName, FrontendIPConfiguration = new FrontendIPConfiguration { Type = FrontendIPConfigurationType.Private, SubnetName = this.SubnetName, StaticVirtualNetworkIPAddress = this.StaticVNetIPAddress == null ? null : this.StaticVNetIPAddress.ToString() } }; ExecuteClientActionNewSM(null, CommandRuntime.ToString(), () => { var deploymentName = this.ComputeClient.Deployments.GetBySlot( this.ServiceName, DeploymentSlot.Production).Name; return this.ComputeClient.LoadBalancers.Create( this.ServiceName, deploymentName, parameters); }); }
/// <summary> /// Add an internal load balancer to a an existing deployment. When /// used by an input endpoint, the internal load balancer will provide /// an additional private VIP that can be used for load balancing to /// the roles in this deployment. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.ILoadBalancerOperations. /// </param> /// <param name='serviceName'> /// Required. The name of the service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Create Load Balancer 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 error information regarding /// the failure. /// </returns> public static Task<OperationStatusResponse> CreateAsync(this ILoadBalancerOperations operations, string serviceName, string deploymentName, LoadBalancerCreateParameters parameters) { return operations.CreateAsync(serviceName, deploymentName, parameters, CancellationToken.None); }
protected PSArgument[] CreateLoadBalancerCreateParameters() { string serviceName = string.Empty; string deploymentName = string.Empty; LoadBalancerCreateParameters parameters = new LoadBalancerCreateParameters(); return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentName", "Parameters" }, new object[] { serviceName, deploymentName, parameters }); }