protected override void PerformOperation(IServiceManagement channel) { if (!String.IsNullOrEmpty(Label)) { Label = ServiceManagementHelper.EncodeToBase64String(Label); } UpdateHostedServiceInput input = new UpdateHostedServiceInput() { Label = CSManageCommand.Label, Description = CSManageCommand.Description }; Console.WriteLine("Updating hosted service {0}", HostedServiceName); channel.UpdateHostedService(SubscriptionId, HostedServiceName, input); }
protected override void OnProcessRecord() { if (this.Label == null && this.Description == null) { ThrowTerminatingError(new ErrorRecord( new Exception( Resources.LabelOrDescriptionMustBeSpecified), string.Empty, ErrorCategory.InvalidData, null)); } var updateHostedServiceInput = new UpdateHostedServiceInput { Label = this.Label ?? null, Description = this.Description }; ExecuteClientActionInOCS(updateHostedServiceInput, CommandRuntime.ToString(), s => this.Channel.UpdateHostedService(s, this.ServiceName, updateHostedServiceInput)); }
protected override void OnProcessRecord() { if (this.Label == null && this.Description == null) { ThrowTerminatingError(new ErrorRecord( new Exception( "You must specify a value for either Label or Description."), string.Empty, ErrorCategory.InvalidData, null)); } var updateHostedServiceInput = new UpdateHostedServiceInput { Label = this.Label != null ? this.Label: null, Description = this.Description }; ExecuteClientActionInOCS(updateHostedServiceInput, CommandRuntime.ToString(), s => this.Channel.UpdateHostedService(s, this.ServiceName, updateHostedServiceInput)); }
public void SetHostedServiceProcess() { if (this.Label == null && this.Description == null) { base.ThrowTerminatingError(new ErrorRecord(new Exception("You must specify a value for either Label or Description."), string.Empty, ErrorCategory.InvalidData, null)); } using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel)) { try { UpdateHostedServiceInput updateHostedServiceInput = new UpdateHostedServiceInput(); if (this.Label != null) { updateHostedServiceInput.Label = ServiceManagementHelper.EncodeToBase64String(this.Label); } if (this.Description != null) { updateHostedServiceInput.Description = this.Description; } CmdletExtensions.WriteVerboseOutputForObject(this, updateHostedServiceInput); base.RetryCall((string s) => base.Channel.UpdateHostedService(s, this.ServiceName, updateHostedServiceInput)); Operation operation = base.WaitForOperation(base.CommandRuntime.ToString()); ManagementOperationContext managementOperationContext = new ManagementOperationContext(); managementOperationContext.set_OperationDescription(base.CommandRuntime.ToString()); managementOperationContext.set_OperationId(operation.OperationTrackingId); managementOperationContext.set_OperationStatus(operation.Status); ManagementOperationContext managementOperationContext1 = managementOperationContext; base.WriteObject(managementOperationContext1, true); } catch (CommunicationException communicationException1) { CommunicationException communicationException = communicationException1; this.WriteErrorDetails(communicationException); } } }
protected override void OnProcessRecord() { if (this.Label == null && this.Description == null) { ThrowTerminatingError(new ErrorRecord( new Exception( "You must specify a value for either Label or Description."), string.Empty, ErrorCategory.InvalidData, null)); } var updateHostedServiceInput = new UpdateHostedServiceInput { Label = this.Label != null ? ServiceManagementHelper.EncodeToBase64String(this.Label): null, Description = this.Description }; ExecuteClientActionInOCS(updateHostedServiceInput, CommandRuntime.ToString(), s => this.Channel.UpdateHostedService(s, this.ServiceName, updateHostedServiceInput), WaitForOperation); }
public static void UpdateHostedService(this IServiceManagement proxy, string subscriptionId, string serviceName, UpdateHostedServiceInput input) { proxy.EndUpdateHostedService(proxy.BeginUpdateHostedService(subscriptionId, serviceName, input, null, null)); }
public IAsyncResult BeginUpdateHostedService(string subscriptionId, string serviceName, UpdateHostedServiceInput input, AsyncCallback callback, object state) { SimpleServiceManagementAsyncResult result = new SimpleServiceManagementAsyncResult(); result.Values["subscriptionId"] = subscriptionId; result.Values["serviceName"] = serviceName; result.Values["input"] = input; result.Values["callback"] = callback; result.Values["state"] = state; return result; }