added license and changed rax-auth extension to identity
This commit is contained in:
parent
74993d1987
commit
7e4d3560d4
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from copy import deepcopy
|
||||
from importlib import import_module
|
||||
from uuid import uuid4
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.models.data_interfaces import ConfigSectionInterface
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
16
syntribos/extensions/identity/__init__.py
Normal file
16
syntribos/extensions/identity/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.models.data_interfaces import ConfigSectionInterface
|
||||
|
||||
|
||||
@ -28,10 +44,6 @@ class UserConfig(ConfigSectionInterface):
|
||||
def password(self):
|
||||
return self.get_raw("password")
|
||||
|
||||
@property
|
||||
def api_key(self):
|
||||
return self.get_raw("api_key")
|
||||
|
||||
@property
|
||||
def tenant_id(self):
|
||||
return self.get("tenant_id")
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.behaviors import BaseBehavior
|
||||
from cafe.engine.http.client import AutoMarshallingHTTPClient
|
||||
|
16
syntribos/extensions/identity/models/__init__.py
Normal file
16
syntribos/extensions/identity/models/__init__.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import json
|
||||
from xml.etree import ElementTree as ET
|
||||
from cafe.engine.models.base import (
|
||||
@ -12,14 +28,6 @@ class V2_0Constants(object):
|
||||
'http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0'
|
||||
XML_NS_OS_KSEC2 = \
|
||||
'http://docs.openstack.org/identity/api/ext/OS-KSEC2/v1.0'
|
||||
XML_NS_RAX_KSQA = \
|
||||
'http://docs.rackspace.com/identity/api/ext/RAX-KSQA/v1.0'
|
||||
XML_NS_RAX_KSKEY = \
|
||||
'http://docs.rackspace.com/identity/api/ext/RAX-KSKEY/v1.0'
|
||||
XML_NS_RAX_AUTH = \
|
||||
'http://docs.rackspace.com/identity/api/ext/RAX-AUTH/v1.0'
|
||||
XML_NS_RAX_KSGRP = \
|
||||
'http://docs.rackspace.com/identity/api/ext/RAX-KSGRP/v1.0'
|
||||
XML_NS_ATOM = 'http://www.w3.org/2005/Atom'
|
||||
|
||||
|
||||
@ -86,31 +94,31 @@ class EmptyModel(object):
|
||||
|
||||
class AuthResponse(BaseIdentityModel):
|
||||
def __init__(
|
||||
self, token=None, service_catalog=None, user=None):
|
||||
super(AuthResponse, self).__init__(locals())
|
||||
self, token=None, service_catalog=None, user=None, metadata=None):
|
||||
super(AuthResponse, self).__init__(locals())
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return cls(
|
||||
token=AuthResponseToken._dict_to_obj(data.get("token")),
|
||||
user=User._dict_to_obj(data.get("user")),
|
||||
token=AuthResponseToken._dict_to_obj(data.get('token')),
|
||||
metadata=Metadata._dict_to_obj(data.get('metadata')),
|
||||
user=User._dict_to_obj(data.get('user')),
|
||||
service_catalog=ServiceCatalog._dict_to_obj(
|
||||
data.get("serviceCatalog")))
|
||||
data.get('serviceCatalog')))
|
||||
|
||||
@classmethod
|
||||
def _json_to_obj(cls, serialized_str):
|
||||
data = json.loads(serialized_str)
|
||||
return cls._dict_to_obj(data.get("access"))
|
||||
data_dict = json.loads(serialized_str)
|
||||
return cls._dict_to_obj(data_dict.get("access"))
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
service_catalog = ServiceCatalog._xml_ele_to_obj(
|
||||
cls._find(element, "serviceCatalog"))
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return cls(
|
||||
token=AuthResponseToken._xml_ele_to_obj(
|
||||
cls._find(element, "token")),
|
||||
user=User._xml_ele_to_obj(cls._find(element, "user")),
|
||||
service_catalog=service_catalog)
|
||||
token=AuthResponseToken._xml_ele_to_obj(ele.find('token')),
|
||||
metadata=Metadata._xml_ele_to_obj(ele.find('metadata')),
|
||||
user=User._xml_ele_to_obj(ele.find('user')),
|
||||
service_catalog=ServiceCatalog._xml_ele_to_obj(
|
||||
ele.find('serviceCatalog')))
|
||||
|
||||
def get_service(self, name):
|
||||
for service in self.service_catalog:
|
||||
@ -119,51 +127,63 @@ class AuthResponse(BaseIdentityModel):
|
||||
return None
|
||||
|
||||
|
||||
class Metadata(BaseIdentityModel):
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return ele.attrib
|
||||
|
||||
|
||||
class Tenant(BaseIdentityModel):
|
||||
def __init__(self, name=None, id_=None):
|
||||
def __init__(self, enabled=None, description=None, name=None, id_=None):
|
||||
super(Tenant, self).__init__(locals())
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
if element is None:
|
||||
return cls()
|
||||
return cls(
|
||||
name=element.attrib.get("name"), id_=element.attrib.get("id"))
|
||||
if element.tag.lower() != "tenant":
|
||||
raise Exception("wrong element")
|
||||
enabled = True if element.attrib.get('enabled') == "true" else False
|
||||
description = element.find('description')
|
||||
description = "" if description is None else description.text
|
||||
return cls(enabled=enabled,
|
||||
description=description,
|
||||
name=element.attrib.get('name'),
|
||||
id_=element.attrib.get('id'))
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
if data is None:
|
||||
return cls()
|
||||
return cls(
|
||||
name=data.get("name"), id_=data.get("id"))
|
||||
def _dict_to_obj(cls, data_dict):
|
||||
return cls(description=data_dict.get('description'),
|
||||
enabled=data_dict.get('enabled'),
|
||||
id_=data_dict.get('id'),
|
||||
name=data_dict.get('name'))
|
||||
|
||||
@classmethod
|
||||
def _json_to_obj(cls, serialized_str):
|
||||
data = json.loads(serialized_str)
|
||||
return cls._dict_to_obj(data.get("tenant"))
|
||||
data_dict = json.loads(serialized_str)
|
||||
return cls._dict_to_obj(data_dict.get('tenant'))
|
||||
|
||||
|
||||
class AuthResponseToken(BaseIdentityModel):
|
||||
def __init__(
|
||||
self, id_=None, expires=None, tenant=None, authenticated_by=None):
|
||||
def __init__(self, id_=None, issued_at=None, expires=None, tenant=None):
|
||||
super(AuthResponseToken, self).__init__(locals())
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return cls(id_=data.get("id"),
|
||||
expires=data.get("expires"),
|
||||
tenant=Tenant._dict_to_obj(data.get("tenant")),
|
||||
authenticated_by=data.get("RAX-AUTH:authenticatedBy"))
|
||||
return cls(id_=data.get('id'),
|
||||
expires=data.get('expires'),
|
||||
issued_at=data.get('issued_at'),
|
||||
tenant=Tenant._dict_to_obj(data.get('tenant')))
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
authenticated_by = cls._find(element, "authenticatedBy")
|
||||
authenticated_by = authenticated_by.findtext("credential")
|
||||
return cls(
|
||||
id_=element.attrib.get("id"),
|
||||
expires=element.attrib.get("expires"),
|
||||
tenant=Tenant._xml_ele_to_obj(cls._find(element, "tenant")),
|
||||
authenticated_by=authenticated_by)
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return cls(id_=ele.attrib.get('id'),
|
||||
expires=ele.attrib.get('expires'),
|
||||
issued_at=ele.attrib.get('issued_at'),
|
||||
tenant=Tenant._xml_ele_to_obj(ele.find('tenant')))
|
||||
|
||||
|
||||
class ServiceCatalog(BaseIdentityListModel):
|
||||
@ -181,36 +201,32 @@ class ServiceCatalog(BaseIdentityListModel):
|
||||
|
||||
class User(BaseIdentityModel):
|
||||
def __init__(
|
||||
self, id_=None, name=None, roles=None,
|
||||
rax_auth_default_region=None, rax_auth_federated=None):
|
||||
self, id_=None, name=None, username=None, roles=None,
|
||||
roles_links=None):
|
||||
super(User, self).__init__(locals())
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
if data is None:
|
||||
return cls()
|
||||
region = data.get("RAX-AUTH:defaultRegion")
|
||||
if isinstance(region, list):
|
||||
region = region[0]
|
||||
return cls(
|
||||
id_=data.get("id"),
|
||||
name=data.get("name"),
|
||||
roles=Roles._dict_to_obj(data.get("roles")),
|
||||
rax_auth_default_region=region,
|
||||
rax_auth_federated=data.get("RAX-AUTH:federated"))
|
||||
id_=data.get('id'),
|
||||
name=data.get('name'),
|
||||
username=data.get('username'),
|
||||
roles=Roles._dict_to_obj(data.get('roles')),
|
||||
roles_links=RolesLinks._dict_to_obj(data.get('roles_links')))
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return cls(
|
||||
id_=element.attrib.get("id"),
|
||||
name=element.attrib.get("name"),
|
||||
roles=Roles._xml_ele_to_obj(cls._find(element, "roles")),
|
||||
rax_auth_default_region=element.attrib.get("defaultRegion"),
|
||||
rax_auth_federated=element.attrib.get("federated"))
|
||||
id_=ele.attrib.get('id'),
|
||||
name=ele.attrib.get('name'),
|
||||
username=ele.attrib.get('username'),
|
||||
roles=Roles._xml_ele_to_obj(ele.findall('role')),
|
||||
roles_links=RolesLinks._xml_ele_to_obj(ele.find('roles_links')))
|
||||
|
||||
|
||||
class Service(BaseIdentityModel):
|
||||
def __init__(self, endpoints=None, name=None, type_=None):
|
||||
def __init__(
|
||||
self, endpoints=None, endpoints_links=None, name=None, type_=None):
|
||||
super(Service, self).__init__(locals())
|
||||
|
||||
def get_endpoint(self, region):
|
||||
@ -219,7 +235,7 @@ class Service(BaseIdentityModel):
|
||||
or None if such an endpoint is not found
|
||||
"""
|
||||
for endpoint in self.endpoints:
|
||||
if getattr(endpoint, "region"):
|
||||
if getattr(endpoint, 'region'):
|
||||
if str(endpoint.region).lower() == str(region).lower():
|
||||
return endpoint
|
||||
return None
|
||||
@ -227,16 +243,19 @@ class Service(BaseIdentityModel):
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return cls(
|
||||
endpoints=Endpoints._dict_to_obj(data.get("endpoints")),
|
||||
name=data.get("name"), type_=data.get("type"))
|
||||
endpoints=Endpoints._dict_to_obj(data.get('endpoints')),
|
||||
endpoints_links=EndpointsLinks._dict_to_obj(
|
||||
data.get('endpoints_links')),
|
||||
name=data.get('name'), type_=data.get('type'))
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return cls(
|
||||
endpoints=Endpoints._xml_ele_to_obj(
|
||||
element.findall("endpoint")),
|
||||
name=element.attrib.get("name"),
|
||||
type_=element.attrib.get("type"))
|
||||
endpoints=Endpoints._xml_ele_to_obj(ele.findall("endpoint")),
|
||||
endpoints_links=EndpointsLinks._xml_ele_to_obj(
|
||||
ele.find('endpoints_links')),
|
||||
name=ele.attrib.get('name'),
|
||||
type_=ele.attrib.get('type'))
|
||||
|
||||
|
||||
class Endpoints(BaseIdentityListModel):
|
||||
@ -258,44 +277,47 @@ class Endpoints(BaseIdentityListModel):
|
||||
return cls._dict_to_obj(data.get("endpoints"))
|
||||
|
||||
|
||||
class EndpointsLinks(BaseIdentityListModel):
|
||||
# always returns an empty list since no documentation on endpoint links
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return EndpointsLinks()
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return EndpointsLinks()
|
||||
|
||||
|
||||
class Endpoint(BaseIdentityModel):
|
||||
def __init__(self, id_=None, tenant_id=None, region=None, type_=None,
|
||||
public_url=None, internal_url=None, admin_url=None,
|
||||
version_id=None, version_info=None, version_list=None,
|
||||
name=None):
|
||||
def __init__(
|
||||
self, region=None, id_=None, public_url=None, admin_url=None,
|
||||
internal_url=None, private_url=None, version_id=None,
|
||||
version_info=None, version_list=None):
|
||||
super(Endpoint, self).__init__(locals())
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, element):
|
||||
version = element.find("version")
|
||||
version_attrib = version.attrib if version is not None else {}
|
||||
return cls(
|
||||
id_=element.attrib.get("id"),
|
||||
tenant_id=element.attrib.get("tenantId"),
|
||||
region=element.attrib.get("region"),
|
||||
type_=element.attrib.get("type"),
|
||||
name=element.attrib.get("name"),
|
||||
public_url=element.attrib.get("publicURL"),
|
||||
internal_url=element.attrib.get("internalURL"),
|
||||
admin_url=element.attrib.get("adminURL"),
|
||||
version_id=version_attrib.get("id"),
|
||||
version_info=version_attrib.get("info"),
|
||||
version_list=version_attrib.get("list"))
|
||||
def _dict_to_obj(cls, data):
|
||||
return cls(region=data.get('region'),
|
||||
id_=data.get('Id'),
|
||||
public_url=data.get('publicURL'),
|
||||
private_url=data.get('privateURL'),
|
||||
admin_url=data.get('adminURL'),
|
||||
internal_url=data.get('internalURL'),
|
||||
version_id=data.get('versionId'),
|
||||
version_info=data.get('versionInfo'),
|
||||
version_list=data.get('versionList'))
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return cls(
|
||||
id_=data.get("id"),
|
||||
tenant_id=data.get("tenantId"),
|
||||
region=data.get("region"),
|
||||
type_=data.get("type"),
|
||||
name=data.get("name"),
|
||||
public_url=data.get("publicURL"),
|
||||
internal_url=data.get("internalURL"),
|
||||
admin_url=data.get("adminURL"),
|
||||
version_id=data.get("versionId"),
|
||||
version_info=data.get("versionInfo"),
|
||||
version_list=data.get("versionList"))
|
||||
def _xml_ele_to_obj(cls, ele):
|
||||
return cls(region=ele.attrib.get('region'),
|
||||
id_=ele.attrib.get('Id'),
|
||||
public_url=ele.attrib.get('publicURL'),
|
||||
private_url=ele.attrib.get('privateURL'),
|
||||
admin_url=ele.attrib.get('adminURL'),
|
||||
internal_url=ele.attrib.get('internalURL'),
|
||||
version_id=ele.attrib.get('versionId'),
|
||||
version_info=ele.attrib.get('versionInfo'),
|
||||
version_list=ele.attrib.get('versionList'))
|
||||
|
||||
|
||||
class Roles(BaseIdentityListModel):
|
||||
@ -310,6 +332,17 @@ class Roles(BaseIdentityListModel):
|
||||
return Roles([Role._dict_to_obj(obj) for obj in data])
|
||||
|
||||
|
||||
class RolesLinks(BaseIdentityListModel):
|
||||
# always returns an empty list since no documentation on role links
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
return RolesLinks()
|
||||
|
||||
@classmethod
|
||||
def _xml_ele_to_obj(cls, data):
|
||||
return RolesLinks()
|
||||
|
||||
|
||||
class Role(BaseIdentityModel):
|
||||
def __init__(
|
||||
self, id_=None, name=None, description=None,
|
||||
@ -321,52 +354,40 @@ class Role(BaseIdentityModel):
|
||||
if element is None:
|
||||
return None
|
||||
return cls(
|
||||
id_=element.attrib.get("id"), name=element.attrib.get("name"),
|
||||
description=element.attrib.get("description"),
|
||||
rax_auth_propagate=element.attrib.get("propagate"),
|
||||
service_id=element.attrib.get("serviceId"),
|
||||
tenant_id=element.attrib.get("tenantId"))
|
||||
id_=element.attrib.get("id"),
|
||||
name=element.attrib.get("name"),
|
||||
description=element.attrib.get("description"))
|
||||
|
||||
@classmethod
|
||||
def _dict_to_obj(cls, data):
|
||||
if data is None:
|
||||
return None
|
||||
return cls(
|
||||
id_=data.get("id"), name=data.get("name"),
|
||||
description=data.get("description"),
|
||||
rax_auth_propagate=data.get("rax-auth:propagate"),
|
||||
service_id=data.get("serviceId"),
|
||||
tenant_id=data.get("tenantId"))
|
||||
id_=data.get("id"),
|
||||
name=data.get("name"),
|
||||
description=data.get("description"))
|
||||
|
||||
|
||||
class Auth(BaseIdentityModel):
|
||||
xmlns = V2_0Constants.XML_NS
|
||||
|
||||
def __init__(
|
||||
self, password_creds=None, token_creds=None,
|
||||
api_key_creds=None, tenant_name=None, tenant_id=None):
|
||||
password_creds = password_creds or EmptyModel()
|
||||
token_creds = token_creds or EmptyModel()
|
||||
api_key_creds = api_key_creds or EmptyModel()
|
||||
self, username=None, password=None, tenant_name=None,
|
||||
tenant_id=None, token=None):
|
||||
super(Auth, self).__init__(locals())
|
||||
|
||||
def _obj_to_dict(self):
|
||||
attrs = {
|
||||
"tenantName": self.tenant_name,
|
||||
"tenantId": self.tenant_id,
|
||||
"passwordCredentials": self.password_creds._obj_to_dict(),
|
||||
"RAX-KSKEY:apiKeyCredentials": self.api_key_creds._obj_to_dict(),
|
||||
"token": self.token_creds._obj_to_dict()}
|
||||
"passwordCredentials": self.password_credentials._obj_to_dict()}
|
||||
return {'auth': self._remove_empty_values(attrs)}
|
||||
|
||||
def _obj_to_xml_ele(self):
|
||||
element = ET.Element('auth')
|
||||
element = self._set_xml_etree_element(
|
||||
element, {"tenantName": self.tenant_name, "xmlns": self.xmlns,
|
||||
element, {"tenantName": self.tenant_name,
|
||||
"tenantId": self.tenant_id})
|
||||
element.append(self.password_creds._obj_to_xml_ele())
|
||||
element.append(self.token_creds._obj_to_xml_ele())
|
||||
element.append(self.api_key_creds._obj_to_xml_ele())
|
||||
element.append(self.password_credentials._obj_to_xml_ele())
|
||||
return element
|
||||
|
||||
|
||||
@ -376,12 +397,16 @@ class PasswordCredentials(BaseIdentityModel):
|
||||
super(PasswordCredentials, self).__init__(locals())
|
||||
|
||||
def _obj_to_dict(self):
|
||||
attrs = {"username": self.username, "password": self.password}
|
||||
attrs = {
|
||||
"username": self.username,
|
||||
"password": self.password}
|
||||
return self._remove_empty_values(attrs)
|
||||
|
||||
def _obj_to_xml_ele(self):
|
||||
element = ET.Element('passwordCredentials')
|
||||
attrs = {"username": self.username, "password": self.password}
|
||||
attrs = {
|
||||
"username": self.username,
|
||||
"password": self.password}
|
||||
return self._set_xml_etree_element(element, attrs)
|
||||
|
||||
|
||||
@ -397,20 +422,3 @@ class Token(BaseIdentityModel):
|
||||
element = ET.Element('token')
|
||||
attrs = {"id": self.id_}
|
||||
return self._set_xml_etree_element(element, attrs)
|
||||
|
||||
|
||||
class APIKeyCredentials(BaseIdentityModel):
|
||||
def __init__(self, username=None, api_key=None):
|
||||
xmlns = V2_0Constants.XML_NS_RAX_KSKEY
|
||||
super(APIKeyCredentials, self).__init__(locals())
|
||||
|
||||
def _obj_to_dict(self):
|
||||
attrs = {"username": self.username, "apiKey": self.api_key}
|
||||
return self._remove_empty_values(attrs)
|
||||
|
||||
def _obj_to_xml_ele(self):
|
||||
element = ET.Element('apiKeyCredentials')
|
||||
attrs = {
|
||||
"username": self.username, "apiKey": self.api_key,
|
||||
"xmlns": self.xmlns}
|
||||
return self._set_xml_etree_element(element, attrs)
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from unittest.runner import _WritelnDecorator
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from string import ascii_letters, digits
|
||||
|
||||
from cafe.drivers.unittest.fixtures import BaseTestFixture
|
||||
|
@ -0,0 +1,16 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from syntribos.tests.fuzz import base_fuzz
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from syntribos.clients.http import SynHTTPClient, RequestCreator
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from cafe.engine.models.data_interfaces import ConfigSectionInterface
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from syntribos.tests.fuzz.base_fuzz import BaseFuzzConfig
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from syntribos.tests.fuzz import base_fuzz
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from syntribos.tests.fuzz import base_fuzz
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from syntribos.tests.fuzz import base_fuzz
|
||||
|
||||
|
||||
|
@ -1,3 +1,19 @@
|
||||
"""
|
||||
Copyright 2015 Rackspace
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
import re
|
||||
from copy import deepcopy
|
||||
from importlib import import_module
|
||||
|
Loading…
Reference in New Issue
Block a user