Package com.sequenceiq.cloudbreak.domain

Examples of com.sequenceiq.cloudbreak.domain.SnsTopic


        LOGGER.info("Amazon SNS client successfully created.");

        CreateTopicResult createTopicResult = amazonSNSClient.createTopic(CB_TOPIC_NAME);
        LOGGER.info("Amazon SNS topic successfully created. [topic ARN: '{}']", createTopicResult.getTopicArn());

        SnsTopic snsTopic = new SnsTopic();
        snsTopic.setName(CB_TOPIC_NAME);
        snsTopic.setRegion(region);
        snsTopic.setCredential(awsCredential);
        snsTopic.setTopicArn(createTopicResult.getTopicArn());
        snsTopic.setConfirmed(false);
        snsTopicRepository.save(snsTopic);

        subscribeToTopic(amazonSNSClient, createTopicResult.getTopicArn());
    }
View Full Code Here


    public void setupProvisioning(Stack stack) {
        MDCBuilder.buildMdcContext(stack);
        AwsTemplate awsTemplate = (AwsTemplate) stack.getTemplate();
        AwsCredential awsCredential = (AwsCredential) stack.getCredential();

        SnsTopic snsTopic = snsTopicRepository.findOneForCredentialInRegion(awsCredential.getId(), awsTemplate.getRegion());
        if (snsTopic == null) {
            LOGGER.info("There is no SNS topic created for credential '{}' in region {}. Creating topic now.", awsCredential.getId(),
                    awsTemplate.getRegion().name());
            snsTopicManager.createTopicAndSubscribe(awsCredential, awsTemplate.getRegion());
        } else if (!snsTopic.isConfirmed()) {
            LOGGER.info(
                    "SNS topic found for credential '{}' in region {}, but the subscription is not confirmed. Trying to subscribe again [arn: {}, id: {}]",
                    awsCredential.getId(), awsTemplate.getRegion().name(), snsTopic.getTopicArn(), snsTopic.getId());
            snsTopicManager.subscribeToTopic(awsCredential, awsTemplate.getRegion(), snsTopic.getTopicArn());
        } else {
            LOGGER.info("SNS topic found for credential '{}' in region {}. [arn: {}, id: {}]", awsCredential.getId(), awsTemplate.getRegion().name(),
                    snsTopic.getTopicArn(), snsTopic.getId());
            LOGGER.info("Publishing {} event [StackId: '{}']", ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT, stack.getId());
            reactor.notify(ReactorConfig.PROVISION_SETUP_COMPLETE_EVENT, Event.wrap(new ProvisionSetupComplete(getCloudPlatform(), stack.getId())
                    .withSetupProperties(getSetupProperties(stack))
                    .withUserDataParams(getUserDataProperties(stack))
                )
View Full Code Here

    public Map<String, Object> getSetupProperties(Stack stack) {
        AwsTemplate awsTemplate = (AwsTemplate) stack.getTemplate();
        AwsCredential awsCredential = (AwsCredential) stack.getCredential();

        SnsTopic snsTopic = snsTopicRepository.findOneForCredentialInRegion(awsCredential.getId(), awsTemplate.getRegion());
        Map<String, Object> properties = new HashMap<>();
        properties.put(SnsTopicManager.NOTIFICATION_TOPIC_ARN_KEY, snsTopic.getTopicArn());

        return properties;
    }
View Full Code Here

        event.setEventTimestamp(eventTimestamp);
        return event;
    }

    public static SnsTopic createSnsTopic(Credential credential) {
        SnsTopic snsTopic = new SnsTopic();
        snsTopic.setId(ConnectorTestUtil.DEFAULT_ID);
        snsTopic.setCredential((AwsCredential) credential);
        snsTopic.setTopicArn(ConnectorTestUtil.DEFAULT_TOPIC_ARN);
        snsTopic.setRegion(Regions.DEFAULT_REGION);
        return snsTopic;
    }
View Full Code Here

        assertEquals(result.getRegion(), snsTopic.getRegion());
        assertEquals(result.getTopicArn(), snsTopic.getTopicArn());
    }

    private SnsTopic createSnsTopic() {
        SnsTopic snsTopic = new SnsTopic();
        snsTopic.setConfirmed(true);
        snsTopic.setCredential(new AwsCredential());
        snsTopic.setId(1L);
        snsTopic.setRegion(Regions.DEFAULT_REGION);
        snsTopic.setTopicArn(DUMMY_TOPIC_ARN);
        return snsTopic;
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.domain.SnsTopic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.