/// <summary>
        /// Appends query parameters for the supplied paging options to the supplied URI.
        /// </summary>
        /// <param name="uri">
        /// The URI to append the paging parameters to.
        /// </param>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <returns>
        /// The URI with the paging parameters.
        /// </returns>
        public static Uri AppendToUri(this IPageableRequest pagingOptions, Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            if (pagingOptions == null)
            {
                return(uri);
            }

            var filters = new List <string>();

            if (pagingOptions.PageSize.HasValue)
            {
                filters.Add(string.Format("pageSize={0}", pagingOptions.PageSize.Value));
            }

            if (pagingOptions.PageNumber.HasValue)
            {
                filters.Add(string.Format("pageNumber={0}", pagingOptions.PageNumber.Value));
            }

            if (!String.IsNullOrEmpty(pagingOptions.Order))
            {
                filters.Add(string.Format("orderBy={0}", pagingOptions.Order));
            }

            var queryString = String.Join("&", filters);

            return(uri.ToString().Contains("?")
                ? new Uri(uri + "&" + queryString, UriKind.Relative)
                : new Uri(uri + "?" + queryString, UriKind.Relative));
        }
		/// <summary>	Gets public IP blocks. </summary>
		/// <param name="networkDomainId">	Identifier for the network domain. </param>
		/// <param name="paging">		  	The paging options, null means default. </param>
		/// <returns>	The public IP blocks. </returns>
		/// <seealso cref="M:DD.CBU.Compute.Api.Client.Interfaces.IIpam.GetPublicIpBlocks(string,IPageableRequest)"/>
		public async Task<IEnumerable<PublicIpBlockType>> GetPublicIpBlocks(string networkDomainId, IPageableRequest paging = null)
		{
			var response =
				await
					_apiClient.GetAsync<publicIpBlocks>(ApiUris.GetPublicIpBlocks(_apiClient.OrganizationId));
			return response.publicIpBlock;
		}
