Search in sources :

Example 16 with ManagedChannelWrapper

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;
    }
}
Also used : ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper) Crn(com.sequenceiq.cloudbreak.auth.crn.Crn)

Example 17 with ManagedChannelWrapper

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;
    }
}
Also used : CreateDnsEntryResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.CreateDnsEntryResponse) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Example 18 with ManagedChannelWrapper

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;
    }
}
Also used : ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper) DeleteDnsEntryResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.DeleteDnsEntryResponse)

Example 19 with ManagedChannelWrapper

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;
    }
}
Also used : ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper) GenerateManagedDomainNamesResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.GenerateManagedDomainNamesResponse)

Example 20 with ManagedChannelWrapper

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;
    }
}
Also used : PollCertificateSigningResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Aggregations

ManagedChannelWrapper (com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)32 BackupDatalakeStatusRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeStatusRequest)6 RestoreDatalakeStatusRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeStatusRequest)6 AuditProto (com.cloudera.thunderhead.service.audit.AuditProto)4 ClusterConnectivityManagementV2BlockingStub (com.cloudera.thunderhead.service.clusterconnectivitymanagementv2.ClusterConnectivityManagementV2Grpc.ClusterConnectivityManagementV2BlockingStub)4 BackupDatalakeRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeRequest)4 RestoreDatalakeRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeRequest)4 ManagedChannelBuilder (io.grpc.ManagedChannelBuilder)4 com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc (com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc)3 com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc.datalakeDRBlockingStub (com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc.datalakeDRBlockingStub)3 DatalakeBackupInfo (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.DatalakeBackupInfo)3 ListDatalakeBackupRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.ListDatalakeBackupRequest)3 ListDatalakeBackupResponse (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.ListDatalakeBackupResponse)3 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)3 Strings (com.google.common.base.Strings)3 CcmException (com.sequenceiq.cloudbreak.ccm.exception.CcmException)3 DatalakeDrConfig (com.sequenceiq.cloudbreak.datalakedr.config.DatalakeDrConfig)3 GrpcStatusResponseToDatalakeBackupRestoreStatusResponseConverter (com.sequenceiq.cloudbreak.datalakedr.converter.GrpcStatusResponseToDatalakeBackupRestoreStatusResponseConverter)3 DatalakeBackupStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse)3 DatalakeRestoreStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse)3