ManagedEnvironmentResource IOperationSource <ManagedEnvironmentResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ManagedEnvironmentData.DeserializeManagedEnvironmentData(document.RootElement); return(new ManagedEnvironmentResource(_client, data)); }
public virtual ArmOperation Update(WaitUntil waitUntil, ManagedEnvironmentData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _managedEnvironmentClientDiagnostics.CreateScope("ManagedEnvironmentResource.Update"); scope.Start(); try { var response = _managedEnvironmentRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); var operation = new ContainersArmOperation(_managedEnvironmentClientDiagnostics, Pipeline, _managedEnvironmentRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ManagedEnvironmentResource(ArmClient client, ManagedEnvironmentData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <ManagedEnvironmentResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, ManagedEnvironmentData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); using var scope = _managedEnvironmentClientDiagnostics.CreateScope("ManagedEnvironmentCollection.CreateOrUpdate"); scope.Start(); try { var response = await _managedEnvironmentRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); var operation = new ContainersArmOperation <ManagedEnvironmentResource>(new ManagedEnvironmentOperationSource(Client), _managedEnvironmentClientDiagnostics, Pipeline, _managedEnvironmentRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }