public static async Task <ServersResponseCollection> GetMcp2DeployedServers( this IComputeApiClient client, ServerListOptions options = null, PageableRequest pagingOptions = null) { return(await client.ServerManagement.Server.GetMcp2DeployedServers(options, pagingOptions)); }
/// <summary> /// The get mcp 2 deployed servers. /// </summary> /// <param name="options"> /// The options. /// </param> /// <param name="pagingOptions"> /// The paging options. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <ServersResponseCollection> GetMcp2DeployedServers( ServerListOptions options = null, PageableRequest pagingOptions = null) { ServersResponseCollection servers = await _apiClient.GetAsync <ServersResponseCollection>(ApiUris.GetMcp2Servers(_apiClient.OrganizationId), pagingOptions); return(servers); }
public void AppendToUriWithExistingQuery() { var uri = new Uri("/resource?id=12", UriKind.Relative); var options = new PageableRequest { PageSize = 50, PageNumber = 1 }; var result = PageableRequestExtensions.AppendToUri(options, uri); Assert.AreEqual("/resource?id=12&pageSize=50&pageNumber=1", result.ToString()); }
public async Task <PageableResponse <T> > Get(PageableRequest pageableRequest) { var result = await collection.Find(FilterDefinition <T> .Empty) .Sort(CreateSortFromOrderBy(pageableRequest.OrderBy)) .Skip(pageableRequest.Skip) .Limit(pageableRequest.Top) .ToListAsync(); return(new PageableResponse <T>() { Count = collection.CountDocuments(FilterDefinition <T> .Empty), Items = result, Skip = pageableRequest.Skip, Top = pageableRequest.Top }); }
/// <summary> /// Retrieves SSL Domain Certificate Chaines. /// </summary> /// <param name="options">The filter options</param> /// <param name="pagingOptions">options for controlling the paging</param> /// <returns>The async task of collection of <see cref="sslCertificateChains"/></returns> public async Task <PagedResponse <SslCertificateChainType> > GetSslCertificateChainesPaginated( SslCertificateChainListOptions options = null, PageableRequest pagingOptions = null) { var response = await _apiClient.GetAsync <sslCertificateChains>( ApiUris.ListSslCertificateChains(_apiClient.OrganizationId), pagingOptions, options); return(new PagedResponse <SslCertificateChainType> { items = response.sslCertificateChain, 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 Consistency Group menthod. /// </summary> /// <param name="filteringOptions">The filtering options.</param> /// <param name="pagingOptions">The pagination options.</param> /// <returns>Paginated result of <see cref="ConsistencyGroupType"/></returns> public async Task <PagedResponse <ConsistencyGroupType> > GetConsistencyGroupsPaginated(ConsistencyGroupListOptions filteringOptions = null, PageableRequest pagingOptions = null) { var response = await _apiClient.GetAsync <consistencyGroups>(ApiUris.GetConsistencyGroups(_apiClient.OrganizationId), pagingOptions, filteringOptions); return(new PagedResponse <ConsistencyGroupType> { items = response.consistencyGroup, 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> /// List Security groups associated with server nics or the vlan /// </summary> /// <param name="vlanId">Vlan Id</param> /// <param name="serverId">Server Id</param> /// <param name="pagingOptions">Paging options</param> /// <param name="filterOptions">Filter options</param> /// <returns>List of Security groups</returns> public async Task <PagedResponse <SecurityGroupType> > GetSecurityGroupsPaged(Guid?vlanId, Guid?serverId, PageableRequest pagingOptions = null, SecurityGroupListOptions filterOptions = null) { if (vlanId == null && serverId == null) { throw new ArgumentException("Both vlanId and serverId cannot be null, atleast provide one"); } var response = await _api.GetAsync <securityGroups>(serverId.HasValue?ApiUris.GetSecurityGroupForServer(_api.OrganizationId, serverId.Value) : ApiUris.GetSecurityGroupForVlan(_api.OrganizationId, vlanId.Value), pagingOptions, filterOptions); return(new PagedResponse <SecurityGroupType> { items = response.securityGroup, 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 network domains. /// </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 <NetworkDomainType> > GetNetworkDomainsPaginated(NetworkDomainListOptions filteringOptions = null, PageableRequest pagingOptions = null) { var response = await _apiClient.GetAsync <networkDomains>(ApiUris.NetworkDomains(_apiClient.OrganizationId), pagingOptions, filteringOptions); return(new PagedResponse <NetworkDomainType> { items = response.networkDomain, 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> /// Retrieves the list of ACL rules associated with a network. This API requires your /// organization ID and the ID of the target network. /// </summary> /// <param name="options"> /// Options for controlling the operation. /// </param> /// <param name="pagingOptions"> /// Options for controlling the paging. /// </param> /// <returns> /// The VLAN collection. /// </returns> public async Task <IEnumerable <VlanType> > GetVlans(VlanListOptions options = null, PageableRequest pagingOptions = null) { var vlans = await _api.GetAsync <vlans>( ApiUris.GetVlanByOrgId(_api.OrganizationId), pagingOptions); return(vlans.vlan); }
public async Task <IEnumerable <VlanType> > GetVlans(Guid id, string vlanName, Guid networkDomainId, PageableRequest pagingOptions = null) { var vlans = await _api.GetAsync <vlans>( ApiUris.GetVlan(_api.OrganizationId, id, vlanName, networkDomainId), pagingOptions); return(vlans.vlan); }
public static async Task <IEnumerable <NetworkDomainType> > GetNetworkDomain(this IComputeApiClient client, Guid networkDomainId, string networkName, PageableRequest pagingOptions = null) { return(await client.Networking.NetworkDomain.GetNetworkDomain(networkDomainId, networkName, pagingOptions)); }
/// <summary> /// Lists all ip address list. /// </summary> /// <param name="networkDomainId">The Network domain id.</param> /// <param name="options">The filter options.</param> /// <param name="pagingOptions">The paging options.</param> /// <returns>The async task of <see cref="PagedResponse{PortListType}"/></returns> public async Task <PagedResponse <PortListType> > GetPortListsPaginated(Guid networkDomainId, PortListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <portLists>(ApiUris.ListPortList(_api.OrganizationId, networkDomainId), pagingOptions, options); return(new PagedResponse <PortListType> { items = response.portList, 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> /// Retrieves default persistence profiles. /// </summary> /// <param name="networkDomainId">The network domain id</param> /// <param name="options">The filter options</param> /// <param name="pagingOptions">The paging options</param> /// <returns>The async task of <see cref="PagedResponse{DefaultPersistenceProfileType}"/></returns> public async Task <PagedResponse <DefaultPersistenceProfileType> > GetDefaultPersistenceProfilesPaginated(Guid networkDomainId, DefaultPersistenceProfileListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <defaultPersistenceProfiles>(ApiUris.GetDefaultPersistenceProfile(_api.OrganizationId, networkDomainId), pagingOptions, options); return(new PagedResponse <DefaultPersistenceProfileType> { items = response.defaultPersistenceProfile, 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 }); }
public static TConverted[] ToPagedArray <T, TConverted>(this IEnumerable <T> repository, PageableRequest request, Func <T, TConverted> converter) where T : class where TConverted : class { return(ToPagedList(repository, request).Select(converter).ToArray()); }
public async Task <PageableResponse <Car> > Get([FromQuery] PageableRequest pageableRequest) { return(await repository.Get(pageableRequest)); }
/// <summary> /// This function gets list of network domains from Cloud. /// </summary> /// <param name="networkDomainId"> /// Network domain id. /// </param> /// <param name="networkName"> /// The network Name. /// </param> /// <param name="pagingOptions"> /// Options for controlling the paging. /// </param> /// <returns> /// The list of network domains associated with the organization. /// </returns> public async Task<IEnumerable<NetworkDomainType>> GetNetworkDomain(Guid networkDomainId, string networkName, PageableRequest pagingOptions = null) { var networks = await _apiClient.GetAsync<networkDomains>(ApiUris.NetworkDomain(_apiClient.OrganizationId, networkDomainId, networkName), pagingOptions); return networks.networkDomain; }
/// <summary> /// Retrieves the list of the NAT Rules on a particular Network Domain at an MCP 2.0 data center /// This API requires your organization ID and the ID of the target network. /// </summary> /// <param name="networkDomainId"> Identifier for the network domain.</param> /// <param name="options"> Options for filtering the operations.</param> /// <param name="pagingOptions"> The paging options, null means default.</param> /// <returns> The NAT Rule collection.</returns> public async Task <PagedResponse <NatRuleType> > GetNatRulesPaginated(Guid networkDomainId, NatRuleListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <natRules>(ApiUris.GetDomainNatRules(_api.OrganizationId, networkDomainId.ToString()), pagingOptions, options); return(new PagedResponse <NatRuleType> { items = response.natRule, 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> /// List Security groups. /// </summary> /// <param name="pagingOptions">Paging options</param> /// <param name="filterOptions">Filter options</param> /// <returns>List of Security groups</returns> public async Task <PagedResponse <SecurityGroupType> > GetSecurityGroupsPaginated(PageableRequest pagingOptions = null, SecurityGroupListOptions filterOptions = null) { var response = await _api.GetAsync <securityGroups>(ApiUris.GetSecurityGroup(_api.OrganizationId), pagingOptions, filterOptions); return(new PagedResponse <SecurityGroupType> { items = response.securityGroup, 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 static routes. /// </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 <StaticRouteType> > GetStaticRoutesPaginated(StaticRouteListOptions filteringOptions = null, PageableRequest pagingOptions = null) { var response = await _apiClient.GetAsync <staticRoutes>(ApiUris.StaticRoutes(_apiClient.OrganizationId), pagingOptions, filteringOptions); return(new PagedResponse <StaticRouteType> { items = response.staticRoute, 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 }); }
public static IEnumerable <T> ToPagedList <T>(this IEnumerable <T> repository, PageableRequest request) where T : class { if (request.ShowAll) { return(repository); } if (!string.IsNullOrEmpty(request.SortBy)) { PropertyInfo propertyInfo = typeof(T).GetProperty(request.SortBy); if (propertyInfo != null) { repository = string.Compare(request.OrderBy.ToLower(), "desc", StringComparison.Ordinal) == 0 ? (from x in repository orderby propertyInfo.GetValue(x, null) descending select x) : (from x in repository orderby propertyInfo.GetValue(x, null) select x); } } return(repository.ToPagedList(request.Page, request.Rows)); }
public static async Task <IEnumerable <VlanType> > GetVlans(this IComputeApiClient client, VlanListOptions options = null, PageableRequest pagingOptions = null) { return(await client.Networking.Vlan.GetVlans(options, pagingOptions)); }
/// <summary> /// Retrieves all of the VirtualListeners on a particular Network Domain at an MCP 2.0 data center. /// </summary> /// <param name="options">The filter options</param> /// <param name="pagingOptions"> The paging Options.</param> /// <returns>The async task of <see cref="PagedResponse{VirtualListenerType}"/></returns> public async Task <PagedResponse <VirtualListenerType> > GetVirtualListenersPaginated(VirtualListenerListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <virtualListeners>(ApiUris.GetVirtualListeners(_api.OrganizationId), pagingOptions, options); return(new PagedResponse <VirtualListenerType> { items = response.virtualListener, 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 }); }
public static async Task <IEnumerable <VlanType> > GetVlans(this IComputeApiClient client, Guid id, string vlanName, Guid networkDomainId, PageableRequest pagingOptions = null) { return(await client.Networking.Vlan.GetVlans(id, vlanName, networkDomainId, pagingOptions)); }
/// <summary> /// Lists all firewall rules. /// </summary> /// <param name="options">The filter options.</param> /// <param name="pagingOptions">The paging options.</param> /// <returns>The async task of <see cref="PagedResponse{FirewallRuleType}"/></returns> public async Task <PagedResponse <FirewallRuleType> > GetFirewallRulesPaginated(FirewallRuleListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <firewallRules>(ApiUris.GetFirewallRules(_api.OrganizationId), pagingOptions, options); return(new PagedResponse <FirewallRuleType> { items = response.firewallRule, 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 }); }
public static async Task <IEnumerable <NetworkDomainType> > GetNetworkDomains(this IComputeApiClient client, PageableRequest pagingOptions = null) { return(await client.Networking.NetworkDomain.GetNetworkDomains(pagingOptions)); }