/// <summary> /// Complete mandatory configuration of a device. /// </summary> private void ConfigureDevice(string deviceName) { ConfigureDeviceRequest configureRequest = new ConfigureDeviceRequest(); configureRequest.CurrentDeviceName = deviceName; configureRequest.FriendlyName = deviceName; configureRequest.TimeZone = "Pacific Standard Time"; configureRequest.DnsSettings = null; NetworkInterfaceData0Settings data0NetworkSetting = new NetworkInterfaceData0Settings(); data0NetworkSetting.ControllerZeroIp = "10.168.220.227"; data0NetworkSetting.ControllerOneIp = "10.168.220.228"; configureRequest.NetworkInterfaceData0Settings = data0NetworkSetting; this.Client.Devices.Configure( configureRequest, this.ResourceGroupName, this.ManagerName); }
private Device ConfigureAndGetDevice(string deviceNameWithoutDoubleEncoding, string controllerZeroIp, string controllerOneIp) { Device device = this.Client.Devices.Get( deviceNameWithoutDoubleEncoding.GetDoubleEncoded(), this.ResourceGroupName, this.ManagerName); if (device.Status == DeviceStatus.ReadyToSetup) { var secondaryDnsServers = TestConstants.SecondaryDnsServers.Split(';'); var configureDeviceRequest = new ConfigureDeviceRequest() { FriendlyName = deviceNameWithoutDoubleEncoding.GetDoubleEncoded(), CurrentDeviceName = deviceNameWithoutDoubleEncoding.GetDoubleEncoded(), TimeZone = "India Standard Time", NetworkInterfaceData0Settings = new NetworkInterfaceData0Settings() { ControllerZeroIp = controllerZeroIp, ControllerOneIp = controllerOneIp }, DnsSettings = new SecondaryDNSSettings() { SecondaryDnsServers = new List <string>(secondaryDnsServers) } }; this.Client.Devices.Configure( configureDeviceRequest, this.ResourceGroupName, this.ManagerName); //need to add details related to odata filter device = this.Client.Devices.Get( deviceNameWithoutDoubleEncoding.GetDoubleEncoded(), this.ResourceGroupName, this.ManagerName); } return(device); }
/// <summary> /// Complete minimal setup before using the device. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='parameters'> /// The minimal properties to configure a device. /// </param> /// <param name='resourceGroupName'> /// The resource group name /// </param> /// <param name='managerName'> /// The manager name /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task BeginConfigureAsync(this IDevicesOperations operations, ConfigureDeviceRequest parameters, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) { await operations.BeginConfigureWithHttpMessagesAsync(parameters, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Complete minimal setup before using the device. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='parameters'> /// The minimal properties to configure a device. /// </param> /// <param name='resourceGroupName'> /// The resource group name /// </param> /// <param name='managerName'> /// The manager name /// </param> public static void BeginConfigure(this IDevicesOperations operations, ConfigureDeviceRequest parameters, string resourceGroupName, string managerName) { operations.BeginConfigureAsync(parameters, resourceGroupName, managerName).GetAwaiter().GetResult(); }