def __set_attribute_map()

in auth_service/auth_setup.py [0:0]


def __set_attribute_map(stack_name):
  identity_pool_id = cf_util.get_physical_resource_id(stack_name, "IdentityPool")
  user_pool_id = cf_util.get_physical_resource_id(stack_name, "UserPool")

  # Cognito endpoint isn't a Physical ID in the stack, so we get it from the Outputs
  cognito_endpoint = cf_util.get_output_value(stack_name, 'CognitoEndpoint')

  cid = boto3.client('cognito-identity')
  response = cid.set_principal_tag_attribute_map(
    IdentityPoolId=identity_pool_id,
    IdentityProviderName=cognito_endpoint+"/"+user_pool_id,
    PrincipalTags={
      'read': 'custom:read',
      'write': 'custom:write'
    }
  )