<commit_before>AWSTemplateFormatVersion: '2010-09-09'
Description: crassus (Cross Account Smart Software Update Service)
Outputs:
  inputSnsTopicARN:
    Description: Topic ARN to send stack update messages to.
    Value:
      Ref: inputSnsTopic
  outputSqsQueue:
    Description: SQS queue URL for receiving messages from crassus & CFN.
    Value:
      Ref: outputSqsQueue
  lambdaFunctionName:
    Description: Name of the crassus Lambda function, to be used in separate API call to allow
      subscription to input SNS topic.
    Value:
      Ref: updateStackFunction
  cfnOutputConverterFunctionName:
    Description: The part of Crassus with converts received cloudformation messages to Gaius format.
    Value:
      Ref: cfnOutputConverterFunction
Parameters:
  bucketName:
    Default: is24-crassus
    Description: crassus distrubtion bucket that contains the Lambda function zip file
    Type: String
  zipFile:
    Description: Name of the crassus distribution zip file inside the bucket
    Type: String
    Default: crassus-latest.zip
  triggeringUserArn:
    AllowedPattern: arn:aws:iam::[0-9]{12}:[\S]+
    ConstraintDescription: must be a valid Amazon Resource Name e.g. arn:aws:iam::123456789012:role/cld-chain
    Description: ARN of the principal that is allowed to send stack update messages and listen for results
    Type: String
Resources:
  inputSnsTopic:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: Topic ARN to send stack update messages to
      Subscription:
      - Endpoint:
          Fn::GetAtt:
          - updateStackFunction
          - Arn
        Protocol: lambda
      TopicName:
        '|join|-':
          - Ref: AWS::StackName
          - snsinput
  inputSnsTopicPolicy:
    Type: AWS::SNS::TopicPolicy
    Properties:
      PolicyDocument:
        Statement:
        - Action: sns:Publish
          Effect: Allow
          Principal:
            AWS:
              Ref: triggeringUserArn
          Resource:
            Ref: inputSnsTopic
        Version: '2012-10-17'
      Topics:
      - Ref: inputSnsTopic
  outputSqsQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName:
        '|join|-':
          - Ref: AWS::StackName
          - output
  stackUpdateRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
        - Action: sts:AssumeRole
          Effect: Allow
          Principal:
            Service: lambda.amazonaws.com
          Sid: ''
        Version: '2012-10-17'
      Policies:
      - PolicyDocument:
          Statement:
          - Action:
            - '*'
            Effect: Allow
            Resource:
            - '*'
          Version: '2012-10-17'
        PolicyName: lambdaStackUpdatePolicy
  updateStackFunction:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket:
          Ref: bucketName
        S3Key:
          Ref: zipFile
      Description:
        Fn::Join:
          - ""
          -
            - '{'
            - '"result_queue":["'
            - Ref: outputSqsQueue
            - '"],"cfn_events":["'
            - Ref: cfnOutputSnsTopic
            - '"]}'
      Handler: crassus_deployer_lambda.handler<commit_msg>help idea with syntax highlighting<commit_after>AWSTemplateFormatVersion: '2010-09-09'
Description: crassus (Cross Account Smart Software Update Service)
Outputs:
  inputSnsTopicARN:
    Description: Topic ARN to send stack update messages to.
    Value:
      Ref: inputSnsTopic
  outputSqsQueue:
    Description: SQS queue URL for receiving messages from crassus & CFN.
    Value:
      Ref: outputSqsQueue
  lambdaFunctionName:
    Description: Name of the crassus Lambda function, to be used in separate API call to allow
      subscription to input SNS topic.
    Value:
      Ref: updateStackFunction
  cfnOutputConverterFunctionName:
    Description: The part of Crassus with converts received cloudformation messages to Gaius format.
    Value:
      Ref: cfnOutputConverterFunction
Parameters:
  bucketName:
    Default: is24-crassus
    Description: crassus distrubtion bucket that contains the Lambda function zip file
    Type: String
  zipFile:
    Description: Name of the crassus distribution zip file inside the bucket
    Type: String
    Default: crassus-latest.zip
  triggeringUserArn:
    AllowedPattern: 'arn:aws:iam::[0-9]{12}:[\S]+'
    ConstraintDescription: must be a valid Amazon Resource Name e.g. arn:aws:iam::123456789012:role/cld-chain
    Description: ARN of the principal that is allowed to send stack update messages and listen for results
    Type: String
Resources:
  inputSnsTopic:
    Type: AWS::SNS::Topic
    Properties:
      DisplayName: Topic ARN to send stack update messages to
      Subscription:
      - Endpoint:
          Fn::GetAtt:
          - updateStackFunction
          - Arn
        Protocol: lambda
      TopicName:
        '|join|-':
          - Ref: AWS::StackName
          - snsinput
  inputSnsTopicPolicy:
    Type: AWS::SNS::TopicPolicy
    Properties:
      PolicyDocument:
        Statement:
        - Action: sns:Publish
          Effect: Allow
          Principal:
            AWS:
              Ref: triggeringUserArn
          Resource:
            Ref: inputSnsTopic
        Version: '2012-10-17'
      Topics:
      - Ref: inputSnsTopic
  outputSqsQueue:
    Type: AWS::SQS::Queue
    Properties:
      QueueName:
        '|join|-':
          - Ref: AWS::StackName
          - output
  stackUpdateRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
        - Action: sts:AssumeRole
          Effect: Allow
          Principal:
            Service: lambda.amazonaws.com
        Version: '2012-10-17'
      Policies:
      - PolicyDocument:
          Statement:
          - Action:
            - '*'
            Effect: Allow
            Resource:
            - '*'
          Version: '2012-10-17'
        PolicyName: lambdaStackUpdatePolicy
  updateStackFunction:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        S3Bucket:
          Ref: bucketName
        S3Key:
          Ref: zipFile
      Description:
        Fn::Join:
          - ""
          -
            - '{'
            - '"result_queue":["'
            - Ref: outputSqsQueue
            - '"],"cfn_events":["'
            - Ref: cfnOutputSnsTopic
            - '"]}'
      Handler: crassus_deployer_lambda.handler
{'fraction_non_alphanumeric': 0.07812256354280368, 'fraction_numerical': 0.016217059098705754, 'mean_word_length': 2.0645007166746296, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '798576', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1771, 'n_words': 502}