public async Task DeleteInstances()
        {
            #region Snippet:Managing_Instances_DeleteAnInstance
            // First we need to get the instance collection from the specific account
            DeviceUpdateAccount account = await resourceGroup.GetDeviceUpdateAccounts().GetAsync("myAccount");

            DeviceUpdateInstanceCollection instanceCollection = account.GetDeviceUpdateInstances();
            // Now we can get the instance with GetAsync()
            DeviceUpdateInstance instance = await instanceCollection.GetAsync("myInstance");

            // With DeleteAsync(), we can delete the instance
            await instance.DeleteAsync(true);

            #endregion Snippet:Managing_Instances_DeleteAnInstance
        }
        public async Task ListInstances()
        {
            #region Snippet:Managing_Instances_ListAllInstances
            // First we need to get the instance collection from the specific account
            DeviceUpdateAccount account = await resourceGroup.GetDeviceUpdateAccounts().GetAsync("myAccount");

            DeviceUpdateInstanceCollection instanceCollection = account.GetDeviceUpdateInstances();
            // With GetAllAsync(), we can get a list of the instances in the collection
            AsyncPageable <DeviceUpdateInstance> response = instanceCollection.GetAllAsync();
            await foreach (DeviceUpdateInstance instance in response)
            {
                Console.WriteLine(instance.Data.Name);
            }
            #endregion Snippet:Managing_Instances_ListAllInstances
        }
Example #3
0
        public async Task UpdateInstances()
        {
            #region Snippet:Managing_Instances_UpdateAnInstance
            // First we need to get the instance collection from the specific account
            DeviceUpdateAccountResource account = await resourceGroup.GetDeviceUpdateAccounts().GetAsync("myAccount");

            DeviceUpdateInstanceCollection instanceCollection = account.GetDeviceUpdateInstances();
            // Now we can get the instance with GetAsync()
            DeviceUpdateInstanceResource instance = await instanceCollection.GetAsync("myInstance");

            // With AddTagAsync(), we can add tag to the instance
            instance = await instance.AddTagAsync("newTag", "newValue");

            #endregion Snippet:Managing_Instances_UpdateAnInstance
        }
        public async Task UpdateInstances()
        {
            #region Snippet:Managing_Instances_UpdateAnInstance
            // First we need to get the instance collection from the specific account
            DeviceUpdateAccount account = await resourceGroup.GetDeviceUpdateAccounts().GetAsync("myAccount");

            DeviceUpdateInstanceCollection instanceCollection = account.GetDeviceUpdateInstances();
            // Now we can get the instance with GetAsync()
            DeviceUpdateInstance instance = await instanceCollection.GetAsync("myInstance");

            // With UpdateAsync(), we can update the instance
            TagUpdateOptions updateOptions = new TagUpdateOptions();
            updateOptions.Tags.Add("newTag", "newValue");
            instance = await instance.UpdateAsync(updateOptions);

            #endregion Snippet:Managing_Instances_UpdateAnInstance
        }