/// <summary>
        /// Updating a Service (deprecated)
        /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/services/updating_a_service_(deprecated).html"</para>
        /// </summary>
        public async Task <UpdateServiceDeprecatedResponse> UpdateServiceDeprecated(UpdateServiceDeprecatedRequest value)
        {
            UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);

            uriBuilder.Path = "/v2/services";
            var client = this.GetHttpClient();

            client.Uri    = uriBuilder.Uri;
            client.Method = HttpMethod.Put;
            client.Headers.Add(await BuildAuthenticationHeader());
            client.ContentType = "application/x-www-form-urlencoded";
            client.Content     = JsonConvert.SerializeObject(value).ConvertToStream();
            var expectedReturnStatus = 201;
            var response             = await this.SendAsync(client, expectedReturnStatus);

            return(Utilities.DeserializeJson <UpdateServiceDeprecatedResponse>(await response.ReadContentAsStringAsync()));
        }
        public void TestUpdateServiceDeprecatedRequest()
        {
            string json = @"{
  ""label"": ""SomeMysqlService"",
  ""description"": ""Mysql stores things for you"",
  ""provider"": ""MySql Provider"",
  ""version"": ""2.0"",
  ""url"": ""http://myql.provider.com""
}";

            UpdateServiceDeprecatedRequest request = new UpdateServiceDeprecatedRequest();

            request.Label = "SomeMysqlService";
            request.Description = "Mysql stores things for you";
            request.Provider = "MySql Provider";
            request.Version = "2.0";
            request.Url = "http://myql.provider.com";
            string result = JsonConvert.SerializeObject(request, Formatting.None);
            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
Example #3
0
        public void TestUpdateServiceDeprecatedRequest()
        {
            string json = @"{
  ""label"": ""SomeMysqlService"",
  ""description"": ""Mysql stores things for you"",
  ""provider"": ""MySql Provider"",
  ""version"": ""2.0"",
  ""url"": ""http://myql.provider.com""
}";

            UpdateServiceDeprecatedRequest request = new UpdateServiceDeprecatedRequest();

            request.Label       = "SomeMysqlService";
            request.Description = "Mysql stores things for you";
            request.Provider    = "MySql Provider";
            request.Version     = "2.0";
            request.Url         = "http://myql.provider.com";
            string result = JsonConvert.SerializeObject(request, Formatting.None);

            Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result);
        }
Example #4
0
        public void UpdateServiceDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""7c4a071d-3b2b-431d-93ca-a8decef2aac1"",
    ""url"": ""/v2/services/7c4a071d-3b2b-431d-93ca-a8decef2aac1"",
    ""created_at"": ""2016-02-09T10:21:54Z"",
    ""updated_at"": ""2016-02-09T10:21:54Z""
  },
  ""entity"": {
    ""label"": ""SomeMysqlService"",
    ""provider"": ""MySql Provider"",
    ""url"": ""http://myql.provider.com"",
    ""description"": ""Mysql stores things for you"",
    ""long_description"": null,
    ""version"": ""2.0"",
    ""info_url"": null,
    ""active"": true,
    ""bindable"": true,
    ""unique_id"": ""3eed8156-8432-4a1c-a4ca-afc5e15f589f"",
    ""extra"": null,
    ""tags"": [

    ],
    ""requires"": [

    ],
    ""documentation_url"": null,
    ""service_broker_guid"": ""e7a84f57-cd1f-4938-87b6-c385000927ee"",
    ""plan_updateable"": false,
    ""service_plans_url"": ""/v2/services/7c4a071d-3b2b-431d-93ca-a8decef2aac1/service_plans""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                UpdateServiceDeprecatedRequest value = new UpdateServiceDeprecatedRequest();


                var obj = cfClient.Services.UpdateServiceDeprecated(value).Result;


                Assert.AreEqual("7c4a071d-3b2b-431d-93ca-a8decef2aac1", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/services/7c4a071d-3b2b-431d-93ca-a8decef2aac1", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:54Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2016-02-09T10:21:54Z", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("SomeMysqlService", TestUtil.ToTestableString(obj.Label), true);
                Assert.AreEqual("MySql Provider", TestUtil.ToTestableString(obj.Provider), true);
                Assert.AreEqual("http://myql.provider.com", TestUtil.ToTestableString(obj.Url), true);
                Assert.AreEqual("Mysql stores things for you", TestUtil.ToTestableString(obj.Description), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.LongDescription), true);
                Assert.AreEqual("2.0", TestUtil.ToTestableString(obj.Version), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.InfoUrl), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Active), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Bindable), true);
                Assert.AreEqual("3eed8156-8432-4a1c-a4ca-afc5e15f589f", TestUtil.ToTestableString(obj.UniqueId), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.Extra), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.DocumentationUrl), true);
                Assert.AreEqual("e7a84f57-cd1f-4938-87b6-c385000927ee", TestUtil.ToTestableString(obj.ServiceBrokerGuid), true);
                Assert.AreEqual("false", TestUtil.ToTestableString(obj.PlanUpdateable), true);
                Assert.AreEqual("/v2/services/7c4a071d-3b2b-431d-93ca-a8decef2aac1/service_plans", TestUtil.ToTestableString(obj.ServicePlansUrl), true);
            }
        }
