protected override void BeginProcessing() { try { var loadbalancerApi = new LoadBalancerApi(Utilities.Configuration); var newProps = new LoadbalancerProperties { Dhcp = Dhcp }; if (!string.IsNullOrEmpty(Ip)) { newProps.Ip = Ip; } if (!string.IsNullOrEmpty(Name)) { newProps.Name = Name; } var resp = loadbalancerApi.PartialUpdate(DataCenterId, LoadbalancerId, newProps); WriteObject(resp); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
protected override void BeginProcessing() { try { var loadbalancerApi = new LoadBalancerApi(Utilities.Configuration); var newProps = new LoadbalancerProperties { Name = this.Name, Dhcp = this.Dhcp }; if (!string.IsNullOrEmpty(this.Ip)) { newProps.Ip = this.Ip; } var loadbalancer = loadbalancerApi.Create(DataCenterId, new Loadbalancer { Properties = newProps }); WriteObject(loadbalancer); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
protected override void BeginProcessing() { try { var loadbalancerApi = new LoadBalancerApi(Utilities.Configuration); var resp = loadbalancerApi.FindAll(DataCenterId, LoadbalancerId); WriteObject(resp.Items); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
protected override void BeginProcessing() { try { var loadbalancerApi = new LoadBalancerApi(Utilities.Configuration); if (!string.IsNullOrEmpty(LoadbalancerId)) { var loadbalancer = loadbalancerApi.FindById(DataCenterId, LoadbalancerId, depth: 5); WriteObject(loadbalancer); } else { var loadbalancers = loadbalancerApi.FindAll(DataCenterId, depth: 5); WriteObject(loadbalancers.Items); } } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }