Ejemplo n.º 1
0
 def __init__(self,
              key: str = None,
              secret: str = None,
              region: str = 'eu-west-2',
              service: str = 'api',
              version: str = 'latest'):
     self.key = key
     self.secret = secret
     self.region = region
     self.connection = ConnectionUserAndKey(self.key, self.secret)
     self.connection.region_name = region
     self.connection.service_name = service
     self.service_name = service
     self.version = version
     self.signer = OSCRequestSignerAlgorithmV4(access_key=self.key,
                                               access_secret=self.secret,
                                               version=self.version,
                                               connection=self.connection)
     self.NODE_STATE = {
         'pending': NodeState.PENDING,
         'running': NodeState.RUNNING,
         'shutting-down': NodeState.UNKNOWN,
         'terminated': NodeState.TERMINATED,
         'stopped': NodeState.STOPPED
     }
Ejemplo n.º 2
0
    def request(self, action, params=None, data='', headers=None,
                method='GET'):
        """ Add the X-NFSN-Authentication header to an HTTP request. """
        if not headers:
            headers = {}
        if not params:
            params = {}
        header = self._header(action, data)

        headers['X-NFSN-Authentication'] = header
        if method == 'POST':
            headers['Content-Type'] = 'application/x-www-form-urlencoded'

        return ConnectionUserAndKey.request(self, action, params, data,
                                            headers, method)
Ejemplo n.º 3
0
    def request(self,
                action,
                params=None,
                data='',
                headers=None,
                method='GET'):
        """ Add the X-NFSN-Authentication header to an HTTP request. """
        if not headers:
            headers = {}
        if not params:
            params = {}
        header = self._header(action, data)

        headers['X-NFSN-Authentication'] = header
        if method == 'POST':
            headers['Content-Type'] = 'application/x-www-form-urlencoded'

        return ConnectionUserAndKey.request(self, action, params, data,
                                            headers, method)
Ejemplo n.º 4
0
    def request(self,
                action,
                params=None,
                data="",
                headers=None,
                method="GET"):
        """Add the X-NFSN-Authentication header to an HTTP request."""
        if not headers:
            headers = {}
        if not params:
            params = {}
        header = self._header(action, data)

        headers["X-NFSN-Authentication"] = header
        if method == "POST":
            headers["Content-Type"] = "application/x-www-form-urlencoded"

        return ConnectionUserAndKey.request(self, action, params, data,
                                            headers, method)
Ejemplo n.º 5
0
 def test_base_connection_userkey(self):
     ConnectionUserAndKey('foo', 'bar')
Ejemplo n.º 6
0
 def test_base_connection_userkey(self):
     ConnectionUserAndKey("foo", "bar")