apply/deploy.template.yaml [95:159]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                Resource: "*"
  RegisterTypeFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Timeout: 900
      Runtime: python3.7
      Handler: index.handler
      Role: !GetAtt RegisterTypeRole.Arn
      Code:
        ZipFile: !Sub |
          import cfnresponse
          import logging
          import boto3
          from time import sleep

          def stabilize(token, cfn):
              p = cfn.describe_type_registration(RegistrationToken=token)
              while p['ProgressStatus'] == "IN_PROGRESS":
                  sleep(5)
                  p = cfn.describe_type_registration(RegistrationToken=token)
              if p['ProgressStatus'] == 'FAILED':
                  logging.error(p)
                  return cfnresponse.FAILED, p['TypeVersionArn']
              return cfnresponse.SUCCESS, p['TypeVersionArn']

          def register(cfn):
              response = cfn.register_type(
                  Type='RESOURCE',
                  TypeName='AWSQS::Kubernetes::Helm',
                  SchemaHandlerPackage="s3://aws-quickstart/quickstart-helm-resource-provider/awsqs-kubernetes-helm.zip",
                  LoggingConfig={"LogRoleArn": "${LogDeliveryRole.Arn}", "LogGroupName": "awsqs-kubernetes-helm-logs"},
                  ExecutionRoleArn="${ExecutionRole.Arn}"
              )
              status, version_arn = stabilize(response['RegistrationToken'], cfn)
              cfn.set_type_default_version(Arn=version_arn)
              return status, version_arn

          def handler(event, context):
              print(event)
              status = cfnresponse.SUCCESS
              physical_id = event.get('PhysicalResourceId')
              try:
                  cfn = boto3.client('cloudformation')
                  if event['RequestType'] == 'Create':
                      status, physical_id = register(cfn)
                  if event['RequestType'] == 'Update':
                      status, physical_id = register(cfn)
                  if event['RequestType'] == 'Delete':
                      versions = cfn.list_type_versions(Type='RESOURCE', TypeName='AWSQS::Kubernetes::Helm')['TypeVersionSummaries']
                      if len(versions) > 1:
                          cfn.deregister_type(Arn=physical_id)
                      else:
                          cfn.deregister_type(Type='RESOURCE', TypeName='AWSQS::Kubernetes::Helm')
              except Exception:
                  logging.error('Unhandled exception', exc_info=True)
                  status = cfnresponse.FAILED
              finally:
                  cfnresponse.send(event, context, status, {}, physicalResourceId=physical_id)
  RegisterType:
      Type: "AWS::CloudFormation::CustomResource"
      Properties:
        ServiceToken: !GetAtt RegisterTypeFunction.Arn
Outputs:
  ExecutionRoleArn:
    Value: !GetAtt ExecutionRole.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



get/deploy.template.yaml [94:158]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                Resource: "*"
  RegisterTypeFunction:
    Type: "AWS::Lambda::Function"
    Properties:
      Timeout: 900
      Runtime: python3.7
      Handler: index.handler
      Role: !GetAtt RegisterTypeRole.Arn
      Code:
        ZipFile: !Sub |
          import cfnresponse
          import logging
          import boto3
          from time import sleep

          def stabilize(token, cfn):
              p = cfn.describe_type_registration(RegistrationToken=token)
              while p['ProgressStatus'] == "IN_PROGRESS":
                  sleep(5)
                  p = cfn.describe_type_registration(RegistrationToken=token)
              if p['ProgressStatus'] == 'FAILED':
                  logging.error(p)
                  return cfnresponse.FAILED, p['TypeVersionArn']
              return cfnresponse.SUCCESS, p['TypeVersionArn']

          def register(cfn):
              response = cfn.register_type(
                  Type='RESOURCE',
                  TypeName='AWSQS::Kubernetes::Helm',
                  SchemaHandlerPackage="s3://aws-quickstart/quickstart-helm-resource-provider/awsqs-kubernetes-helm.zip",
                  LoggingConfig={"LogRoleArn": "${LogDeliveryRole.Arn}", "LogGroupName": "awsqs-kubernetes-helm-logs"},
                  ExecutionRoleArn="${ExecutionRole.Arn}"
              )
              status, version_arn = stabilize(response['RegistrationToken'], cfn)
              cfn.set_type_default_version(Arn=version_arn)
              return status, version_arn

          def handler(event, context):
              print(event)
              status = cfnresponse.SUCCESS
              physical_id = event.get('PhysicalResourceId')
              try:
                  cfn = boto3.client('cloudformation')
                  if event['RequestType'] == 'Create':
                      status, physical_id = register(cfn)
                  if event['RequestType'] == 'Update':
                      status, physical_id = register(cfn)
                  if event['RequestType'] == 'Delete':
                      versions = cfn.list_type_versions(Type='RESOURCE', TypeName='AWSQS::Kubernetes::Helm')['TypeVersionSummaries']
                      if len(versions) > 1:
                          cfn.deregister_type(Arn=physical_id)
                      else:
                          cfn.deregister_type(Type='RESOURCE', TypeName='AWSQS::Kubernetes::Helm')
              except Exception:
                  logging.error('Unhandled exception', exc_info=True)
                  status = cfnresponse.FAILED
              finally:
                  cfnresponse.send(event, context, status, {}, physicalResourceId=physical_id)
  RegisterType:
      Type: "AWS::CloudFormation::CustomResource"
      Properties:
        ServiceToken: !GetAtt RegisterTypeFunction.Arn
Outputs:
  ExecutionRoleArn:
    Value: !GetAtt ExecutionRole.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



