Пример #1
0
        public void TestRemoveAuditorWithSpaceByUsernameRequest()
        {
            string json = @"{
  ""username"": ""*****@*****.**""
}";

            RemoveAuditorWithSpaceByUsernameRequest request = new RemoveAuditorWithSpaceByUsernameRequest();

            request.Username = "******";
            string result = JsonConvert.SerializeObject(request, Formatting.None);

            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
Пример #2
0
        /// <summary>
        /// Remove Auditor with the Space by Username
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/241/spaces/remove_auditor_with_the_space_by_username.html"</para>
        /// </summary>
        public async Task <RemoveAuditorWithSpaceByUsernameResponse> RemoveAuditorWithSpaceByUsername(Guid?guid, RemoveAuditorWithSpaceByUsernameRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

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

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

            if (!string.IsNullOrWhiteSpace(authHeader.Key))
            {
                client.Headers.Add(authHeader);
            }
            client.ContentType = "application/x-www-form-urlencoded";
            client.Content     = ((string)JsonConvert.SerializeObject(value)).ConvertToStream();
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializeJson <RemoveAuditorWithSpaceByUsernameResponse>(await response.ReadContentAsStringAsync()));
        }
Пример #3
0
        /// <summary>
        /// Remove Auditor with the Space by Username
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/spaces/remove_auditor_with_the_space_by_username.html"</para>
        /// </summary>
        public async Task <RemoveAuditorWithSpaceByUsernameResponse> RemoveAuditorWithSpaceByUsername(Guid?guid, RemoveAuditorWithSpaceByUsernameRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

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

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


            client.Content = ((string)JsonConvert.SerializeObject(value)).ConvertToStream();
            var expectedReturnStatus = 200;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializeJson <RemoveAuditorWithSpaceByUsernameResponse>(await response.Content.ReadAsStringAsync()));
        }