/// <summary>
        /// List Service Usage Events
        /// <para>Events are sorted by internal database IDs. This order may differ from created_at.</para>
        /// <para></para>
        /// <para>Events close to the current time should not be processed because other events may still have open</para>
        /// <para>transactions that will change their order in the results.</para>
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/service_usage_events/list_service_usage_events.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListServiceUsageEventsResponse> > ListServiceUsageEvents(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/service_usage_events";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            var authHeader = await BuildAuthenticationHeader();

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                if (client.Headers.ContainsKey(authHeader.Key))
                {
                    client.Headers[authHeader.Key] = authHeader.Value;
                }
                else
                {
                    client.Headers.Add(authHeader);
                }
            }
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListServiceUsageEventsResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
        /// <summary>
        /// List all Service Instances for the Service Plan
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/service_plans/list_all_service_instances_for_the_service_plan.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllServiceInstancesForServicePlanResponse> > ListAllServiceInstancesForServicePlan(Guid?guid, RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = string.Format(CultureInfo.InvariantCulture, "/v2/service_plans/{0}/service_instances", guid);
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            var authHeader = await BuildAuthenticationHeader();

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                if (client.Headers.ContainsKey(authHeader.Key))
                {
                    client.Headers[authHeader.Key] = authHeader.Value;
                }
                else
                {
                    client.Headers.Add(authHeader);
                }
            }
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllServiceInstancesForServicePlanResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
        /// <summary>
        /// List all Service Bindings for the User Provided Service Instance
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/user_provided_service_instances/list_all_service_bindings_for_the_user_provided_service_instance.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllServiceBindingsForUserProvidedServiceInstanceResponse> > ListAllServiceBindingsForUserProvidedServiceInstance(Guid?guid, RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = string.Format(CultureInfo.InvariantCulture, "/v2/user_provided_service_instances/{0}/service_bindings", guid);
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            client.Headers.Add(await BuildAuthenticationHeader());
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllServiceBindingsForUserProvidedServiceInstanceResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
Пример #4
0
        /// <summary>
        /// List all Security Groups
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/security_groups/list_all_security_groups.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllSecurityGroupsResponse> > ListAllSecurityGroups(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/security_groups";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            client.Headers.Add(await BuildAuthenticationHeader());
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllSecurityGroupsResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
        /// <summary>
        /// List all Shared Domains
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/shared_domains/list_all_shared_domains.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllSharedDomainsResponse> > ListAllSharedDomains(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/shared_domains";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;

            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllSharedDomainsResponse>(await response.Content.ReadAsStringAsync(), this.Client));
        }
Пример #6
0
        /// <summary>
        /// List all Billing Managers for the Organization
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/organizations/list_all_billing_managers_for_the_organization.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllBillingManagersForOrganizationResponse> > ListAllBillingManagersForOrganization(Guid?guid, RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = string.Format(CultureInfo.InvariantCulture, "/v2/organizations/{0}/billing_managers", guid);
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            client.Headers.Add(await BuildAuthenticationHeader());
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllBillingManagersForOrganizationResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
Пример #7
0
        /// <summary>
        /// List all Spaces for the User
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/users/list_all_spaces_for_the_user.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllSpacesForUserResponse> > ListAllSpacesForUser(Guid?guid, RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = string.Format(CultureInfo.InvariantCulture, "/v2/users/{0}/spaces", guid);
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;

            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllSpacesForUserResponse>(await response.Content.ReadAsStringAsync(), this.Client));
        }
        /// <summary>
        /// Filtering the result set by label (deprecated)
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/serviceauthtokens__deprecated_/filtering_the_result_set_by_label_(deprecated).html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <FilterResultSetByLabelDeprecatedResponse> > FilterResultSetByLabelDeprecated(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/service_auth_tokens";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            client.Headers.Add(await BuildAuthenticationHeader());
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <FilterResultSetByLabelDeprecatedResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
        /// <summary>
        /// Return the Security Groups used for staging
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/security_group_staging_defaults/return_the_security_groups_used_for_staging.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ReturnSecurityGroupsUsedForStagingResponse> > ReturnSecurityGroupsUsedForStaging(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/config/staging_security_groups";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;

            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ReturnSecurityGroupsUsedForStagingResponse>(await response.Content.ReadAsStringAsync(), this.Client));
        }
 /// <summary>
 /// List all Organization Quota Definitions
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/organization_quota_definitions/list_all_organization_quota_definitions.html"</para>
 /// </summary>
 public async Task<PagedResponseCollection<ListAllOrganizationQuotaDefinitionsResponse>> ListAllOrganizationQuotaDefinitions(RequestOptions options)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = "/v2/quota_definitions";
     uriBuilder.Query = options.ToString();
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Get;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     var expectedReturnStatus = 200;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializePage<ListAllOrganizationQuotaDefinitionsResponse>(await response.ReadContentAsStringAsync(), this.Client);
 }
