示例#1
0
文件: rest.py 项目: zhan849/argo
def axmon_domains_list():
    """
    Return a list of hosted zones (domains) that the cluster has access to
    Returns:
        { 'result': [list of domains] }
    """
    if Cloud().target_cloud_gcp():
        return jsonify([])
    else:
        r53client = Route53(boto3.client("route53"))
        return jsonify(result=[x.name for x in r53client.list_hosted_zones()])
示例#2
0
    def __init__(self, dnsname):
        if not hostname_validator(dnsname):
            raise AXIllegalArgumentException("dns name {} is illegal".format(dnsname))

        (self.name, _, self.domain) = dnsname.partition(".")
        self.ax_meta = {}

        config = Config(connect_timeout=60, read_timeout=60)
        boto_client = boto3.client("route53", config=config)
        client = Route53(boto_client)
        self.zone = Route53HostedZone(client, self.domain)
示例#3
0
def add_route53_entry(elb_addr):
    host_mapping = os.environ.get("AX_DEPLOYMENT_HOST_MAPPING", None)
    if host_mapping is None:
        return

    client = boto3.client('route53')
    r53client = Route53(client)
    (host_name, _, domain_name) = host_mapping.partition(".")
    zone = Route53HostedZone(r53client, domain_name)
    zone.create_alias_record(host_name, elb_addr)
    logger.debug("Added a host_mapping {} for elb {}".format(host_mapping, elb_addr))
示例#4
0
文件: rest.py 项目: nuaays/argo
def axmon_domains_domain(domainname):
    """
    Return a list of records for the domain
    Returns:
        { 'result': [list of records for domain] }
    """
    if Cloud().target_cloud_gcp():
        return jsonify([])
    else:
        r53client = Route53(boto3.client("route53"))
        zone = Route53HostedZone(r53client, domainname)
        return jsonify(result=[x for x in zone.list_records()])
示例#5
0
文件: rest.py 项目: nuaays/argo
def axmon_domains_list():
    """
    Return a list of hosted zones (domains) that the cluster has access to
    Returns:
        { 'result': [list of domains] }
    """
    cluster_config = AXClusterConfig(cluster_name_id=cluster_name_id)
    if Cloud().target_cloud_gcp() or cluster_config.get_provider() == "minikube":
        return jsonify([])
    else:
        r53client = Route53(boto3.client("route53"))
        return jsonify(result=[x.name for x in r53client.list_hosted_zones()])