Пример #1
0
        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));
        }
Пример #2
0
        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));
            
        }
Пример #3
0
        protected PSArgument[] CreateHostedServiceUpdateParameters()
        {
            string serviceName = string.Empty;
            HostedServiceUpdateParameters parameters = new HostedServiceUpdateParameters();

            return(ConvertFromObjectsToArguments(new string[] { "ServiceName", "Parameters" }, new object[] { serviceName, parameters }));
        }
Пример #4
0
        protected void ExecuteHostedServiceUpdateMethod(object[] invokeMethodInputParameters)
        {
            string serviceName = (string)ParseParameter(invokeMethodInputParameters[0]);
            HostedServiceUpdateParameters parameters = (HostedServiceUpdateParameters)ParseParameter(invokeMethodInputParameters[1]);

            var result = HostedServiceClient.Update(serviceName, parameters);

            WriteObject(result);
        }
Пример #5
0
        /// <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();
        }
 /// <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>
 /// 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));
 }
Пример #8
0
 /// <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;
         }
     }
 }