private async Task Then_a_service_account_is_created(Capability capability)
 {
     serviceAccount = await _tikaClient.ServiceAccounts.CreateAsync(new ServiceAccountCreateCommand
     {
         name        = $"{capability.Name}",
         description = "Creating with TikaService using KafkaJanitor"
     });
 }
 private async Task And_api_keypair_is_created(Capability capability, ServiceAccount serviceAccount)
 {
     apiKey = await _tikaClient.ApiKeys.CreateAsync(new ApiKeyCreate
     {
         Description      = "Creating during CapabilityCreatedDeletedScenario",
         ServiceAccountId = serviceAccount.Id
     });
 }
        private async Task And_acls_to_create_read_write_to_topics_under_prefix(Capability capability, ServiceAccount serviceAccount)
        {
            var serviceAccountId = Convert.ToInt64(serviceAccount.Id);
            // Topic
            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "WRITE", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "CREATE", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "READ", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "DESCRIBE", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "DESCRIBE-CONFIGS", capability.Name));

            // ConsumerGroup
            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "WRITE", "", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "CREATE", "", capability.Name));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, true, "READ", "", capability.Name));

            // DENY
            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, false, "alter"));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, false, "alter-configs"));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, false, "cluster-action"));

            await _tikaClient.Acls.CreateAsync(new AclCreateDelete(serviceAccountId, false, "create", "'*'"));
        }
 private async Task And_the_connected_service_account_is_removed(ServiceAccount serviceAccount)
 {
     await _tikaClient.ServiceAccounts.DeleteAsync(serviceAccount.Id);
 }
        private async Task Then_the_connected_acls_are_deleted(Capability capability, ServiceAccount serviceAccount)
        {
            var serviceAccountId = Convert.ToInt64(serviceAccount.Id);

            // Deletion of ACL seems to be flawed if one is using Tika in notconnected mode(e.g. not calling the actual Confluent Cloud API).

            // Topic
            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "WRITE", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "CREATE", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "READ", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "DESCRIBE", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "DESCRIBE-CONFIGS", capability.Name));

            // ConsumerGroup
            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "WRITE", "", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "CREATE", "", capability.Name));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, true, "READ", "", capability.Name));

            // DENY
            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, false, "alter"));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, false, "alter-configs"));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, false, "cluster-action"));

            await _tikaClient.Acls.DeleteAsync(new AclCreateDelete(serviceAccountId, false, "create", "'*'"));
        }