protected override void BeginProcessing() { try { var lanApi = new LanApi(Utilities.Configuration); var newProps = new LanProperties { Public = this.Public }; newProps.IpFailover = this.IpFailover; if (!string.IsNullOrEmpty(Name)) { newProps.Name = Name; } var resp = lanApi.PartialUpdate(DataCenterId, LanId, newProps); WriteObject(resp); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
private void Configure() { configuration = new Configuration { Username = "******", Password = "******", }; dcApi = new DataCenterApi(configuration); lanApi = new LanApi(configuration); //Create a datacenter. if (datacenter == null) { datacenter = new Datacenter { Properties = new DatacenterProperties { Name = ".Net V2 - Test " + DateTime.Now.ToShortTimeString(), Description = "Unit test for .Net SDK PB REST V2", Location = "us/lasdev" } }; datacenter = dcApi.Create(datacenter); } }
protected override void BeginProcessing() { try { var lanApi = new LanApi(Utilities.Configuration); var lan = lanApi.Delete(DataCenterId, LanId); WriteObject(lan); } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }
protected override void BeginProcessing() { try { var lanApi = new LanApi(Utilities.Configuration); if (!string.IsNullOrEmpty(LanId)) { var lan = lanApi.FindById(DataCenterId, LanId, depth: 5); WriteObject(lan); } else { var lans = lanApi.FindAll(DataCenterId, depth: 5); WriteObject(lans.Items); } } catch (Exception ex) { WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null)); } }