/// <summary>
 /// Retrieves the usages (most recent storage data) for the given collection.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Name of an Azure resource group.
 /// </param>
 /// <param name='accountName'>
 /// Cosmos DB database account name.
 /// </param>
 /// <param name='databaseRid'>
 /// Cosmos DB database rid.
 /// </param>
 /// <param name='collectionRid'>
 /// Cosmos DB collection rid.
 /// </param>
 /// <param name='filter'>
 /// An OData filter expression that describes a subset of usages to return. The
 /// supported parameter is name.value (name of the metric, can have an or of
 /// multiple names).
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IEnumerable <Usage> > ListUsagesAsync(this ICollectionOperations operations, string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListUsagesWithHttpMessagesAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemple #2
0
 /// <summary>
 /// Deletes the given collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The name of the collection.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId Delete(this ICollectionOperations operations, string collectionName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).DeleteAsync(collectionName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #3
0
 /// <summary>
 /// Restarts VM associated with a collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name containing the VM to be
 /// restarted.
 /// </param>
 /// <param name='details'>
 /// Required. The details of VM to be restarted.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId RestartVm(this ICollectionOperations operations, string collectionName, RestartVmCommandParameter details)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).RestartVmAsync(collectionName, details);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #4
0
 /// <summary>
 /// Sends message to the session associated with the user UPN
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name where the session exists.
 /// </param>
 /// <param name='sessionMessageParameter'>
 /// Required. The session command parameter to send message to a
 /// session.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId SendMessageToSession(this ICollectionOperations operations, string collectionName, SessionSendMessageCommandParameter sessionMessageParameter)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).SendMessageToSessionAsync(collectionName, sessionMessageParameter);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #5
0
 /// <summary>
 /// Gets the list of all virtual machines in the collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name where vms exist.
 /// </param>
 /// <returns>
 /// List of virtual machines in a given collection.
 /// </returns>
 public static CollectionVmsListResult ListVms(this ICollectionOperations operations, string collectionName)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).ListVmsAsync(collectionName);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #6
0
 /// <summary>
 /// Gets the summary of collection usage for the requested period.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The collection name.
 /// </param>
 /// <param name='year'>
 /// Required. The billing year in YYYY format.
 /// </param>
 /// <param name='month'>
 /// Required. The billing month in range of 01 through 12 inclusive.
 /// </param>
 /// <returns>
 /// The collection usage billing summary.
 /// </returns>
 public static CollectionUsageSummaryListResult GetUsageSummary(this ICollectionOperations operations, string collectionName, string year, string month)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).GetUsageSummaryAsync(collectionName, year, month);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #7
0
 /// <summary>
 /// Sets a new information to the collection with given id.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The name of the collection.
 /// </param>
 /// <param name='forceRedeploy'>
 /// Required. A flag denoting if the request is to re-deploy the
 /// collection after it is updated.
 /// </param>
 /// <param name='populateOnly'>
 /// Required. A flag denoting if the request is to populate the
 /// collection details(true for populate only).
 /// </param>
 /// <param name='collectionDetails'>
 /// Required. Details for the collection to be updated.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId Set(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).SetAsync(collectionName, forceRedeploy, populateOnly, collectionDetails);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #8
0
 /// <summary>
 /// Updates the specified Active directory's configuration.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. Name of the collection
 /// </param>
 /// <param name='activeDirectoryConfigDetails'>
 /// Required. AD config
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId SetAd(this ICollectionOperations operations, string collectionName, ActiveDirectoryConfigParameter activeDirectoryConfigDetails)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).SetAdAsync(collectionName, activeDirectoryConfigDetails);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #9
0
 /// <summary>
 /// Creates a collection with the given details.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='populateOnly'>
 /// Required. A flag denoting if the request is to populate the
 /// creation details of the collection or update and deploy (true for
 /// populate only).
 /// </param>
 /// <param name='collectionDetails'>
 /// Required. Details for the collection to be created.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static OperationResultWithTrackingId Create(this ICollectionOperations operations, bool populateOnly, CollectionCreationDetails collectionDetails)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).CreateAsync(populateOnly, collectionDetails);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #10
