예제 #1
0
        protected override void ProcessRecord()
        {
            if (Vlan != null)
            {
                Id = Guid.Parse(Vlan.id);
            }
            ResponseType response = null;

            base.ProcessRecord();
            try
            {
                var editVlan = new EditVlanType()
                {
                    id          = Id.ToString(),
                    name        = Name,
                    description = Description
                };

                response = Connection.ApiClient.Networking.Vlan.EditVlan(editVlan).Result;
            }
            catch (AggregateException ae)
            {
                ae.Handle(
                    e =>
                {
                    if (e is ComputeApiException)
                    {
                        WriteError(
                            new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection));
                    }
                    else
                    {
                        ThrowTerminatingError(
                            new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection));
                    }

                    return(true);
                });
            }

            WriteObject(response);
        }
예제 #2
0
 /// <summary>
 /// Edit Virtual LAN on a network domain.
 /// </summary>
 /// <param name="editVlan">
 /// Edit Virtual LAN request.
 /// </param>
 /// <returns>
 /// Operation status
 /// </returns>
 public async Task <ResponseType> EditVlan(EditVlanType editVlan)
 {
     return(await _api.PostAsync <EditVlanType, ResponseType>(ApiUris.EditVlan(_api.OrganizationId), editVlan));
 }