internal CloudServiceRole(ArmResource options, CloudServiceRoleData resource) : base(options, resource.Id)
 {
     HasData                      = true;
     _data                        = resource;
     _clientDiagnostics           = new ClientDiagnostics(ClientOptions);
     _cloudServiceRolesRestClient = new CloudServiceRolesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
        public async Task <Response <CloudServiceRoleData> > GetAsync(string subscriptionId, string resourceGroupName, string cloudServiceName, string roleName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (cloudServiceName == null)
            {
                throw new ArgumentNullException(nameof(cloudServiceName));
            }
            if (roleName == null)
            {
                throw new ArgumentNullException(nameof(roleName));
            }

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, cloudServiceName, roleName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = CloudServiceRoleData.DeserializeCloudServiceRoleData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 3
0
        internal CloudServiceRole(ArmResource options, CloudServiceRoleData data) : base(options, data.Id)
        {
            HasData                      = true;
            _data                        = data;
            _clientDiagnostics           = new ClientDiagnostics(ClientOptions);
            _cloudServiceRolesRestClient = new CloudServiceRolesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
#if DEBUG
            ValidateResourceId(Id);
#endif
        }
 internal CloudServiceRole(ArmClient client, CloudServiceRoleData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }