示例#1
0
        AppBuilderResource IOperationSource <AppBuilderResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = AppBuilderResourceData.DeserializeAppBuilderResourceData(document.RootElement);

            return(new AppBuilderResource(_client, data));
        }
示例#2
0
        public async Task <Response <AppBuilderResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string builderName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName));
            Argument.AssertNotNullOrEmpty(buildServiceName, nameof(buildServiceName));
            Argument.AssertNotNullOrEmpty(builderName, nameof(builderName));

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, serviceName, buildServiceName, builderName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                AppBuilderResourceData value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = AppBuilderResourceData.DeserializeAppBuilderResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
示例#3
0
        public virtual ArmOperation <AppBuilderResource> Update(WaitUntil waitUntil, AppBuilderResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _appBuilderResourceBuildServiceBuilderClientDiagnostics.CreateScope("AppBuilderResource.Update");
            scope.Start();
            try
            {
                var response  = _appBuilderResourceBuildServiceBuilderRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new AppPlatformArmOperation <AppBuilderResource>(new AppBuilderResourceOperationSource(Client), _appBuilderResourceBuildServiceBuilderClientDiagnostics, Pipeline, _appBuilderResourceBuildServiceBuilderRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#4
0
 internal AppBuilderResource(ArmClient client, AppBuilderResourceData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }