protected void WaitForFailureOrCompletion(ResponseType response, Guid objectId)
        {
            if (this.Wait && response != null && response.responseCode == "IN_PROGRESS")
            {
                bool            provisioned       = false;
                IEntityStatusV2 provisionedObject = default(IEntityStatusV2);

                while (!provisioned)
                {
                    Update(objectId, ref provisionedObject);
                    switch (provisionedObject.state)
                    {
                    case "NORMAL":
                        provisioned = true;
                        break;

                    case "IN_PROGRESS":
                    case "PENDING_ADD":
                    case "PENDING_CHANGE":
                    case "PENDING_DELETE":
                        provisioned = false;
                        break;

                    default:
                        ThrowTerminatingError(
                            new ErrorRecord(new ComputeApiException(string.Format("Failed to provision {0}", provisionedObject.state)), "-1", ErrorCategory.ConnectionError, Connection));
                        break;
                    }
                    if (!provisioned)
                    {
                        Thread.Sleep(delayTime);
                    }
                }
                base.WriteObject(provisionedObject);
            }
            else
            {
                base.WriteObject(response);
            }
        }
Exemple #2
0
 public override void Update(Guid objectId, ref IEntityStatusV2 provisionedObject)
 {
     provisionedObject = Connection.ApiClient.Networking.Vlan.GetVlan(objectId).Result;
 }
 public abstract void Update(Guid objectId, ref IEntityStatusV2 provisionedObject);