use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class GrpcClusterDnsClient method signCertificate.
public String signCertificate(String accountId, String environment, byte[] csr, Optional<String> requestId, String resourceCrn) {
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
String requestIdValue = requestId.orElse(UUID.randomUUID().toString());
LOGGER.info("Fire a create certification request(resource crn: {}) with account id:{}, and requestId: {}", resourceCrn, accountId, requestIdValue);
Crn crn = Crn.fromString(resourceCrn);
String signingWorkflowId = client.signCertificate(requestIdValue, accountId, environment, csr, crn);
LOGGER.info("The workflow id for polling the result of creation: {}", signingWorkflowId);
return signingWorkflowId;
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class GrpcClusterDnsClient method createOrUpdateDnsEntryWithIp.
public CreateDnsEntryResponse createOrUpdateDnsEntryWithIp(String accountId, String endpoint, String environment, boolean wildcard, List<String> ips, Optional<String> requestId) {
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
LOGGER.info("Create a dns entry with account id: {} and requestId: {} for ips: {}", accountId, requestId, String.join(",", ips));
CreateDnsEntryResponse response = client.createDnsEntryWithIp(requestId.orElse(UUID.randomUUID().toString()), accountId, endpoint, environment, wildcard, ips);
LOGGER.info("Dns entry creation finished for ips {}", String.join(",", ips));
return response;
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class GrpcClusterDnsClient method deleteDnsEntryWithCloudDns.
public DeleteDnsEntryResponse deleteDnsEntryWithCloudDns(String accountId, String endpoint, String environment, String cloudDns, String hostedZoneId, Optional<String> requestId) {
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
LOGGER.info("Delete a dns entry with account id: {} and requestId: {} for cloud DNS: {}", accountId, requestId, client);
DeleteDnsEntryResponse response = client.deleteDnsEntryWithCloudDns(requestId.orElse(UUID.randomUUID().toString()), accountId, endpoint, environment, cloudDns, hostedZoneId);
LOGGER.info("Dns entry deletion finished for cloud DNS {}", cloudDns);
return response;
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class GrpcClusterDnsClient method generateManagedDomain.
public GenerateManagedDomainNamesResponse generateManagedDomain(String environmentName, List<String> subDomains, String accountId, Optional<String> requestId) {
String requestIdValue = requestId.orElse(UUID.randomUUID().toString());
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
LOGGER.info("Generating managed domain names for environment: '{}', subdomain: '{}', account id: '{}', requestId: '{}'", environmentName, String.join(",", subDomains), accountId, requestId);
GenerateManagedDomainNamesResponse response = client.generateManagedDomainNames(requestIdValue, environmentName, subDomains, accountId);
LOGGER.info("Domain names generation has been finished, returned values: '{}'", response.getDomainsMap());
return response;
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class GrpcClusterDnsClient method pollCertificateSigning.
public PollCertificateSigningResponse pollCertificateSigning(String signingWorkflowId, Optional<String> requestId) {
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
LOGGER.info("Get the result of certification creation with signingWorkflowId: {} and requestId: {}", signingWorkflowId, requestId);
PollCertificateSigningResponse response = client.pollCertificateSigning(requestId.orElse(UUID.randomUUID().toString()), signingWorkflowId);
LOGGER.info("The workflow id for polling the result of creation: {}", signingWorkflowId);
return response;
}
}
Aggregations