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

            return(new SapMonitorResource(_client, data));
        }
コード例 #2
0
 internal SapMonitorResource(ArmClient client, SapMonitorData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
コード例 #3
0
        public virtual async Task <ArmOperation <SapMonitorResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string monitorName, SapMonitorData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _sapMonitormonitorsClientDiagnostics.CreateScope("SapMonitorCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _sapMonitormonitorsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data, cancellationToken).ConfigureAwait(false);

                var operation = new WorkloadsArmOperation <SapMonitorResource>(new SapMonitorOperationSource(Client), _sapMonitormonitorsClientDiagnostics, Pipeline, _sapMonitormonitorsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, monitorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }