/// <summary> /// The gets the operating system detail /// </summary> /// <param name="operatingSystemId"> /// The Operating System Id. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <OperatingSystemDetailType> GetOperatingSystem(string operatingSystemId) { var filter = new OperatingSystemListOptions() { Id = operatingSystemId }; var response = await _apiClient.GetAsync <operatingSystems>( ApiUris.GetMcp2OperatingSystems(_apiClient.OrganizationId), null, filter); return(response?.operatingSystem[0]); }
/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { base.ProcessRecord(); try { OperatingSystemListOptions options = null; if (ParameterSetName == "Filtered") { options = new OperatingSystemListOptions() { Name = Name, Id = OperatingSystemId, Family = OperatingSystemFamily } } ; this.WritePagedObject(Connection.ApiClient.Infrastructure.GetOperatingSystems(PageableRequest, options).Result); } catch (AggregateException ae) { ae.Handle( e => { if (e is ComputeApiException) { WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection)); } else { ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection)); } return(true); }); } }
/// <summary> /// Get Operating systems supported at the data center level /// </summary> /// <param name="dataCenterId">Data center id</param> /// <param name="pagingOptions">Paging options</param> /// <param name="filterOptions">Filtering options</param> /// <returns>Operating Systems</returns> public async Task <PagedResponse <OperatingSystemDetailType> > GetOperatingSystems(string dataCenterId, IPageableRequest pagingOptions = null, OperatingSystemListOptions filterOptions = null) { var response = await _apiClient.GetAsync <OperatingSystemsDetails>( ApiUris.GetMcp2OperatingSystems(_apiClient.OrganizationId, dataCenterId), pagingOptions, filterOptions); return(new PagedResponse <OperatingSystemDetailType> { items = response.operatingSystemDetail, totalCount = response.totalCountSpecified ? response.totalCount : (int?)null, pageCount = response.pageCountSpecified ? response.pageCount : (int?)null, pageNumber = response.pageNumberSpecified ? response.pageNumber : (int?)null, pageSize = response.pageSizeSpecified ? response.pageSize : (int?)null }); }