コード例 #1
0
        private async Task And_a_single_service_account()
        {
            using var client             = LocalhostRestClient.Create();
            _serviceAccountCreateCommand = ServiceAccountCreateCommandFactory.CreateForIntegrationTest();

            await client.ServiceAccounts.CreateAsync(_serviceAccountCreateCommand);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: ServiceAccountsClient.cs プロジェクト: dfds/tika
        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);
        }