protected override void OnProcessRecord()
        {
            ServiceManagementProfile.Initialize();

            if (this.Label == null && this.Description == null && this.ReverseDnsFqdn == null)
            {
                ThrowTerminatingError(new ErrorRecord(
                                               new Exception(
                                               Resources.LabelOrDescriptionOrReverseDnsFqdnMustBeSpecified),
                                               string.Empty,
                                               ErrorCategory.InvalidData,
                                               null));
            }

            var parameters = new HostedServiceUpdateParameters
            {
                Label = this.Label ?? null,
                Description = this.Description,
                ReverseDnsFqdn = this.ReverseDnsFqdn
            };
            ExecuteClientActionNewSM(parameters, 
                CommandRuntime.ToString(),
                () => this.ComputeClient.HostedServices.Update(this.ServiceName, parameters));
            
        }
 /// <summary>
 /// The Update Hosted Service operation can update the label or
 /// description of a cloud service in Azure.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/gg441303.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IHostedServiceOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Hosted Service
 /// operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> UpdateAsync(this IHostedServiceOperations operations, string serviceName, HostedServiceUpdateParameters parameters)
 {
     return operations.UpdateAsync(serviceName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// The Update Hosted Service operation can update the label or
 /// description of a cloud service in Azure.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/gg441303.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IHostedServiceOperations.
 /// </param>
 /// <param name='serviceName'>
 /// Required. The name of the cloud service.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Hosted Service
 /// operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse Update(this IHostedServiceOperations operations, string serviceName, HostedServiceUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IHostedServiceOperations)s).UpdateAsync(serviceName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        /// <summary>
        ///     Update hosted service
        /// </summary>
        /// <param name="hostedServiceName"></param>
        /// <param name="input"></param>
        public void UpdateHostedService(string hostedServiceName, HostedServiceUpdateParameters input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (string.IsNullOrEmpty(hostedServiceName))
            {
                throw new Exception("Hosted service name is null or empty.");
            }

            if (!HostedServiceExists(hostedServiceName))
            {
                throw new Exception(string.Format("No hosted service exist with name '{0}'", hostedServiceName));
            }

            ComputeManagementClient.HostedServices.UpdateAsync(hostedServiceName, input, new CancellationToken()).Wait();
        }
        protected PSArgument[] CreateHostedServiceUpdateParameters()
        {
            string serviceName = string.Empty;
            HostedServiceUpdateParameters parameters = new HostedServiceUpdateParameters();

            return ConvertFromObjectsToArguments(new string[] { "ServiceName", "Parameters" }, new object[] { serviceName, parameters });
        }
 /// <summary>
 /// The Update Hosted Service operation can update the label or
 /// description of a cloud service in Windows Azure.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/gg441303.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Compute.IHostedServiceOperations.
 /// </param>
 /// <param name='serviceName'>
 /// The name of the cloud service.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Hosted Service operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static OperationResponse Update(this IHostedServiceOperations operations, string serviceName, HostedServiceUpdateParameters parameters)
 {
     try
     {
         return operations.UpdateAsync(serviceName, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
Пример #7
0
 public virtual async Task<OperationResponse> UpdateService(HostedServiceUpdateParameters updateParameters)
 {
     return await _computeClient.Value.HostedServices.UpdateAsync(this.ServiceName, updateParameters);
 }