Ejemplo n.º 3
0
        /// <summary>
        /// The get data centers with maintenance statuses.
        /// </summary>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <param name="filterOptions">
        /// The Filter options
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <IEnumerable <DatacenterType> > GetDataCenters(IPageableRequest pagingOptions = null, DataCenterListOptions filterOptions = null)
        {
            datacenters dataCenters = await _apiClient.GetAsync <datacenters>(
                ApiUris.DataCentres(_apiClient.OrganizationId), pagingOptions, filterOptions);

            return(dataCenters.datacenter);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The get deployed servers.
        /// </summary>
        /// <param name="filteringOptions">
        /// The filtering options.
        /// </param>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <IEnumerable <ServerWithBackupType> > GetDeployedServers(
            ServerListOptions filteringOptions = null,
            IPageableRequest pagingOptions     = null)
        {
            ServersWithBackup servers = await _apiClient.GetAsync <ServersWithBackup>(
                ApiUris.DeployedServers(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(servers.server);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The get data centers with maintenance statuses.
        /// </summary>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <param name="filterOptions">
        /// The Filter options
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <PagedResponse <DatacenterType> > GetDataCentersPaginated(IPageableRequest pagingOptions = null, DataCenterListOptions filterOptions = null)
        {
            datacenters dataCenters = await _apiClient.GetAsync <datacenters>(
                ApiUris.DataCentres(_apiClient.OrganizationId), pagingOptions, filterOptions);

            return(new PagedResponse <DatacenterType>
            {
                items = dataCenters.datacenter,
                totalCount = dataCenters.totalCountSpecified ? dataCenters.totalCount : (int?)null,
                pageCount = dataCenters.pageCountSpecified ? dataCenters.pageCount : (int?)null,
                pageNumber = dataCenters.pageNumberSpecified ? dataCenters.pageNumber : (int?)null,
                pageSize = dataCenters.pageSizeSpecified ? dataCenters.pageSize : (int?)null
            });
        }
Ejemplo n.º 6
0
        /// <summary>
        /// List all Os Units Groups
        /// </summary>
        /// <param name="pagingOptions">Paging options</param>
        /// <param name="filterOptions">Filtering options</param>
        /// <returns>Geo Regions</returns>
        public async Task <PagedResponse <OsUnitsGroupType> > ListOsUnitsGroups(IPageableRequest pagingOptions = null, ListOsUnitsGroupOptions filterOptions = null)
        {
            var response = await _apiClient.GetAsync <osUnitsGroups>(
                ApiUris.ListOsUnitsGroup(_apiClient.OrganizationId),
                pagingOptions,
                filterOptions);

            return(new PagedResponse <OsUnitsGroupType>
            {
                items = response.osUnitsGroup,
                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
            });
        }
Ejemplo n.º 7
0
        /// <summary>
        /// The get async.
        /// </summary>
        /// <param name="relativeOperationUri">
        /// The relative operation uri.
        /// </param>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <param name="filteringOptions">
        /// The filtering options.
        /// </param>
        /// <typeparam name="TResult">
        /// Result from the Get call
        /// </typeparam>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        /// <exception cref="ArgumentException">
        /// </exception>
        /// <exception cref="ComputeApiException">
        /// </exception>
        /// <exception cref="HttpRequestException">
        /// </exception>
        public async Task <TResult> GetAsync <TResult>(Uri relativeOperationUri, IPageableRequest pagingOptions = null, IFilterableRequest filteringOptions = null)
        {
            if (relativeOperationUri == null)
            {
                throw new ArgumentNullException("relativeOperationUri");
            }

            if (relativeOperationUri.IsAbsoluteUri)
            {
                throw new ArgumentException("The supplied URI is not a relative URI.", "relativeOperationUri");
            }

            if (filteringOptions != null)
            {
                relativeOperationUri = filteringOptions.AppendToUri(relativeOperationUri);
            }

            if (pagingOptions != null)
            {
                relativeOperationUri = pagingOptions.AppendToUri(relativeOperationUri);
            }

            try
            {
                using (HttpResponseMessage response = await _httpClient.GetAsync(relativeOperationUri))
                {
                    if (!response.IsSuccessStatusCode)
                    {
                        await HandleApiRequestErrors(response);
                    }

                    if (typeof(TResult) == typeof(string))
                    {
                        return((TResult)(object)(await response.Content.ReadAsStringAsync()));
                    }
                    else
                    {
                        return(await ReadResponseAsync <TResult>(response.Content));
                    }
                }
            }
            catch (HttpRequestException ex)
            {
                throw new ComputeApiHttpException(new Uri(_httpClient.BaseAddress, relativeOperationUri), HttpMethod.Get,
                                                  ex);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// The get async.
        /// </summary>
        /// <param name="relativeOperationUri">
        /// The relative operation uri.
        /// </param>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <typeparam name="TResult">
        /// Result from the Get call
        /// </typeparam>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        /// <exception cref="ArgumentException">
        /// </exception>
        /// <exception cref="ComputeApiException">
        /// </exception>
        /// <exception cref="HttpRequestException">
        /// </exception>
        public async Task <TResult> GetAsync <TResult>(Uri relativeOperationUri, IPageableRequest pagingOptions = null)
        {
            if (relativeOperationUri == null)
            {
                throw new ArgumentNullException("relativeOperationUri");
            }

            if (relativeOperationUri.IsAbsoluteUri)
            {
                throw new ArgumentException("The supplied URI is not a relative URI.", "relativeOperationUri");
            }

            using (HttpResponseMessage response = await _httpClient.GetAsync(relativeOperationUri))
            {
                if (!response.IsSuccessStatusCode)
                {
                    await HandleApiRequestErrors(response, relativeOperationUri);
                }
                return(await response.Content.ReadAsAsync <TResult>(_mediaTypeFormatters));
            }
        }
Ejemplo n.º 9
0
        /// <summary>The get snap shot windows.</summary>
        /// <param name="datacenterId">The Daacenter Id.</param>
        /// <param name="servicePlan">The Service Plan.</param>
        /// <param name="filteringOptions">The filtering options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <SnapshotWindowType> > GetSnapshotWindowPaginated(string datacenterId, string servicePlan, SnapshotWindowListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            snapshotWindows response = await _apiClient.GetAsync <snapshotWindows>(
                ApiUris.GetSnapshotWindow(_apiClient.OrganizationId, datacenterId, servicePlan),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <SnapshotWindowType>
            {
                items = response.snapshotWindow,
                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
            });
        }
Ejemplo n.º 10
0
        /// <summary>The get tag keys paginated.</summary>
        /// <param name="tagKeyListOptions">The tag key list options.</param>
        /// <param name="paginngOptions">The paginng options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <TagKeyType> > GetTagKeysPaginated(TagKeyListOptions tagKeyListOptions = null, IPageableRequest paginngOptions = null)
        {
            var response = await _apiClient.GetAsync <tagKeys>(ApiUris.ListTagKeys(_apiClient.OrganizationId), paginngOptions, tagKeyListOptions);

            return(new PagedResponse <TagKeyType>
            {
                items = response.tagKey,
                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
            });
        }
        /// <summary>
        /// Get the customer images export history.
        /// </summary>
        /// <param name="filteringOptions">Filtering options</param>
        /// <param name="pagingOptions">Paging options</param>
        /// <returns>Customer Image with Exports in progress status</returns>
        public async Task <PagedResponse <HistoricalImageExportType> > GetCustomerImagesExportHistory(CustomerImageExportHistoryOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <historicalImageExports>(
                ApiUris.GetCustomerImageExportHistory(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <HistoricalImageExportType>
            {
                items = response.historicalImageExport,
                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
            });
        }
        /// <summary>
        /// Get Customer Images
        /// </summary>
        /// <param name="filteringOptions">Filtering options</param>
        /// <param name="pagingOptions">Paging options</param>
        /// <returns>Customer Images</returns>
        public async Task <PagedResponse <CustomerImageType> > GetCustomerImages(ServerCustomerImageListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <customerImages>(
                ApiUris.GetMcp2CustomerImages(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <CustomerImageType>
            {
                items = response.customerImage,
                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
            });
        }
Ejemplo n.º 13
0
        /// <summary>	Gets public IP blocks. </summary>
        /// <param name="networkDomainId">	Identifier for the network domain. </param>
        /// <param name="paging">		    The paging options, null means default. </param>
        /// <returns>	The public IP blocks. </returns>
        /// <seealso cref="M:DD.CBU.Compute.Api.Client.Interfaces.IIpam.GetPublicIpBlocks(string,IPageableRequest)"/>
        public async Task <IEnumerable <PublicIpBlockType> > GetPublicIpBlocks(string networkDomainId, IPageableRequest paging = null)
        {
            var response =
                await
                _apiClient.GetAsync <publicIpBlocks>(ApiUris.GetPublicIpBlocks(_apiClient.OrganizationId));

            return(response.publicIpBlock);
        }
        /// <summary>
        /// Get the status of Customer Image Exports that a particular ogranization has  in progress
        /// </summary>
        /// <param name="filteringOptions">Filtering options</param>
        /// <param name="pagingOptions">Paging options</param>
        /// <returns>Customer Image with Exports in progress status</returns>
        public async Task <PagedResponse <ImageExportInProgressType> > GetCustomerImageExportsInProgress(CustomerImageExportInProgressOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <imageExportsInProgress>(
                ApiUris.GetMcp2CustomerImageExportsInProgress(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <ImageExportInProgressType>
            {
                items = response.imageExportInProgress,
                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
            });
        }
Ejemplo n.º 15
0
        /// <summary>The list historical server configurations for  mcp 2 deployed servers.</summary>
        /// <param name="serverId">The server Id</param>
        /// <param name="filteringOptions">The filtering options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <HistoricalServerConfigurationType> > ListHistoricalServerConfigurationsPaginated(Guid serverId, HistoricalServerConfigurationListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            if (serverId == Guid.Empty)
            {
                throw new ArgumentNullException("serverId");
            }

            var listHistoricalServerConfigurationsUrl =
                ApiUris.ListHistoricalServerConfigurations(_apiClient.OrganizationId, serverId);

            var response = await _apiClient.GetAsync <historicalServerConfigurations> (listHistoricalServerConfigurationsUrl, pagingOptions, filteringOptions);

            return(new PagedResponse <HistoricalServerConfigurationType> {
                items = response.historicalServerConfiguration,
                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
            });
        }
Ejemplo n.º 16
0
        public static IEnumerable <T> CombinePages <T>(Func <IPageableRequest, IEnumerable <T> > func, IPageableRequest request)
        {
            var serviceLocator = ServiceLocator.GetActive();

            int pageSize = serviceLocator.Paging.PageSize;

            request.PageSize = pageSize;

            var allItems      = new List <T>();
            int rowsRetrieved = 0;
            int pageNumber    = 0;

            do
            {
                request.PageNumber = pageNumber;
                var items = func(request);
                allItems.AddRange(items);
                rowsRetrieved = items.Count();
                pageNumber++;
            } while (rowsRetrieved == pageSize);
            return(allItems);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// List all the geographic regions
        /// </summary>
        /// <param name="pagingOptions">Paging options</param>
        /// <param name="filterOptions">Filtering options</param>
        /// <returns>Geo Regions</returns>
        public async Task <PagedResponse <GeographicRegionType> > ListGeographicRegions(IPageableRequest pagingOptions = null, ListGeographicRegionOptions filterOptions = null)
        {
            var response = await _apiClient.GetAsync <geographicRegions>(
                ApiUris.ListGeographicRegion(_apiClient.OrganizationId),
                pagingOptions,
                filterOptions);

            return(new PagedResponse <GeographicRegionType>
            {
                items = response.geographicRegion,
                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
            });
        }
Ejemplo n.º 18
0
        /// <summary>The list nics.</summary>
        /// <param name="vlanId">The vlan id.</param>
        /// <param name="filteringOptions">The filtering options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <NicWithSecurityGroupType> > ListNics(Guid vlanId, ListNicsOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            if (vlanId == Guid.Empty)
            {
                throw new ArgumentException("'vlanId' cannot be empty.");
            }

            var response = await _apiClient.GetAsync <nics>(ApiUris.ListNics(_apiClient.OrganizationId, vlanId), pagingOptions, filteringOptions);

            return(new PagedResponse <NicWithSecurityGroupType>
            {
                items = response.nic,
                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
            });
        }
        /// <summary>The get reserved ipv 6 addresses paginated.</summary>
        /// <param name="reservedIpv6ListOptions">The reserved ipv 6 list options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <ReservedIpv6AddressType> > GetReservedIpv6AddressesPaginated(ReservedIpv6ListOptions reservedIpv6ListOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <reservedIpv6Addresses>(
                ApiUris.GetReservedIpv6Addresses(_apiClient.OrganizationId),
                pagingOptions,
                reservedIpv6ListOptions);

            return(new PagedResponse <ReservedIpv6AddressType>
            {
                items = response.reservedIpv6Address,
                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
            });
        }
        /// <summary>	Gets reserved private addresses. </summary>
        /// <param name="vlanId">The VLAN Id.</param>
        /// <param name="pagingOptions">	The paging options, null means default. </param>
        /// <returns>	The reserved private addresses. </returns>
        public async Task <PagedResponse <ReservedPrivateIpv4AddressType> > GetReservedPrivateAddressesForVlanPaginated(Guid vlanId, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <reservedPrivateIpv4Addresses>(
                ApiUris.GetReservedPrivateAddresses(_apiClient.OrganizationId, vlanId.ToString()),
                pagingOptions);

            return(new PagedResponse <ReservedPrivateIpv4AddressType>
            {
                items = response.ipv4,
                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
            });
        }
        /// <summary>	Gets reserved public IP addresses for a network domain. </summary>
        /// <param name="networkDomainId">	Identifier for the network domain. </param>
        /// <param name="pagingOptions">	The paging options, null means default. </param>
        /// <param name="filterOptions">Filtering option</param>
        /// <returns>	The reserved public addresses. </returns>
        public async Task <PagedResponse <ReservedPublicIpv4AddressType> > GetReservedPublicAddressesForNetworkDomainPaginated(Guid networkDomainId, IPageableRequest pagingOptions = null, ReservedPublicIpv4ListOptions filterOptions = null)
        {
            var response = await _apiClient.GetAsync <reservedPublicIpv4Addresses>(
                ApiUris.GetReservedPublicAddresses(_apiClient.OrganizationId, networkDomainId.ToString()),
                pagingOptions,
                filterOptions);

            return(new PagedResponse <ReservedPublicIpv4AddressType>
            {
                items = response.ip,
                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
            });
        }
Ejemplo n.º 22
0
        public async Task <PagedList <T> > GetPagedListAsync <T>(IQueryable <T> query, IPageableRequest request)
        {
            var totalItemsCount = await query.CountAsync();

            var result = await query.Skip((request.PageNumber - 1) *request.PageSize).Take(request.PageSize).ToListAsync();

            return(new PagedList <T>(result, request.PageNumber, request.PageSize, totalItemsCount));
        }
Ejemplo n.º 23
0
        /// <summary>The get mcp 2 deployed servers.</summary>
        /// <param name="filteringOptions">The filtering options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <SnapshotType> > GetSnapshotsPaginated(SnapshotListOptions filteringOptions, IPageableRequest pagingOptions = null)
        {
            if (filteringOptions == null || filteringOptions.ServerId == null || filteringOptions.ServerId == Guid.Empty)
            {
                throw new ArgumentNullException("serverId");
            }

            var response = await _apiClient.GetAsync <snapshots>(
                ApiUris.ListSnapshots(_apiClient.OrganizationId, filteringOptions.ServerId.Value),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <SnapshotType>
            {
                items = response.snapshot,
                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
            });
        }
        /// <summary>The get reserved ipv 6 addresses paginated.</summary>
        /// <param name="vlanId">The vlan id.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <ReservedIpv6AddressType> > GetReservedIpv6AddressesPaginated(Guid vlanId, IPageableRequest pagingOptions = null)
        {
            var filterOptions = new ReservedIpv6ListOptions
            {
                VlanId = vlanId
            };

            return(await GetReservedIpv6AddressesPaginated(filterOptions, pagingOptions));
        }
        /// <summary>
        /// The get data centers with maintenance statuses.
        /// </summary>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <IEnumerable <DatacenterWithMaintenanceStatusType> > GetDataCentersWithMaintenanceStatuses(IPageableRequest pagingOptions = null)
        {
            DatacentersWithMaintenanceStatus dataCenters = await _apiClient.GetAsync <DatacentersWithMaintenanceStatus>(
                ApiUris.DatacentresWithMaintanence(_apiClient.OrganizationId), pagingOptions);

            return(dataCenters.datacenter);
        }
Ejemplo n.º 26
0
        /// <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
            });
        }
        /// <summary>The get reserved ipv 6 addresses paginated.</summary>
        /// <param name="ipAddress">The ip address.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <ReservedIpv6AddressType> > GetReservedIpv6AddressesPaginated(string ipAddress, IPageableRequest pagingOptions = null)
        {
            var filterOptions = new ReservedIpv6ListOptions
            {
                IpAddress = ipAddress
            };

            return(await GetReservedIpv6AddressesPaginated(filterOptions, pagingOptions));
        }