0
 /// <summary>
 /// Gets a list of all regions where collection can be created for the
 /// subscription.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <returns>
 /// The list of locations.
 /// </returns>
 public static RegionListResult RegionList(this ICollectionOperations operations)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((ICollectionOperations)s).RegionListAsync();
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Initializes a new instance of the RemoteAppManagementClient class.
 /// </summary>
 /// <param name='httpClient'>
 /// The Http client
 /// </param>
 public RemoteAppManagementClient(HttpClient httpClient)
     : base(httpClient)
 {
     this._account          = new AccountsOperations(this);
     this._collections      = new CollectionOperations(this);
     this._operationResults = new OperationResultOperations(this);
     this._principals       = new PrincipalOperations(this);
     this._publishing       = new PublishingOperations(this);
     this._templateImages   = new TemplateImageOperations(this);
     this._vNet             = new VNetOperations(this);
     this._rdfeNamespace    = "remoteapp";
     this._apiVersion       = "2014-09-01";
     this._longRunningOperationInitialTimeout = -1;
     this._longRunningOperationRetryTimeout   = -1;
     this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
 }
Exemple #12
0
 /// <summary>
 /// Returns the specified Active directory's configuration.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. Name of the collection
 /// </param>
 /// <returns>
 /// Similar in structure to the VNet class but used to return one of
 /// these in GET requests.
 /// </returns>
 public static Task <ActiveDirectoryConfigResult> GetAdAsync(this ICollectionOperations operations, string collectionName)
 {
     return(operations.GetAdAsync(collectionName, CancellationToken.None));
 }
Exemple #13
0
 /// <summary>
 /// Updates the specified Active directory's configuration.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. Name of the collection
 /// </param>
 /// <param name='activeDirectoryConfigDetails'>
 /// Required. AD config
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> SetAdAsync(this ICollectionOperations operations, string collectionName, ActiveDirectoryConfigParameter activeDirectoryConfigDetails)
 {
     return(operations.SetAdAsync(collectionName, activeDirectoryConfigDetails, CancellationToken.None));
 }
Exemple #14
0
 /// <summary>
 /// Gets the summary of collection usage for the requested period.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The collection name.
 /// </param>
 /// <param name='year'>
 /// Required. The billing year in YYYY format.
 /// </param>
 /// <param name='month'>
 /// Required. The billing month in range of 01 through 12 inclusive.
 /// </param>
 /// <param name='locale'>
 /// Required. The locale value which will be applied to the generated
 /// usage report.
 /// </param>
 /// <returns>
 /// The collection usage billing details.
 /// </returns>
 public static Task <CollectionUsageDetailsResult> GetUsageDetailsAsync(this ICollectionOperations operations, string collectionName, string year, string month, string locale)
 {
     return(operations.GetUsageDetailsAsync(collectionName, year, month, locale, CancellationToken.None));
 }
Exemple #15
0
 /// <summary>
 /// Sets a new information to the collection with given id.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The name of the collection.
 /// </param>
 /// <param name='forceRedeploy'>
 /// Required. A flag denoting if the request is to re-deploy the
 /// collection after it is updated.
 /// </param>
 /// <param name='populateOnly'>
 /// Required. A flag denoting if the request is to populate the
 /// collection details(true for populate only).
 /// </param>
 /// <param name='collectionDetails'>
 /// Required. Details for the collection to be updated.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> SetAsync(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails)
 {
     return(operations.SetAsync(collectionName, forceRedeploy, populateOnly, collectionDetails, CancellationToken.None));
 }
Exemple #16
0
 /// <summary>
 /// Gets the summary of collection usage for the requested period.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The collection name.
 /// </param>
 /// <param name='year'>
 /// Required. The billing year in YYYY format.
 /// </param>
 /// <param name='month'>
 /// Required. The billing month in range of 01 through 12 inclusive.
 /// </param>
 /// <returns>
 /// The collection usage billing summary.
 /// </returns>
 public static Task <CollectionUsageSummaryListResult> GetUsageSummaryAsync(this ICollectionOperations operations, string collectionName, string year, string month)
 {
     return(operations.GetUsageSummaryAsync(collectionName, year, month, CancellationToken.None));
 }
Exemple #17
0
 /// <summary>
 /// Sends message to the session associated with the user UPN
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name where the session exists.
 /// </param>
 /// <param name='sessionMessageParameter'>
 /// Required. The session command parameter to send message to a
 /// session.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> SendMessageToSessionAsync(this ICollectionOperations operations, string collectionName, SessionSendMessageCommandParameter sessionMessageParameter)
 {
     return(operations.SendMessageToSessionAsync(collectionName, sessionMessageParameter, CancellationToken.None));
 }
Exemple #18
0
 /// <summary>
 /// Restarts VM associated with a collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name containing the VM to be
 /// restarted.
 /// </param>
 /// <param name='details'>
 /// Required. The details of VM to be restarted.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> RestartVmAsync(this ICollectionOperations operations, string collectionName, RestartVmCommandParameter details)
 {
     return(operations.RestartVmAsync(collectionName, details, CancellationToken.None));
 }
