internal CodeContainerResource(ArmClient client, CodeContainerData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual async Task <ArmOperation <CodeContainerResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, CodeContainerData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); using var scope = _codeContainerClientDiagnostics.CreateScope("CodeContainerCollection.CreateOrUpdate"); scope.Start(); try { var response = await _codeContainerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); var operation = new MachineLearningArmOperation <CodeContainerResource>(Response.FromValue(new CodeContainerResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ArmOperation <CodeContainerResource> Update(WaitUntil waitUntil, CodeContainerData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _codeContainerClientDiagnostics.CreateScope("CodeContainerResource.Update"); scope.Start(); try { var response = _codeContainerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new MachineLearningArmOperation <CodeContainerResource>(Response.FromValue(new CodeContainerResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }