Exemple #1
0
 public async Task <ArmOperation <AvailabilitySet> > UpdateAsync(AvailabilitySetUpdate patchable, CancellationToken cancellationToken = default)
 {
     return(new PhArmOperation <AvailabilitySet, Azure.ResourceManager.Compute.Models.AvailabilitySet>(
                await Operations.UpdateAsync(Id.ResourceGroup, Id.Name, patchable, cancellationToken),
                a =>
     {
         Resource = new AvailabilitySetData(a);
         return new AvailabilitySet(ClientOptions, Resource as AvailabilitySetData);
     }));
 }
Exemple #2
0
 public ArmOperation <AvailabilitySet> Update(AvailabilitySetUpdate patchable)
 {
     return(new PhArmOperation <AvailabilitySet, Azure.ResourceManager.Compute.Models.AvailabilitySet>(
                Operations.Update(Id.ResourceGroup, Id.Name, patchable),
                a =>
     {
         Resource = new AvailabilitySetData(a);
         return new AvailabilitySet(ClientOptions, Resource as AvailabilitySetData);
     }));
 }
Exemple #3
0
 public async override Task <ArmResponse <AvailabilitySet> > GetAsync(CancellationToken cancellationToken = default)
 {
     return(new PhArmResponse <AvailabilitySet, Azure.ResourceManager.Compute.Models.AvailabilitySet>(
                await Operations.GetAsync(Id.ResourceGroup, Id.Name, cancellationToken),
                a =>
     {
         Resource = new AvailabilitySetData(a);
         return new AvailabilitySet(ClientOptions, Resource as AvailabilitySetData);
     }));
 }
Exemple #4
0
 public override ArmResponse <AvailabilitySet> Get()
 {
     return(new PhArmResponse <AvailabilitySet, Azure.ResourceManager.Compute.Models.AvailabilitySet>(
                Operations.Get(Id.ResourceGroup, Id.Name),
                a =>
     {
         Resource = new AvailabilitySetData(a);
         return new AvailabilitySet(ClientOptions, Resource as AvailabilitySetData);
     }));
 }
Exemple #5
0
        /// <summary>
        /// Construct an object used to create a VirtualMachine.
        /// </summary>
        /// <param name="vmName"> The name of the Virtual Machine. </param>
        /// <param name="adminUser"> The admin username to use. </param>
        /// <param name="adminPw"> The admin password to use. </param>
        /// <param name="nicId"> The network interface id to use. </param>
        /// <param name="aset"> The availability set to use. </param>
        /// <param name="location"> The location to create the Virtual Machine. </param>
        /// <returns> Object used to create a <see cref="VirtualMachine"/>. </returns>
        public VirtualMachineModelBuilder Construct(string vmName, string adminUser, string adminPw, ResourceIdentifier nicId, AvailabilitySetData aset, Location location = null)
        {
            var vm = new Azure.ResourceManager.Compute.Models.VirtualMachine(location ?? DefaultLocation)
            {
                NetworkProfile = new NetworkProfile {
                    NetworkInterfaces = new[] { new NetworkInterfaceReference()
                                                {
                                                    Id = nicId
                                                } }
                },
                OsProfile = new OSProfile
                {
                    ComputerName       = vmName,
                    AdminUsername      = adminUser,
                    AdminPassword      = adminPw,
                    LinuxConfiguration = new LinuxConfiguration {
                        DisablePasswordAuthentication = false, ProvisionVMAgent = true
                    }
                },
                StorageProfile = new StorageProfile()
                {
                    ImageReference = new ImageReference()
                    {
                        Offer     = "UbuntuServer",
                        Publisher = "Canonical",
                        Sku       = "18.04-LTS",
                        Version   = "latest"
                    },
                    DataDisks = new List <DataDisk>()
                },
                HardwareProfile = new HardwareProfile()
                {
                    VmSize = VirtualMachineSizeTypes.StandardB1Ms
                },
                AvailabilitySet = new SubResource()
                {
                    Id = aset.Id
                }
            };

            return(new VirtualMachineModelBuilder(this, new VirtualMachineData(vm)));
        }
 public AvailabilitySet(AzureResourceManagerClientOptions options, AvailabilitySetData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }
Exemple #7
0
        /// <summary>
        /// Construct an object used to create a VirtualMachine.
        /// </summary>
        /// <param name="vmName"> The name of the Virtual Machine. </param>
        /// <param name="adminUser"> The admin username to use. </param>
        /// <param name="adminPw"> The admin password to use. </param>
        /// <param name="nicId"> The network interface id to use. </param>
        /// <param name="aset"> The availability set to use. </param>
        /// <param name="location"> The location to create the Virtual Machine. </param>
        /// <returns> Object used to create a <see cref="VirtualMachine"/>. </returns>
        public VirtualMachineModelBuilder Construct(string vmName, string adminUser, string adminPw, ResourceIdentifier nicId, AvailabilitySetData aset, Location location = null)
        {
            Console.WriteLine("\n-----------------------\nVM NAME IS : " + vmName + "\n----------------------------------\n");
            var vm = new Azure.ResourceManager.Compute.Models.VirtualMachine(location ?? DefaultLocation)
            {
                NetworkProfile = new NetworkProfile {
                    NetworkInterfaces = new[] { new NetworkInterfaceReference()
                                                {
                                                    Id = nicId
                                                } }
                },
                OsProfile = new OSProfile
                {
                    ComputerName         = vmName,
                    AdminUsername        = adminUser,
                    AdminPassword        = adminPw,
                    WindowsConfiguration = new WindowsConfiguration {
                        TimeZone = "Pacific Standard Time", ProvisionVMAgent = true
                    }
                },
                StorageProfile = new StorageProfile()
                {
                    ImageReference = new ImageReference()
                    {
                        Offer     = "WindowsServer",
                        Publisher = "MicrosoftWindowsServer",
                        Sku       = "2019-Datacenter",
                        Version   = "latest"
                    },
                    DataDisks = new List <DataDisk>()
                },
                HardwareProfile = new HardwareProfile()
                {
                    VmSize = VirtualMachineSizeTypes.StandardB1Ms
                },
                AvailabilitySet = new SubResource()
                {
                    Id = aset.Id
                }
            };

            return(new VirtualMachineModelBuilder(this, new VirtualMachineData(vm)));
        }
Exemple #8
0
 public static AvailabilitySet AvailabilitySet(this ResourceGroup resourceGroup, AvailabilitySetData availabilitySet)
 {
     return(new AvailabilitySet(resourceGroup.ClientOptions, availabilitySet));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AvailabilitySet"/> 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 AvailabilitySet(ResourceOperationsBase options, AvailabilitySetData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }