contract_test_exports.template.yaml [140:188]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  IDGenRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: "/"
      ManagedPolicyArns:
        - 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
  IDGenFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Timeout: 300
      Runtime: python3.7
      Handler: index.handler
      Role: !GetAtt IDGenRole.Arn
      Code:
        ZipFile: !Sub |
          import json
          import base64
          import cfnresponse
          import logging


          def handler(event, context):
              print(event)
              status = cfnresponse.SUCCESS
              physical_id = event.get('PhysicalResourceId')
              responseData = {}
              try:
                  if  (event['RequestType'] == 'Create' or event['RequestType'] == 'Update'):
                      id = {
                          "ClusterID": event['ResourceProperties']['ClusterID'],
                          "Region": event['ResourceProperties']['Region'],
                          "Name": event['ResourceProperties']['Name'],
                          "Namespace": event['ResourceProperties']['Namespace']
                      }

                      responseData['ID'] = base64.standard_b64encode(bytes(json.dumps(id), encoding='utf8')).decode("utf-8").rstrip("=")
                      print(responseData['ID'])
              except Exception:
                  logging.error('Unhandled exception', exc_info=True)
                  status = cfnresponse.FAILED
              finally:
                  cfnresponse.send(event, context, status, responseData, physicalResourceId=physical_id)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



exports.yaml [3:51]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  IDGenRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: "/"
      ManagedPolicyArns:
        - 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
  IDGenFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Timeout: 300
      Runtime: python3.7
      Handler: index.handler
      Role: !GetAtt IDGenRole.Arn
      Code:
        ZipFile: !Sub |
          import json
          import base64
          import cfnresponse
          import logging


          def handler(event, context):
              print(event)
              status = cfnresponse.SUCCESS
              physical_id = event.get('PhysicalResourceId')
              responseData = {}
              try:
                  if  (event['RequestType'] == 'Create' or event['RequestType'] == 'Update'):
                      id = {
                          "ClusterID": event['ResourceProperties']['ClusterID'],
                          "Region": event['ResourceProperties']['Region'],
                          "Name": event['ResourceProperties']['Name'],
                          "Namespace": event['ResourceProperties']['Namespace']
                      }

                      responseData['ID'] = base64.standard_b64encode(bytes(json.dumps(id), encoding='utf8')).decode("utf-8").rstrip("=")
                      print(responseData['ID'])
              except Exception:
                  logging.error('Unhandled exception', exc_info=True)
                  status = cfnresponse.FAILED
              finally:
                  cfnresponse.send(event, context, status, responseData, physicalResourceId=physical_id)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



