Exemple #1
0
def list_domains(apiclient, **kwargs):
    """Lists domains"""

    cmd = listDomains.listDomainsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    if "account" in kwargs.keys() and "domainid" in kwargs.keys():
        cmd.listall = True
    return apiclient.listDomains(cmd)
Exemple #2
0
 def list(self, **kwargs):
     """:rtype: collections.Sequence[Domain]"""
     cmd = listDomainsCmd()
     copy_to_object(cmd, kwargs)
     results = self.api_client().listDomains(cmd)
     if results is None:
         return []
     return list([new_object(Domain, a, set_all=True) for a in results])
Exemple #3
0
def list_domains(apiclient, **kwargs):
    """Lists domains"""

    cmd = listDomains.listDomainsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
        cmd.listall = True
    return (apiclient.listDomains(cmd))
Exemple #4
0
 def delete_all(self, *args):
     """:type *args: list[Domain]"""
     cmd = listDomainsCmd()
     cmd.listall = True
     results = self.api_client().listDomains(cmd)
     for domain in args:
         for result in results:
             if domain.name == result.name:
                 self.delete(result)
Exemple #5
0
def get_domain(apiclient, services=None):
    "Returns a default domain"

    cmd = listDomains.listDomainsCmd()
    if services:
        if "domainid" in services:
            cmd.id = services["domainid"]

    domains = apiclient.listDomains(cmd)

    if isinstance(domains, list):
        assert len(domains) > 0
        return domains[0]
    else:
        raise Exception("Failed to find specified domain.")
Exemple #6
0
def get_domain(apiclient, services=None):
    "Returns a default domain"

    cmd = listDomains.listDomainsCmd()
    if services:
        if "domainid" in services:
            cmd.id = services["domainid"]

    domains = apiclient.listDomains(cmd)

    if isinstance(domains, list):
        assert len(domains) > 0
        return domains[0]
    else:
        raise Exception("Failed to find specified domain.")
Exemple #7
0
def get_domain(apiclient, domain_id=None, domain_name=None):
    """
    @name : get_domain
    @Desc : Returns the Domain Information for a given domain id or domain name
    @Input : domain id : Id of the Domain
             domain_name : Name of the Domain
    @Output : 1. Domain  Information for the passed inputs else first Domain
              2. FAILED In case the cmd failed
    """
    cmd = listDomains.listDomainsCmd()

    if domain_name is not None:
        cmd.name = domain_name
    if domain_id is not None:
        cmd.id = domain_id
    cmd_out = apiclient.listDomains(cmd)
    if validateList(cmd_out)[0] != PASS:
        return FAILED
    return cmd_out[0]
Exemple #8
0
def get_domain(api_client, domain_id=None, domain_name=None):
    """
    @name : get_domain
    @Desc : Returns the Domain Information for a given domain id or domain name
    @Input : domain id : Id of the Domain
             domain_name : Name of the Domain
    @Output : 1. Domain  Information for the passed inputs else first Domain
              2. FAILED In case the cmd failed
    """
    cmd = listDomains.listDomainsCmd()

    if domain_name is not None:
        cmd.name = domain_name
    if domain_id is not None:
        cmd.id = domain_id
    cmd_out = api_client.listDomains(cmd)
    if validate_list(cmd_out)[0] != PASS:
        return FAILED
    return cmd_out[0]
Exemple #9
0
def list_domains(apiclient, **kwargs):
    """Lists domains"""

    cmd = listDomains.listDomainsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    return(apiclient.listDomains(cmd))
Exemple #10
0
def list_domains(apiclient, **kwargs):
    """Lists domains"""

    cmd = listDomains.listDomainsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    return (apiclient.listDomains(cmd))