def setupRedirect(self):

        redirectDomain = "www.%s" % self.domain
        redirectDNSDomain = redirectDomain + '.'

        bucket = AWSBucket(self.accessKey, self.secretKey, redirectDomain)

        if bucket.isCreated():
            logging.info("Bucket with name %s already exists, so skipping redirect bucket setup. \
                If you've set this up before, this will still work. Delete the bucket if you want Cactus to\
                set it up again.", redirectDomain)
            return

        bucket.create()
        bucket.configureRedirect(self.domain)

        for record in self.records():
            if record.type == "CNAME" and record.name == redirectDNSDomain:
                self.delete(record)

        self.createRecord(redirectDomain, "CNAME", [self.domain])
dataset/ETHPy150Open koenbok/Cactus/cactus/deployment/s3/domain.py/AWSDomain.setupRedirect/original