Ejemplo n.º 28
0
        public async Task <ServersResponseCollection> GetMcp2DeployedServers(ServerListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            ServersResponseCollection servers = await _apiClient.GetAsync <ServersResponseCollection>(
                ApiUris.GetMcp2Servers(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(servers);
        }
        /// <summary>	Gets public IP blocks. </summary>
        /// <param name="networkDomainId">	Identifier for the network domain. </param>
        /// <param name="pagingOptions">	The paging options, null means default. </param>
        /// <param name="filterOptions">Filtering option</param>
        /// <returns>	The public IP blocks. </returns>
        public async Task <PagedResponse <PublicIpBlockType> > GetPublicIpBlocksPaginated(Guid networkDomainId, IPageableRequest pagingOptions = null, PublicIpListOptions filterOptions = null)
        {
            var response = await _apiClient.GetAsync <publicIpBlocks>(ApiUris.GetPublicIpBlocks(_apiClient.OrganizationId, networkDomainId.ToString()), pagingOptions, filterOptions);

            return(new PagedResponse <PublicIpBlockType>
            {
                items = response.publicIpBlock,
                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
            });
        }
Ejemplo n.º 30
0
        /// <summary>The get mcp 2 deployed servers.</summary>
        /// <param name="filteringOptions">The filtering options.</param>
        /// <param name="pagingOptions">The paging options.</param>
        /// <returns>The <see cref="Task"/>.</returns>
        public async Task <PagedResponse <ServerSummaryType> > ListServersPaginated(ServerListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <ServersSummaryResposeType>(
                ApiUris.ListServers(_apiClient.OrganizationId),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <ServerSummaryType>
            {
                items = response.server,
                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
            });
        }
        /// <summary>
        /// Gets the available anti affinity rules for a specific server.
        /// </summary>
        /// <param name="serverId">
        /// The server id.
        /// </param>
        /// <param name="filteringOptions">
        /// The filtering options.
        /// </param>
        /// <param name="pagingOptions">
        /// The paging options.
        /// </param>
        /// <returns>
        /// Collection of <see cref="AntiAffinityRuleType"/>.
        /// </returns>
        public async Task <PagedResponse <AntiAffinityRuleType> > GetAntiAffinityRulesForServerPaginated(Guid serverId, AntiAffinityRuleListOptions filteringOptions = null, IPageableRequest pagingOptions = null)
        {
            var response = await _apiClient.GetAsync <antiAffinityRules>(
                ApiUris.GetMcp2GetAntiAffinityRulesForServer(_apiClient.OrganizationId, serverId),
                pagingOptions,
                filteringOptions);

            return(new PagedResponse <AntiAffinityRuleType>
            {
                items = response.antiAffinityRule,
                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
            });
        }