コード例 #1
0
        OnlineEndpointResource IOperationSource <OnlineEndpointResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = OnlineEndpointData.DeserializeOnlineEndpointData(document.RootElement);

            return(new OnlineEndpointResource(_client, data));
        }
コード例 #2
0
        public virtual async Task <ArmOperation <OnlineEndpointResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string endpointName, OnlineEndpointData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(endpointName, nameof(endpointName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _onlineEndpointClientDiagnostics.CreateScope("OnlineEndpointCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _onlineEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, data, cancellationToken).ConfigureAwait(false);

                var operation = new MachineLearningArmOperation <OnlineEndpointResource>(new OnlineEndpointOperationSource(Client), _onlineEndpointClientDiagnostics, Pipeline, _onlineEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, endpointName, data).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #3
0
 internal OnlineEndpointResource(ArmClient client, OnlineEndpointData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }