cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.cm.views.user.public_ip Namespace Reference

Functions

def assign
 Method attaches caller's PublicIP to his VM.
def get_list
def release
 Removes PublicIP from caller's pool and returns it to publicly available pool, provided PublicIP isn't in use.
def request
 Method requests single PublicIP address for caller.
def unassign
 Method detaches PublicIP from caller's VM.

Detailed Description

Note
All functions here are decorated by src.cm.utils.decorators.user_log. It's recommended to read src.cm.utils.decorators.user_log docs before using functions below.
Author
Maciej Nabożny di.di.nosp@m.jo@g.nosp@m.mail..nosp@m.com
Tomasz Sośnicki tom.s.nosp@m.osni.nosp@m.cki@g.nosp@m.mail.nosp@m..com

Function Documentation

def src.cm.views.user.public_ip.assign (   caller_id,
  lease_id,
  public_ip_id 
)

Method attaches caller's PublicIP to his VM.

VM's Lease instance's is assigned to PublicIP.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
lease_id(POST) id of the Lease in caller's UserNetwork
public_ip_id(POST) id of the Public_IP to be attached to VM
Exceptions
CMException('lease_not_found')
CMException('lease_not_assigned')
CMException('public_lease_assign')

Definition at line 98 of file public_ip.py.

def src.cm.views.user.public_ip.get_list (   caller_id)
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (list(dict)) PublicIP.dict property for each caller's PublicIP

Definition at line 43 of file public_ip.py.

def src.cm.views.user.public_ip.release (   caller_id,
  public_ip_id 
)

Removes PublicIP from caller's pool and returns it to publicly available pool, provided PublicIP isn't in use.

 @note There's very low probability of obtaining the same PublicIP address
 once again.
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
public_ip_id(POST int) id of the PublicIP to release

Definition at line 163 of file public_ip.py.

def src.cm.views.user.public_ip.request (   caller_id)

Method requests single PublicIP address for caller.

If caller's quota is exceeded, exception is raised. Otherwise caller obtains a new PublicIP address.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
Returns
HttpResponse with JSON content:
  • response: response status,
  • data: (string) newly obtained PublicIP's address
Exceptions
CMException('public_lease_not_found')
CMException('public_lease_request')

Definition at line 63 of file public_ip.py.

def src.cm.views.user.public_ip.unassign (   caller_id,
  lease_id 
)

Method detaches PublicIP from caller's VM.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
lease_id(POST int) id of the VM's Lease from which PublicIP should be detached.
Exceptions
CMException('lease_not_found')
CMException('public_lease_unassign')

Definition at line 130 of file public_ip.py.