private async Task And_a_single_service_account() { using var client = LocalhostRestClient.Create(); _serviceAccountCreateCommand = ServiceAccountCreateCommandFactory.CreateForIntegrationTest(); await client.ServiceAccounts.CreateAsync(_serviceAccountCreateCommand); }
private async Task And_a_single_apiKey() { using var client = LocalhostRestClient.Create(); _serviceAccountCreateCommand = ServiceAccountCreateCommandFactory.CreateForIntegrationTest(); _serviceAccount = await client.ServiceAccounts.CreateAsync(_serviceAccountCreateCommand); _apiKeyCreate = new ApiKeyCreate() { ServiceAccountId = _serviceAccount.Id, Description = "GetAllScenario" }; _apiKey = await client.ApiKeys.CreateAsync(_apiKeyCreate); }
private async Task And_a_single_acl() { using var client = LocalhostRestClient.Create(); _serviceAccountCreateCommand = ServiceAccountCreateCommandFactory.CreateForIntegrationTest(); _serviceAccount = await client.ServiceAccounts.CreateAsync(_serviceAccountCreateCommand); _aclCreateDelete = new AclCreateDelete { ServiceAccountId = Convert.ToInt64(_serviceAccount.Id), Allow = true, Operation = "WRITE", TopicPrefix = "itsAThing" }; await client.Acls.CreateAsync(_aclCreateDelete); }
public async Task <ServiceAccount> CreateAsync(ServiceAccountCreateCommand serviceAccountCreateCommand) { var payload = JsonConvert.SerializeObject(serviceAccountCreateCommand); var content = new StringContent( payload, Encoding.UTF8, "application/json" ); var response = await _httpClient.PostAsync( new Uri(SERVICE_ACCOUNTS_ROUTE, UriKind.Relative), content ); var serviceAccount = await Utilities.Parse <ServiceAccount>(response); return(serviceAccount); }
public async Task <ServiceAccount> CreateAsync(ServiceAccountCreateCommand serviceAccountCreateCommand, string clusterId = null) { var payload = JsonConvert.SerializeObject(serviceAccountCreateCommand); var content = new StringContent( payload, Encoding.UTF8, "application/json" ); var response = await _httpClient.PostAsync( new Uri(Utilities.MakeUrl(_clientOptions, SERVICE_ACCOUNTS_ROUTE, clusterId), UriKind.Absolute), content ); var serviceAccount = await Utilities.Parse <ServiceAccount>(response); return(serviceAccount); }