Example #5
0
 /// <summary>
 /// Updating a Service (deprecated)
 /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/services/updating_a_service_(deprecated).html"</para>
 /// </summary>
 public async Task<UpdateServiceDeprecatedResponse> UpdateServiceDeprecated(UpdateServiceDeprecatedRequest value)
 {
     UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget);
     uriBuilder.Path = "/v2/services";
     var client = this.GetHttpClient();
     client.Uri = uriBuilder.Uri;
     client.Method = HttpMethod.Put;
     var authHeader = await BuildAuthenticationHeader();
     if (!string.IsNullOrWhiteSpace(authHeader.Key))
     {
         client.Headers.Add(authHeader);
     }
     client.ContentType = "application/x-www-form-urlencoded";
     client.Content = JsonConvert.SerializeObject(value).ConvertToStream();
     var expectedReturnStatus = 201;
     var response = await this.SendAsync(client, expectedReturnStatus);
     return Utilities.DeserializeJson<UpdateServiceDeprecatedResponse>(await response.ReadContentAsStringAsync());
 }
Example #6
0
        public void UpdateServiceDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""a6abf8b5-db40-4b5a-b1bc-25739e7c08bb"",
    ""url"": ""/v2/services/a6abf8b5-db40-4b5a-b1bc-25739e7c08bb"",
    ""created_at"": ""2015-04-16T12:04:16+00:00"",
    ""updated_at"": ""2015-04-16T12:04:16+00:00""
  },
  ""entity"": {
    ""label"": ""SomeMysqlService"",
    ""provider"": ""MySql Provider"",
    ""url"": ""http://myql.provider.com"",
    ""description"": ""Mysql stores things for you"",
    ""long_description"": null,
    ""version"": ""2.0"",
    ""info_url"": null,
    ""active"": true,
    ""bindable"": true,
    ""unique_id"": ""2c59b749-0763-494c-b0aa-c5749040be2d"",
    ""extra"": null,
    ""tags"": [

    ],
    ""requires"": [

    ],
    ""documentation_url"": null,
    ""service_broker_guid"": ""d9dc5ee3-f209-4e1b-bb50-edf7229e2479"",
    ""plan_updateable"": false,
    ""service_plans_url"": ""/v2/services/a6abf8b5-db40-4b5a-b1bc-25739e7c08bb/service_plans""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                UpdateServiceDeprecatedRequest value = new UpdateServiceDeprecatedRequest();


                var obj = cfClient.Services.UpdateServiceDeprecated(value).Result;


                Assert.AreEqual("a6abf8b5-db40-4b5a-b1bc-25739e7c08bb", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/services/a6abf8b5-db40-4b5a-b1bc-25739e7c08bb", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:16+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-04-16T12:04:16+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("SomeMysqlService", TestUtil.ToTestableString(obj.Label), true);
                Assert.AreEqual("MySql Provider", TestUtil.ToTestableString(obj.Provider), true);
                Assert.AreEqual("http://myql.provider.com", TestUtil.ToTestableString(obj.Url), true);
                Assert.AreEqual("Mysql stores things for you", TestUtil.ToTestableString(obj.Description), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.LongDescription), true);
                Assert.AreEqual("2.0", TestUtil.ToTestableString(obj.Version), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.InfoUrl), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Active), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Bindable), true);
                Assert.AreEqual("2c59b749-0763-494c-b0aa-c5749040be2d", TestUtil.ToTestableString(obj.UniqueId), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.Extra), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.DocumentationUrl), true);
                Assert.AreEqual("d9dc5ee3-f209-4e1b-bb50-edf7229e2479", TestUtil.ToTestableString(obj.ServiceBrokerGuid), true);
                Assert.AreEqual("false", TestUtil.ToTestableString(obj.PlanUpdateable), true);
                Assert.AreEqual("/v2/services/a6abf8b5-db40-4b5a-b1bc-25739e7c08bb/service_plans", TestUtil.ToTestableString(obj.ServicePlansUrl), true);
            }
        }
        public void UpdateServiceDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""48a724ff-5d4b-435a-87ef-a31dd9a764d2"",
    ""url"": ""/v2/services/48a724ff-5d4b-435a-87ef-a31dd9a764d2"",
    ""created_at"": ""2015-05-19T15:27:19+00:00"",
    ""updated_at"": ""2015-05-19T15:27:19+00:00""
  },
  ""entity"": {
    ""label"": ""SomeMysqlService"",
    ""provider"": ""MySql Provider"",
    ""url"": ""http://myql.provider.com"",
    ""description"": ""Mysql stores things for you"",
    ""long_description"": null,
    ""version"": ""2.0"",
    ""info_url"": null,
    ""active"": true,
    ""bindable"": true,
    ""unique_id"": ""faaeb3ea-4995-415f-9a36-bef876039b2c"",
    ""extra"": null,
    ""tags"": [

    ],
    ""requires"": [

    ],
    ""documentation_url"": null,
    ""service_broker_guid"": ""92b7462e-d54d-450a-94bc-b6c4db395f3f"",
    ""plan_updateable"": false,
    ""service_plans_url"": ""/v2/services/48a724ff-5d4b-435a-87ef-a31dd9a764d2/service_plans""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                UpdateServiceDeprecatedRequest value = new UpdateServiceDeprecatedRequest();


                var obj = cfClient.Services.UpdateServiceDeprecated(value).Result;


                Assert.AreEqual("48a724ff-5d4b-435a-87ef-a31dd9a764d2", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/services/48a724ff-5d4b-435a-87ef-a31dd9a764d2", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:19+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-05-19T15:27:19+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("SomeMysqlService", TestUtil.ToTestableString(obj.Label), true);
                Assert.AreEqual("MySql Provider", TestUtil.ToTestableString(obj.Provider), true);
                Assert.AreEqual("http://myql.provider.com", TestUtil.ToTestableString(obj.Url), true);
                Assert.AreEqual("Mysql stores things for you", TestUtil.ToTestableString(obj.Description), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.LongDescription), true);
                Assert.AreEqual("2.0", TestUtil.ToTestableString(obj.Version), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.InfoUrl), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Active), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Bindable), true);
                Assert.AreEqual("faaeb3ea-4995-415f-9a36-bef876039b2c", TestUtil.ToTestableString(obj.UniqueId), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.Extra), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.DocumentationUrl), true);
                Assert.AreEqual("92b7462e-d54d-450a-94bc-b6c4db395f3f", TestUtil.ToTestableString(obj.ServiceBrokerGuid), true);
                Assert.AreEqual("false", TestUtil.ToTestableString(obj.PlanUpdateable), true);
                Assert.AreEqual("/v2/services/48a724ff-5d4b-435a-87ef-a31dd9a764d2/service_plans", TestUtil.ToTestableString(obj.ServicePlansUrl), true);

            }
        }