public async Task <bool> Connect(string serviceId, string planId, string instanceId, CancellationToken cancellationToken) { await this.StateManager.SetStateAsync <string>("ServiceId", serviceId); await this.StateManager.SetStateAsync <string>("PlanId", planId); await this.StateManager.SetStateAsync <string>("InstanceId", instanceId); CreateServiceInstanceCommand command = new CreateServiceInstanceCommand(new Dictionary <string, string> { { "id", instanceId }, { "f", string.Format(@"{ ""service_id"": ""{0}"", ""plan_id"": ""{1}"", ""parameters"": { ""resourceGroup"": ""osb-test-group"", ""storageAccountName"": ""cat01"", ""location"": ""eastus"", ""accountType"": ""Standard_LRS"" } }", serviceId, planId) } }, new ServiceInstanceSchemaChecker("http://localhost:8088")); command.InjectSwitch("CatalogServiceEndpoint", "http://localhost:8088"); var conclusion = command.Run(); return(conclusion is SuccessConclusion); }
public void CreateServiceInstanceNoID() { CreateServiceInstanceCommand command = new CreateServiceInstanceCommand(new Dictionary <string, string> { { "f", @"TestFiles\fakeservice.json" } }, new ServiceInstanceSchemaChecker("http://localhost:8088")); command.InjectSwitch("CatalogServiceEndpoint", "http://localhost:8088"); var conclusion = command.Run(); Assert.IsInstanceOfType(conclusion, typeof(HelpConclusion)); }
public async Task <bool> Connect(string serviceId, string planId, string instanceId, string parameters, CancellationToken cancellationToken) { var state = await this.StateManager.TryGetStateAsync <MyState>(instanceId, cancellationToken); if (state.HasValue) { return(true); } else { string address = await resolveCatalogServiceAddress(); CreateServiceInstanceCommand command = new CreateServiceInstanceCommand(new Dictionary <string, string> { { "id", instanceId }, { "f", parameters } }, new ServiceInstanceSchemaChecker(address)); command.InjectSwitch("CatalogServiceEndpoint", address); var conclusion = command.Run(); if (conclusion is SuccessConclusion) { await this.StateManager.SetStateAsync <MyState>(instanceId, new MyState { ServiceId = serviceId, PlanId = planId, InstanceId = instanceId, BindingId = "", Credential = null }, cancellationToken); return(true); } else { return(false); } } }