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

            return(new ApiPortalCustomDomainResource(_client, data));
        }
Esempio n. 2
0
        public async Task <Response <ApiPortalCustomDomainResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string apiPortalName, string domainName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName));
            Argument.AssertNotNullOrEmpty(apiPortalName, nameof(apiPortalName));
            Argument.AssertNotNullOrEmpty(domainName, nameof(domainName));

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

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

                value = ApiPortalCustomDomainResourceData.DeserializeApiPortalCustomDomainResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Esempio n. 3
0
 internal ApiPortalCustomDomainResource(ArmClient client, ApiPortalCustomDomainResourceData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Esempio n. 4
0
        public virtual ArmOperation <ApiPortalCustomDomainResource> Update(WaitUntil waitUntil, ApiPortalCustomDomainResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _apiPortalCustomDomainResourceApiPortalCustomDomainsClientDiagnostics.CreateScope("ApiPortalCustomDomainResource.Update");
            scope.Start();
            try
            {
                var response  = _apiPortalCustomDomainResourceApiPortalCustomDomainsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new AppPlatformArmOperation <ApiPortalCustomDomainResource>(new ApiPortalCustomDomainResourceOperationSource(Client), _apiPortalCustomDomainResourceApiPortalCustomDomainsClientDiagnostics, Pipeline, _apiPortalCustomDomainResourceApiPortalCustomDomainsRestClient.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;
            }
        }