/// <summary>
 /// Gets the list of all role instances in a cloud service. Use nextLink
 /// property in the response to get the next page of role instances. Do this
 /// till nextLink is null to fetch all the role instances.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <RoleInstance> > ListNextAsync(this ICloudServiceRoleInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        /// <summary>
        /// Gets a remote desktop file for a role instance in a cloud service.
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='roleInstanceName'>
        /// Name of the role instance.
        /// </param>
        /// <param name='resourceGroupName'>
        /// </param>
        /// <param name='cloudServiceName'>
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public static async Task <Stream> GetRemoteDesktopFileAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken))
        {
            var _result = await operations.GetRemoteDesktopFileWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false);

            _result.Request.Dispose();
            return(_result.Body);
        }
 /// <summary>
 /// Gets the list of all role instances in a cloud service. Use nextLink
 /// property in the response to get the next page of role instances. Do this
 /// till nextLink is null to fetch all the role instances.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 /// <param name='expand'>
 /// The expand expression to apply to the operation. 'UserData' is not
 /// supported for cloud services. Possible values include: 'instanceView',
 /// 'userData'
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <RoleInstance> > ListAsync(this ICloudServiceRoleInstancesOperations operations, string resourceGroupName, string cloudServiceName, InstanceViewTypes?expand = default(InstanceViewTypes?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, cloudServiceName, expand, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Retrieves information about the run-time state of a role instance in a
 /// cloud service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <RoleInstanceInstanceView> GetInstanceViewAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetInstanceViewWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Gets a role instance from a cloud service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 /// <param name='expand'>
 /// The expand expression to apply to the operation. 'UserData' is not
 /// supported for cloud services. Possible values include: 'instanceView',
 /// 'userData'
 /// </param>
 public static RoleInstance Get(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, InstanceViewTypes?expand = default(InstanceViewTypes?))
 {
     return(operations.GetAsync(roleInstanceName, resourceGroupName, cloudServiceName, expand).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Deletes a role instance from a cloud service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(roleInstanceName, resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 /// <summary>
 /// Gets the list of all role instances in a cloud service. Use nextLink
 /// property in the response to get the next page of role instances. Do this
 /// till nextLink is null to fetch all the role instances.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='nextPageLink'>
 /// The NextLink from the previous successful call to List operation.
 /// </param>
 public static IPage <RoleInstance> ListNext(this ICloudServiceRoleInstancesOperations operations, string nextPageLink)
 {
     return(operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult());
 }
 /// <summary>
 /// The Rebuild Role Instance asynchronous operation reinstalls the operating
 /// system on instances of web roles or worker roles and initializes the
 /// storage resources that are used by them. If you do not want to initialize
 /// storage resources, you can use Reimage Role Instance.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 public static void BeginRebuild(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName)
 {
     operations.BeginRebuildAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Gets a remote desktop file for a role instance in a cloud service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 public static Stream GetRemoteDesktopFile(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName)
 {
     return(operations.GetRemoteDesktopFileAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Retrieves information about the run-time state of a role instance in a
 /// cloud service.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='roleInstanceName'>
 /// Name of the role instance.
 /// </param>
 /// <param name='resourceGroupName'>
 /// </param>
 /// <param name='cloudServiceName'>
 /// </param>
 public static RoleInstanceInstanceView GetInstanceView(this ICloudServiceRoleInstancesOperations operations, string roleInstanceName, string resourceGroupName, string cloudServiceName)
 {
     return(operations.GetInstanceViewAsync(roleInstanceName, resourceGroupName, cloudServiceName).GetAwaiter().GetResult());
 }