marvin_refactor: create takes factories not reqd args

- Let all entities inherit from CloudStackEntity
- create and list are classmethods since they work without need for an
  entity to exist
- create takes only factories by default. no need for long param list.
    Entitiy.create(apiclient) will give entity out of default factory
- Use entityFactory.attributes() to init entities

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-01-26 21:43:17 +05:30
parent dda9ae28f3
commit 776124914b
25 changed files with 100 additions and 0 deletions

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import deleteAccountFromProject
class AccountFromProject(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import addAccountToProject
class AccountToProject(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import getApiLimit
class ApiLimit(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import queryAsyncJobResult
class AsyncJobResult(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import getCloudIdentifier
class CloudIdentifier(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import uploadCustomCertificate
class CustomCertificate(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import markDefaultZoneForAccount
class DefaultZoneForAccount(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import removeFromLoadBalancerRule
class FromLoadBalancerRule(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import prepareHostForMaintenance
class HostForMaintenance(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import cancelHostMaintenance
class HostMaintenance(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import updateHostPassword
class HostPassword(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import associateIpAddress
class IpAddress(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import resetPasswordForVirtualMachine
class PasswordForVirtualMachine(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import updateResourceCount
class ResourceCount(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import addSecondaryStorage
class SecondaryStorage(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import revokeSecurityGroupEgress
class SecurityGroupEgress(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import revokeSecurityGroupIngress
class SecurityGroupIngress(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import changeServiceForRouter
class ServiceForRouter(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import changeServiceForSystemVm
class ServiceForSystemVm(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import changeServiceForVirtualMachine
class ServiceForVirtualMachine(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import disableStaticNat
class StaticNat(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -21,6 +21,10 @@ from marvin.cloudstackAPI import enableStorageMaintenance
class StorageMaintenance(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import assignToLoadBalancerRule
class ToLoadBalancerRule(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import registerUserKeys
class UserKeys(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)

View File

@ -20,6 +20,10 @@ from marvin.cloudstackAPI import getVMPassword
class VMPassword(CloudStackEntity.CloudStackEntity):
def __init__(self, items):
self.__dict__.update(items)
def __init__(self, items):
self.__dict__.update(items)