Use abc in a python2-compatible way.
This commit is contained in:
parent
7b096d690f
commit
7db2d0f38c
@ -1,9 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from abc import ABC, abstractmethod
|
from abc import abstractmethod, ABCMeta
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
|
import six
|
||||||
from botocore.auth import SigV4Auth, S3SigV4Auth
|
from botocore.auth import SigV4Auth, S3SigV4Auth
|
||||||
from botocore.awsrequest import AWSRequest
|
from botocore.awsrequest import AWSRequest
|
||||||
from botocore.credentials import Credentials
|
from botocore.credentials import Credentials
|
||||||
@ -25,7 +26,7 @@ def create_access_key(access_key_id, headers):
|
|||||||
return AssumedRoleAccessKey(access_key_id, headers)
|
return AssumedRoleAccessKey(access_key_id, headers)
|
||||||
|
|
||||||
|
|
||||||
class IAMUserAccessKey:
|
class IAMUserAccessKey(object):
|
||||||
|
|
||||||
def __init__(self, access_key_id, headers):
|
def __init__(self, access_key_id, headers):
|
||||||
iam_users = iam_backend.list_users('/', None, None)
|
iam_users = iam_backend.list_users('/', None, None)
|
||||||
@ -74,7 +75,7 @@ class IAMUserAccessKey:
|
|||||||
return user_policies
|
return user_policies
|
||||||
|
|
||||||
|
|
||||||
class AssumedRoleAccessKey:
|
class AssumedRoleAccessKey(object):
|
||||||
|
|
||||||
def __init__(self, access_key_id, headers):
|
def __init__(self, access_key_id, headers):
|
||||||
for assumed_role in sts_backend.assumed_roles:
|
for assumed_role in sts_backend.assumed_roles:
|
||||||
@ -121,7 +122,8 @@ class CreateAccessKeyFailure(Exception):
|
|||||||
self.reason = reason
|
self.reason = reason
|
||||||
|
|
||||||
|
|
||||||
class IAMRequestBase(ABC):
|
@six.add_metaclass(ABCMeta)
|
||||||
|
class IAMRequestBase(object):
|
||||||
|
|
||||||
def __init__(self, method, path, data, headers):
|
def __init__(self, method, path, data, headers):
|
||||||
log.debug("Creating {class_name} with method={method}, path={path}, data={data}, headers={headers}".format(
|
log.debug("Creating {class_name} with method={method}, path={path}, data={data}, headers={headers}".format(
|
||||||
@ -245,7 +247,7 @@ class S3IAMRequest(IAMRequestBase):
|
|||||||
raise S3AccessDeniedError()
|
raise S3AccessDeniedError()
|
||||||
|
|
||||||
|
|
||||||
class IAMPolicy:
|
class IAMPolicy(object):
|
||||||
|
|
||||||
def __init__(self, policy):
|
def __init__(self, policy):
|
||||||
if isinstance(policy, Policy):
|
if isinstance(policy, Policy):
|
||||||
@ -278,7 +280,7 @@ class IAMPolicy:
|
|||||||
return PermissionResult.NEUTRAL
|
return PermissionResult.NEUTRAL
|
||||||
|
|
||||||
|
|
||||||
class IAMPolicyStatement:
|
class IAMPolicyStatement(object):
|
||||||
|
|
||||||
def __init__(self, statement):
|
def __init__(self, statement):
|
||||||
self._statement = statement
|
self._statement = statement
|
||||||
|
Loading…
Reference in New Issue
Block a user