Пример #11
0
 /// <summary>
 /// List all Spaces for the Domain (deprecated)
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/domains__deprecated_/list_all_spaces_for_the_domain_(deprecated).html"</para>
 /// </summary>
 public async Task<PagedResponseCollection<ListAllSpacesForDomainDeprecatedResponse>> ListAllSpacesForDomainDeprecated(Guid? guid, RequestOptions options)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "/v2/domains/{0}/spaces", guid);
     uriBuilder.Query = options.ToString();
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Get;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     var expectedReturnStatus = 200;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializePage<ListAllSpacesForDomainDeprecatedResponse>(await response.ReadContentAsStringAsync(), this.Client);
 }
        /// <summary>
        /// List all Organization Quota Definitions
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/241/organization_quota_definitions/list_all_organization_quota_definitions.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAllOrganizationQuotaDefinitionsResponse> > ListAllOrganizationQuotaDefinitions(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/quota_definitions";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            var authHeader = await BuildAuthenticationHeader();

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                client.Headers.Add(authHeader);
            }
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAllOrganizationQuotaDefinitionsResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
Пример #13
0
        /// <summary>
        /// List associated processes
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/apps__experimental_/list_associated_processes.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ListAssociatedProcessesResponse> > ListAssociatedProcesses(Guid?guid, RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = string.Format(CultureInfo.InvariantCulture, "/v3/apps/{0}/processes", guid);
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            var authHeader = await BuildAuthenticationHeader();

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                client.Headers.Add(authHeader);
            }
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ListAssociatedProcessesResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
Пример #14
0
        /// <summary>
        /// Return the Security Groups used for running Apps
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/205/security_group_running_defaults/return_the_security_groups_used_for_running_apps.html"</para>
        /// </summary>
        public async Task <PagedResponseCollection <ReturnSecurityGroupsUsedForRunningAppsResponse> > ReturnSecurityGroupsUsedForRunningApps(RequestOptions options)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path  = "/v2/config/running_security_groups";
            uriBuilder.Query = options.ToString();
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Get;
            var authHeader = await BuildAuthenticationHeader();

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                client.Headers.Add(authHeader);
            }
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializePage <ReturnSecurityGroupsUsedForRunningAppsResponse>(await response.ReadContentAsStringAsync(), this.Client));
        }
Пример #15
0
        public void TestOptions()
        {
            RequestOptions options = new RequestOptions();

            options.Query.Add("names", new string[] { "name1", "name2" });
            options.Query.Add("space_guids", new string[] { "space_guid1", "space_guid2" });
            options.Query.Add("organization_guids", new string[] { "org_guid1", "org_guid2" });
            options.ResultsPerPage = 5;
            options.OrderDirection = "asc";
            options.Page           = 1;
            options.OrderBy        = "updated_at";

            string query = options.ToString();

            Assert.IsTrue(query.Contains("organization_guids[]=org_guid1&organization_guids[]=org_guid2"));
            Assert.IsTrue(query.Contains("space_guids[]=space_guid1&space_guids[]=space_guid2"));
            Assert.IsTrue(query.Contains("names[]=name1&names[]=name2"));
            Assert.IsTrue(query.Contains("per_page=5"));
            Assert.IsTrue(query.Contains("order_direction=asc"));
            Assert.IsTrue(query.Contains("order_by=updated_at"));
            Assert.IsTrue(query.Contains("page=1"));
        }
 /// <summary>
 /// Filtering the result set by label (deprecated)
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/serviceauthtokens__deprecated_/filtering_the_result_set_by_label_(deprecated).html"</para>
 /// </summary>
 public async Task<PagedResponseCollection<FilterResultSetByLabelDeprecatedResponse>> FilterResultSetByLabelDeprecated(RequestOptions options)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = "/v2/service_auth_tokens";
     uriBuilder.Query = options.ToString();
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Get;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     var expectedReturnStatus = 200;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializePage<FilterResultSetByLabelDeprecatedResponse>(await response.ReadContentAsStringAsync(), this.Client);
 }
 /// <summary>
 /// Return the Security Groups used for running Apps
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/security_group_running_defaults/return_the_security_groups_used_for_running_apps.html"</para>
 /// </summary>
 public async Task<PagedResponseCollection<ReturnSecurityGroupsUsedForRunningAppsResponse>> ReturnSecurityGroupsUsedForRunningApps(RequestOptions options)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = "/v2/config/running_security_groups";
     uriBuilder.Query = options.ToString();
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Get;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     var expectedReturnStatus = 200;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializePage<ReturnSecurityGroupsUsedForRunningAppsResponse>(await response.ReadContentAsStringAsync(), this.Client);
 }