]
returns = Parameter(int, 'New address_type_id (> 0) if successful')
+
+ event_type = 'Add'
+ object_type = 'AddressType'
+ object_ids = []
def call(self, auth, name, address_type_fields = {}):
address_type_fields = dict(filter(can_update, address_type_fields.items()))
address_type = AddressType(self.api, address_type_fields)
address_type['name'] = name
address_type.sync()
-
- return address_type['address_type_id']
+ self.object_ids = [address_type['address_type_id']]
+
+ return address_type['address_type_id']
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'Address'
+ object_ids = []
+
def call(self, auth, address_type_id_or_name, address_id):
- address_types = AddressTypes(self.api, [address_type_id_or_name]).values()
+ address_types = AddressTypes(self.api, [address_type_id_or_name]).values()
if not address_types:
raise PLCInvalidArgument, "No such address type"
address_type = address_types[0]
raise PLCPermissionDenied, "Address must be associated with one of your sites"
address.add_address_type(address_type)
+ self.object_ids = [address['address_id']]
return 1
returns = Parameter(int, '1 if successful')
+ event_type = 'Add'
+ object_type = 'BootState'
+ object_ids = []
+
def call(self, auth, name):
boot_state = BootState(self.api)
boot_state['boot_state'] = name
returns = Parameter(int, '1 if successful')
+ event_type = 'Add'
+ object_type = 'KeyType'
+
def call(self, auth, name):
key_type = KeyType(self.api)
key_type['key_type'] = name
returns = Parameter(int, '1 if successful')
+ event_type = 'Add'
+ object_type = 'NetworkMethod'
+
def call(self, auth, name):
network_method = NetworkMethod(self.api)
network_method['method'] = name
returns = Parameter(int, '1 if successful')
+ event_type = 'Add'
+ object_type = 'NetworkType'
+
def call(self, auth, name):
network_type = NetworkType(self.api)
network_type['type'] = name
returns = Parameter(int, 'New node_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Node'
+ object_ids = []
+
def call(self, auth, site_id_or_login_base, hostname, node_fields = {}):
node_fields = dict(filter(can_update, node_fields.items()))
node['hostname'] = hostname
node['site_id'] = site['site_id']
node.sync()
+ self.object_ids = [node['node_id']]
return node['node_id']
returns = Parameter(int, 'New nodegroup_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'NodeGroup'
+ object_ids = []
+
def call(self, auth, name, nodegroup_fields = {}):
nodegroup_fields = dict(filter(can_update, nodegroup_fields.items()))
nodegroup = NodeGroup(self.api, nodegroup_fields)
nodegroup['name'] = name
nodegroup.sync()
+ self.object_ids = [nodegroup['nodegroup_id']]
return nodegroup['nodegroup_id']
returns = Parameter(int, 'New nodenetwork_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'NodeNetwork'
+ object_ids = []
+
def call(self, auth, node_id, method, type, nodenetwork_fields = {}):
nodenetwork_fields = dict(filter(can_update, nodenetwork_fields.items()))
nodenetwork['method'] = method
nodenetwork['type'] = type
nodenetwork.sync()
+ self.object_ids = [nodenetwork['nodenetwork_id']]
return nodenetwork['nodenetwork_id']
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'NodeGroup'
+ object_ids = []
+
def call(self, auth, nodegroup_id_or_name, node_id_or_hostname):
# Get node info
nodes = Nodes(self.api, [node_id_or_hostname])
# add node to nodegroup
if node['node_id'] not in nodegroup['node_ids']:
nodegroup.add_node(node)
+ self.object_ids = [nodegroup['nodegroup_id']]
return 1
]
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'PCU'
+ object_ids = []
def call(self, auth, node_id_or_hostname, pcu_id, port):
# Get node
raise PLCInvalidArgument, "PCU port already in use"
pcu.add_node(node, port)
+ self.object_ids = [pcu['pcu_id']]
return 1
]
returns = Parameter(int, 'New pcu_id (> 0) if successful')
+
+ event_type = 'Add'
+ object_type = 'PCU'
+ object_ids = []
def call(self, auth, site_id_or_login_base, ip, pcu_fields = {}):
pcu_fields = dict(filter(can_update, pcu_fields.items()))
pcu['site_id'] = site['site_id']
pcu['ip'] = ip
pcu.sync()
+ self.object_ids = [pcu['pcu_id']]
return pcu['pcu_id']
returns = Parameter(int, 'New person_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Person'
+ object_ids = []
+
def call(self, auth, first_name, last_name, person_fields = {}):
person_fields = dict(filter(can_update, person_fields.items()))
person = Person(self.api, person_fields)
person['last_name'] = last_name
person['enabled'] = False
person.sync()
+ self.object_ids = [person['person']]
return person['person_id']
returns = Parameter(int, 'New key_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Key'
+ object_ids = []
+
def call(self, auth, person_id_or_email, key_type, key_value):
# Get account details
persons = Persons(self.api, [person_id_or_email]).values()
key['key_type'] = key_type
key['key'] = key_value
key.sync(commit = False)
-
person.add_key(key, commit = True)
-
+ self.object_ids = [key['key_id']]
+
return key['key_id']
]
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'Site'
+ object_ids = []
def call(self, auth, person_id_or_email, site_id_or_login_base):
# Get account information
if site['site_id'] not in person['site_ids']:
site.add_person(person)
-
+ self.object_ids = [site['site_id']]
+
return 1
]
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'Slice'
+ object_ids = []
def call(self, auth, person_id_or_email, slice_id_or_name):
# Get account information
if slice['slice_id'] not in person['slice_ids']:
slice.add_person(person)
+ self.object_ids = [slice['slice_id']]
return 1
returns = Parameter(int, '1 if successful')
+ event_type = 'Add'
+ object_type = 'Role'
+ object_ids = []
+
def call(self, auth, role_id, name):
role = Role(self.api)
role['role_id'] = role_id
role['name'] = name
role.sync(insert = True)
+ self.object_ids = [role['role_id']]
return 1
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'Person'
+ object_ids = []
+
def call(self, auth, role_id_or_name, person_id_or_email):
# Get all roles
roles = {}
if role_id not in person['role_ids']:
person.add_role(role_id)
+ self.object_ids = [person['person_id']]
+
return 1
returns = Parameter(int, 'New site_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Site'
+ object_ids = []
+
def call(self, auth, name, abbreviated_name, login_base, site_fields = {}):
site_fields = dict(filter(can_update, site_fields.items()))
site = Site(self.api, site_fields)
site['abbreviated_name'] = abbreviated_name
site['login_base'] = login_base
site.sync()
-
- return site['site_id']
+ self.object_ids = [site['site_id']]
+
+ return site['site_id']
returns = Parameter(int, 'New address_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Address'
+ object_ids = []
+
def call(self, auth, site_id_or_login_base, address_fields = {}):
address_fields = dict(filter(can_update, address_fields.items()))
address = Address(self.api, address_fields)
address['site_id'] = site['site_id']
address.sync()
+ self.object_ids = [address['address_id']]
return address['address_id']
returns = Parameter(int, 'New slice_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'Slice'
+ object_ids = []
+
def call(self, auth, name, slice_fields = {}):
slice_fields = dict(filter(can_update, slice_fields.items()))
slice['name'] = name
slice['site_id'] = site['site_id']
slice.sync()
+ self.object_ids = [slice['slice_id']]
return slice['slice_id']
returns = Parameter(int, 'New slice_attribute_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'SliceAttribute'
+ object_ids = []
+
def call(self, auth, slice_id_or_name, attribute_type_id_or_name, value, node_id_or_hostname = None):
slices = Slices(self.api, [slice_id_or_name]).values()
if not slices:
slice_attribute['node_id'] = node['node_id']
slice_attribute.sync()
+ self.object_ids = [slice_attribute['slice_attribute_id']]
return slice_attribute['slice_attribute_id']
returns = Parameter(int, 'New attribute_id (> 0) if successful')
+ event_type = 'Add'
+ object_type = 'SliceAttributeType'
+ object_ids = []
+
def call(self, auth, name, attribute_type_fields = {}):
attribute_type_fields = dict(filter(can_update, attribute_type_fields.items()))
attribute_type = SliceAttributeType(self.api, attribute_type_fields)
attribute_type['name'] = name
attribute_type.sync()
+ self.object_ids = [attribute_type['attribute_type_id']]
return attribute_type['attribute_type_id']
returns = Parameter(int, '1 if successful')
+ event_type = 'AddTo'
+ object_type = 'Node'
+ object_ids = []
+
def call(self, auth, slice_id_or_name, node_id_or_hostname_list):
# Get slice information
slices = Slices(self.api, [slice_id_or_name])
for node in nodes:
if slice['slice_id'] not in node['slice_ids']:
slice.add_node(node)
+
+ self.object_ids = [node['node_id'] for node in nodes]
return 1