def __init__()

in scripts/yapl/LogExporter.py [0:0]


  def __init__(self,region=None, bucket=None, keyPrefix='logs',  fqdn=None):
    """
      Constructor
      
      region - the AWS region name
      bucket - the S3 bucket name.  The bucket gets created if it does not exist.
      keyPrefix - the S3 key prefix to be used for each log export to S3, 
        e.g., logs/<stackname> where <stackname> is the name of the CloudFormation
              stack associated with the root template for a given deployment.
              The root stack name is unique.
              Using logs as the beginning of the prefix keeps all logs in a 
              separate "folder" of the bucket.
      fqdn - fully qualified domain name of the node exporting the logs
             The FQDN provides uniqueness as there may be more than one node 
             with a given role.
    """
    object.__init__(self)
    
    if (not region):
      raise MissingArgumentException("The AWS region name must be provided.")
    #endIf
    self.region = region
    
    if (not bucket):
      raise MissingArgumentException("The S3 bucket name for the exported logs must be provided.")
    #endIf
    self.bucket = bucket
    
    self.keyPrefix = keyPrefix
    
    if (not fqdn):
      raise MissingArgumentException("The FQDN of the node exporting the logs must be provided.")
    #endIf
    self.fqdn = fqdn
    
    self.s3Helper = S3Helper(region=region)
    
    if (not self.s3Helper.bucketExists(bucket)):
      self.s3Helper.createBucket(bucket,region=region)