protected override void ProcessRecord() { base.ProcessRecord(); try { client?.Dispose(); int timeout = GetPreferredTimeout(); WriteDebug($"Cmdlet Timeout : {timeout} milliseconds."); client = new BudgetClient(AuthProvider, new Oci.Common.ClientConfiguration { RetryConfiguration = retryConfig, TimeoutMillis = timeout, ClientUserAgent = PSUserAgent }); string region = GetPreferredRegion(); if (region != null) { WriteDebug("Choosing Region:" + region); client.SetRegion(region); } if (Endpoint != null) { WriteDebug("Choosing Endpoint:" + Endpoint); client.SetEndpoint(Endpoint); } } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public Client() { Budget = new Roots.Budget(); Catalog = new Roots.Catalog(); CatalogClient = new CatalogClient(this); BudgetClient = new BudgetClient(this); CatalogClient.ResetChanged(); BudgetClient.ResetChanged(); }
public void Push(int expectedDelta) { var catalogChangedEntities = CatalogClient.Changed; var budgetChangedEntities = BudgetClient.Changed; var delta = catalogChangedEntities.Size + budgetChangedEntities.Size; if (delta != expectedDelta) { throw new WrongPushException(); } if (delta > 0) { EndingDeviceKnowledge = StartingDeviceKnowledge + 1; Task.Run(() => CatalogClient.Push()).Wait(); Task.Run(() => BudgetClient.Push()).Wait(); StartingDeviceKnowledge = EndingDeviceKnowledge; } }
public void Sync() { Task.Run(() => CatalogClient.Sync()).Wait(); SelectBudget(); Task.Run(() => BudgetClient.Sync()).Wait(); }