/// <summary>
 ///  The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation.
 /// </summary>
 /// <param name="patchable"> The parameters to update. </param>
 /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="P:System.Threading.CancellationToken.None" />. </param>
 /// <returns> A <see cref="Task"/> that on completion returns an <see cref="ArmOperation{VirtualMachine}"/> that allows polling for completion of the operation. </returns>
 public async Task <ArmOperation <VirtualMachine> > StartUpdateAsync(VirtualMachineUpdate patchable, CancellationToken cancellationToken = default)
 {
     return(new PhArmOperation <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                await Operations.StartUpdateAsync(Id.ResourceGroup, Id.Name, patchable, cancellationToken),
                v =>
     {
         Resource = new VirtualMachineData(v);
         return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
     }));
 }
 /// <summary>
 ///  The operation to update a virtual machine. Please note some properties can be set only during virtual machine creation.
 /// </summary>
 /// <param name="patchable"> The parameters to update. </param>
 /// <returns> An <see cref="ArmOperation{VirtualMachine}"/> that allows polling for completion of the operation. </returns>
 public ArmOperation <VirtualMachine> StartUpdate(VirtualMachineUpdate patchable)
 {
     return(new PhArmOperation <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                Operations.StartUpdate(Id.ResourceGroup, Id.Name, patchable),
                v =>
     {
         Resource = new VirtualMachineData(v);
         return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
     }));
 }
 /// <inheritdoc/>
 public async override Task <ArmResponse <VirtualMachine> > GetAsync(CancellationToken cancellationToken = default)
 {
     return(new PhArmResponse <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                await Operations.GetAsync(Id.ResourceGroup, Id.Name, cancellationToken),
                v =>
     {
         Resource = new VirtualMachineData(v);
         return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
     }));
 }
 /// <inheritdoc/>
 public override ArmResponse <VirtualMachine> Get()
 {
     return(new PhArmResponse <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                Operations.Get(Id.ResourceGroup, Id.Name),
                v =>
     {
         Resource = new VirtualMachineData(v);
         return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
     }));
 }
        /// <summary>
        /// Add a tag to a virtual machine.
        /// If the tag already exists it will be modified.
        /// </summary>
        /// <param name="key"> The key for the tag. </param>
        /// <param name="value"> The value for the tag. </param>
        /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="P:System.Threading.CancellationToken.None" />. </param>
        /// <returns> A <see cref="Task"/> that on completion returns an <see cref="ArmOperation{VirtualMachine}"/> that allows polling for completion of the operation. </returns>
        public async Task <ArmOperation <VirtualMachine> > StartAddTagAsync(string key, string value, CancellationToken cancellationToken = default)
        {
            var patchable = new VirtualMachineUpdate {
                Tags = new Dictionary <string, string>()
            };

            patchable.Tags.Add(key, value);
            return(new PhArmOperation <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                       await Operations.StartUpdateAsync(Id.ResourceGroup, Id.Name, patchable, cancellationToken),
                       v =>
            {
                Resource = new VirtualMachineData(v);
                return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
            }));
        }
        /// <summary>
        /// Add a tag to a virtual machine.
        /// If the tag already exists it will be modified.
        /// </summary>
        /// <param name="key"> The key for the tag. </param>
        /// <param name="value"> The value for the tag. </param>
        /// <returns> An <see cref="ArmOperation{VirtualMachine}"/> that allows polling for completion of the operation. </returns>
        public ArmOperation <VirtualMachine> StartAddTag(string key, string value)
        {
            var patchable = new VirtualMachineUpdate {
                Tags = new Dictionary <string, string>()
            };

            patchable.Tags.Add(key, value);
            return(new PhArmOperation <VirtualMachine, Azure.ResourceManager.Compute.Models.VirtualMachine>(
                       Operations.StartUpdate(Id.ResourceGroup, Id.Name, patchable),
                       v =>
            {
                Resource = new VirtualMachineData(v);
                return new VirtualMachine(ClientOptions, Resource as VirtualMachineData);
            }));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VirtualMachine"/> class.
 /// </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="resource"> The resource that is the target of operations. </param>
 internal VirtualMachine(AzureResourceManagerClientOptions options, VirtualMachineData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }
Ejemplo n.º 8
0
 public static VirtualMachine VirtualMachine(this ResourceGroup resourceGroup, VirtualMachineData vm)
 {
     return(new VirtualMachine(resourceGroup.ClientOptions, vm));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VirtualMachine"/> class.
 /// </summary>
 /// <param name="operations"> The client parameters to use in these operations. </param>
 /// <param name="resource"> The resource that is the target of operations. </param>
 internal VirtualMachine(ResourceOperationsBase operations, VirtualMachineData resource)
     : base(operations, resource.Id)
 {
     Data = resource;
 }