Exemple #19
0
 /// <summary>
 /// Gets the list of all virtual machines in the collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name where vms exist.
 /// </param>
 /// <returns>
 /// List of virtual machines in a given collection.
 /// </returns>
 public static Task <CollectionVmsListResult> ListVmsAsync(this ICollectionOperations operations, string collectionName)
 {
     return(operations.ListVmsAsync(collectionName, CancellationToken.None));
 }
Exemple #20
0
 /// <summary>
 /// Returns the result for a given collection
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The name of the collection.
 /// </param>
 /// <returns>
 /// The response for the GetServiceList operation.
 /// </returns>
 public static Task <CollectionResult> GetAsync(this ICollectionOperations operations, string collectionName)
 {
     return(operations.GetAsync(collectionName, CancellationToken.None));
 }
Exemple #21
0
 /// <summary>
 /// Creates a collection with the given details.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='populateOnly'>
 /// Required. A flag denoting if the request is to populate the
 /// creation details of the collection or update and deploy (true for
 /// populate only).
 /// </param>
 /// <param name='collectionDetails'>
 /// Required. Details for the collection to be created.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> CreateAsync(this ICollectionOperations operations, bool populateOnly, CollectionCreationDetails collectionDetails)
 {
     return(operations.CreateAsync(populateOnly, collectionDetails, CancellationToken.None));
 }
Exemple #22
0
 /// <summary>
 /// Logs off the session associated with the user UPN
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The RemoteApp collection name where the session exists.
 /// </param>
 /// <param name='sessionParameter'>
 /// Required. The session command parameter to logoff a session.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> LogoffSessionAsync(this ICollectionOperations operations, string collectionName, SessionCommandParameter sessionParameter)
 {
     return(operations.LogoffSessionAsync(collectionName, sessionParameter, CancellationToken.None));
 }
 /// <summary>
 /// Retrieves the metrics determined by the given filter for the given database
 /// account and collection.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Name of an Azure resource group.
 /// </param>
 /// <param name='accountName'>
 /// Cosmos DB database account name.
 /// </param>
 /// <param name='databaseRid'>
 /// Cosmos DB database rid.
 /// </param>
 /// <param name='collectionRid'>
 /// Cosmos DB collection rid.
 /// </param>
 /// <param name='filter'>
 /// An OData filter expression that describes a subset of metrics to return.
 /// The parameters that can be filtered are name.value (name of the metric, can
 /// have an or of multiple names), startTime, endTime, and timeGrain. The
 /// supported operator is eq.
 /// </param>
 public static IEnumerable <Metric> ListMetrics(this ICollectionOperations operations, string resourceGroupName, string accountName, string databaseRid, string collectionRid, string filter)
 {
     return(operations.ListMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).GetAwaiter().GetResult());
 }
Exemple #24
0
 /// <summary>
 /// Deletes the given collection.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <param name='collectionName'>
 /// Required. The name of the collection.
 /// </param>
 /// <returns>
 /// The response containing the operation tracking id.
 /// </returns>
 public static Task <OperationResultWithTrackingId> DeleteAsync(this ICollectionOperations operations, string collectionName)
 {
     return(operations.DeleteAsync(collectionName, CancellationToken.None));
 }
Exemple #25
0
 /// <summary>
 /// Gets a list of all regions where collection can be created for the
 /// subscription.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.RemoteApp.ICollectionOperations.
 /// </param>
 /// <returns>
 /// The list of locations.
 /// </returns>
 public static Task <RegionListResult> RegionListAsync(this ICollectionOperations operations)
 {
     return(operations.RegionListAsync(CancellationToken.None));
 }
Exemple #26
0
        //public static async Task ExecuteLambda<T>(this ICollectionOperations<T> collection, Expression<Action<CollectionHostedElement<T>, object>> func, object state = null)
        //{
        //    Expression<Func<CollectionHostedElement<T>, object, Task>> asyncExpression = (element, o) => Expression.Call(func.me)
        //    var expression = func.Compile();
        //    var expNode = func.ToExpressionNode();
        //    await collection.ExecuteLambda(expNode, state);
        //}

        public static async Task ExecuteBatchLambda <T>(this ICollectionOperations <T> collection, Expression <Func <IEnumerable <CollectionHostedElement <T> >, object, Task> > func, object state = null)
        {
            var expNode = func.ToExpressionNode();
            await collection.ExecuteBatchLambda(expNode, state);
        }