private SubscribeResponse createSubscription()

in aws-sns-subscription/src/main/java/software/amazon/sns/subscription/CreateHandler.java [49:82]


    private SubscribeResponse createSubscription(
        final SubscribeRequest subscribeRequest,
        final ProxyClient<SnsClient> proxyClient,
        final ResourceModel model)  {

        final SubscribeResponse subscribeResponse;

        // exception thrown if topic not found
        retrieveTopicAttributes(Translator.translateToCheckTopicRequest(model), proxyClient);

        try {
            subscribeResponse = proxyClient.injectCredentialsAndInvokeV2(subscribeRequest, proxyClient.client()::subscribe);
            model.setSubscriptionArn(subscribeResponse.subscriptionArn());
        } catch (final SubscriptionLimitExceededException e) {
            throw new CfnServiceLimitExceededException(e);
        } catch (final FilterPolicyLimitExceededException e) {
            throw new CfnServiceLimitExceededException(e);
        } catch (final InvalidParameterException e) {
            throw new CfnInvalidRequestException(e);
        } catch (final InternalErrorException e) {
            throw new CfnInternalFailureException(e);
        } catch (final NotFoundException e) {
            throw new CfnNotFoundException(e);
        } catch (final AuthorizationErrorException e) {
            throw new CfnAccessDeniedException(e);
        } catch (final InvalidSecurityException e) {
            throw new CfnInvalidCredentialsException(e);
        }  catch (final Exception e) {
            throw new CfnInternalFailureException(e);
        }

        logger.log(String.format("%s successfully created.", ResourceModel.TYPE_NAME));
        return subscribeResponse;
    }