Esempio n. 1
0
        public void TestRemoveManagerWithSpaceByUsernameRequest()
        {
            string json = @"{
  ""username"": ""*****@*****.**""
}";

            RemoveManagerWithSpaceByUsernameRequest request = new RemoveManagerWithSpaceByUsernameRequest();

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

            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
Esempio n. 2
0
        /// <summary>
        /// Remove Manager with the Space by Username
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/241/spaces/remove_manager_with_the_space_by_username.html"</para>
        /// </summary>
        public async Task <RemoveManagerWithSpaceByUsernameResponse> RemoveManagerWithSpaceByUsername(Guid?guid, RemoveManagerWithSpaceByUsernameRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "v2/spaces/{0}/managers", 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 <RemoveManagerWithSpaceByUsernameResponse>(await response.ReadContentAsStringAsync()));
        }
        /// <summary>
        /// Remove Manager with the Space by Username
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/spaces/remove_manager_with_the_space_by_username.html"</para>
        /// </summary>
        public async Task <RemoveManagerWithSpaceByUsernameResponse> RemoveManagerWithSpaceByUsername(Guid?guid, RemoveManagerWithSpaceByUsernameRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "v2/spaces/{0}/managers", 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 <RemoveManagerWithSpaceByUsernameResponse>(await response.Content.ReadAsStringAsync()));
        }