Esempio n. 1
0
        BuildpackBindingResource IOperationSource <BuildpackBindingResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = BuildpackBindingResourceData.DeserializeBuildpackBindingResourceData(document.RootElement);

            return(new BuildpackBindingResource(_client, data));
        }
Esempio n. 2
0
        public async Task <Response <BuildpackBindingResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string buildServiceName, string builderName, string buildpackBindingName, 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));
            Argument.AssertNotNullOrEmpty(buildpackBindingName, nameof(buildpackBindingName));

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

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

                value = BuildpackBindingResourceData.DeserializeBuildpackBindingResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Esempio n. 3
0
        public virtual async Task <ArmOperation <BuildpackBindingResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string buildpackBindingName, BuildpackBindingResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(buildpackBindingName, nameof(buildpackBindingName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _buildpackBindingResourceBuildpackBindingClientDiagnostics.CreateScope("BuildpackBindingResourceCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _buildpackBindingResourceBuildpackBindingRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildpackBindingName, data, cancellationToken).ConfigureAwait(false);

                var operation = new AppPlatformArmOperation <BuildpackBindingResource>(new BuildpackBindingResourceOperationSource(Client), _buildpackBindingResourceBuildpackBindingClientDiagnostics, Pipeline, _buildpackBindingResourceBuildpackBindingRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, buildpackBindingName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Esempio n. 4
0
 internal BuildpackBindingResource(ArmClient client, BuildpackBindingResourceData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }