Browse Source

HUE-6412 [optimizer] Update API for production

Romain Rigaux 8 years ago
parent
commit
755b850
29 changed files with 133 additions and 1164 deletions
  1. 1 1
      desktop/core/ext-py/navoptapi-0.1.0/MANIFEST.in
  2. 1 1
      desktop/core/ext-py/navoptapi-0.1.0/PKG-INFO
  3. 8 6
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/__init__.py
  4. 5 5
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/_version.py
  5. 13 13
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/auth.py
  6. 11 2
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/compat.py
  7. 9 9
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/configloader.py
  8. 18 18
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/credentials.py
  9. 30 30
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/exceptions.py
  10. 4 4
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/signers.py
  11. 0 0
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/thirdparty/__init__.py
  12. 0 0
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/thirdparty/six.py
  13. 7 7
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/utils.py
  14. 3 3
      desktop/core/ext-py/navoptapi-0.1.0/altuscli/validate.py
  15. 0 81
      desktop/core/ext-py/navoptapi-0.1.0/ccscli/serialize.py
  16. 3 3
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/__init__.py
  17. 4 4
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/_version.py
  18. 9 9
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/api_lib.py
  19. 0 127
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/auth.py
  20. 0 165
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/compat.py
  21. 0 293
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/credentials.py
  22. 0 130
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_auth.py
  23. 0 48
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_credentials.py
  24. 0 80
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_serialize.py
  25. 0 58
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_signers.py
  26. 0 59
      desktop/core/ext-py/navoptapi-0.1.0/navoptapi/signers.py
  27. 1 1
      desktop/core/ext-py/navoptapi-0.1.0/setup.cfg
  28. 0 1
      desktop/core/ext-py/navoptapi-0.1.0/setup.py
  29. 6 6
      desktop/core/ext-py/navoptapi-0.1.0/versioneer.py

+ 1 - 1
desktop/core/ext-py/navoptapi-0.1.0/MANIFEST.in

@@ -1,4 +1,4 @@
 include README.rst
 include versioneer.py
-include ccscli/compat.py
+include altuscli/compat.py
 include navoptapi/_version.py

+ 1 - 1
desktop/core/ext-py/navoptapi-0.1.0/PKG-INFO

@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: navoptapi
-Version: 0+untagged.3628.g9db772a.dirty
+Version: 0+untagged.4944.g4b9a5db.dirty
 Summary: Cloudera Navigator Optimizer Api
 Home-page: http://www.cloudera.com/
 Author: UNKNOWN

+ 8 - 6
desktop/core/ext-py/navoptapi-0.1.0/ccscli/__init__.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/__init__.py

@@ -25,7 +25,7 @@ del get_versions
 
 VERSION = __version__
 
-CCSCLI_ROOT = os.path.dirname(os.path.abspath(__file__))
+ALTUSCLI_ROOT = os.path.dirname(os.path.abspath(__file__))
 
 
 # Used to specify anonymous (unsigned) request signature
@@ -39,7 +39,7 @@ SCALAR_TYPES = set(['string',
                     'boolean',
                     'double',
                     'blob',
-                    'timestamp'])
+                    'datetime'])
 
 LIST_TYPE = 'array'
 OBJECT_TYPE = 'object'
@@ -50,8 +50,8 @@ COMPLEX_TYPES = set([OBJECT_TYPE,
                      LIST_TYPE])
 
 DEFAULT_PROFILE_NAME = 'default'
-CCS_ACCESS_KEY_ID_KEY_NAME = 'ccs_access_key_id'
-CCS_PRIVATE_KEY_KEY_NAME = 'ccs_private_key'
+ALTUS_ACCESS_KEY_ID_KEY_NAME = 'altus_access_key_id'
+ALTUS_PRIVATE_KEY_KEY_NAME = 'altus_private_key'
 # Python argparse has a bug in which '-' are not parsed correctly if they appear
 # as values for other arguments, see: http://bugs.python.org/issue9334 for more
 # details. This defines special encoding for dash that we will "decode" and
@@ -61,7 +61,9 @@ ARGPARSE_DASH_ENCODING = '\\-'
 
 # Prepopulate the cache with special cases that don't match our regular
 # transformation.
-_xform_cache = {}
+_xform_cache = {
+    ('s3GuardConfiguration', '-'): 's3-guard-configuration',
+}
 _first_cap_regex = re.compile('(.)([A-Z][a-z]+)')
 _number_cap_regex = re.compile('([a-z])([0-9]+)')
 _end_cap_regex = re.compile('([a-z0-9])([A-Z])')
@@ -80,7 +82,7 @@ def xform_name(name, sep='_', _xform_cache=_xform_cache):
         if _special_case_transform.search(name) is not None:
             is_special = _special_case_transform.search(name)
             matched = is_special.group()
-            # Replace something like CRNs, ACLs with _arns, _acls.
+            # Replace something like CRNs, ACLs with _crns, _acls.
             name = name[:-len(matched)] + sep + matched.lower()
         s1 = _first_cap_regex.sub(r'\1' + sep + r'\2', name)
         s2 = _number_cap_regex.sub(r'\1' + sep + r'\2', s1)

+ 5 - 5
desktop/core/ext-py/navoptapi-0.1.0/ccscli/_version.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/_version.py

@@ -6,7 +6,7 @@
 # that just contains the computed version number.
 
 # This file is released into the public domain. Generated by
-# versioneer-0.17 (https://github.com/warner/python-versioneer)
+# versioneer-0.18 (https://github.com/warner/python-versioneer)
 
 """Git implementation of _version.py."""
 
@@ -41,9 +41,9 @@ def get_config():
     cfg = VersioneerConfig()
     cfg.VCS = "git"
     cfg.style = "pep440"
-    cfg.tag_prefix = "ccscli-"
-    cfg.parentdir_prefix = "None"
-    cfg.versionfile_source = "ccscli/_version.py"
+    cfg.tag_prefix = "altuscli-"
+    cfg.parentdir_prefix = "altuscli-"
+    cfg.versionfile_source = "altuscli/_version.py"
     cfg.verbose = False
     return cfg
 
@@ -295,7 +295,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
         pieces["closest-tag"] = None
         count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"],
                                     cwd=root)
-        pieces["distance"] = int(count_out) if count_out is not None else 0  # total number of commits
+        pieces["distance"] = int(count_out)  # total number of commits
 
     # commit date: see ISO-8601 comment in git_versions_from_keywords()
     date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"],

+ 13 - 13
desktop/core/ext-py/navoptapi-0.1.0/ccscli/auth.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/auth.py

@@ -17,15 +17,15 @@ from base64 import urlsafe_b64encode
 from email.utils import formatdate
 import logging
 
+from altuscli.compat import json
+from altuscli.compat import OrderedDict
+from altuscli.compat import urlsplit
+from altuscli.exceptions import NoCredentialsError
 from asn1crypto import keys, pem
-from ccscli.compat import json
-from ccscli.compat import OrderedDict
-from ccscli.compat import urlsplit
-from ccscli.exceptions import NoCredentialsError
 import rsa
 
 
-LOG = logging.getLogger('ccscli.auth')
+LOG = logging.getLogger('altuscli.auth')
 
 
 class BaseSigner(object):
@@ -60,7 +60,7 @@ class RSAv1Auth(BaseSigner):
                 "corrupted or it is not in PKCS8 PEM format. The private key " \
                 "was extracted either from 'env' (environment variables), " \
                 "'shared-credentials-file' (a profile in the shared " \
-                "credential file, by default under ~/.ccs/credentials), or " \
+                "credential file, by default under ~/.altus/credentials), or " \
                 "'auth-config-file' (a file containing the credentials whose " \
                 "location was supplied on the command line.)" % \
                 self.credentials.method
@@ -71,11 +71,11 @@ class RSAv1Auth(BaseSigner):
         return urlsafe_b64encode(signature).strip().decode('utf-8')
 
     def _canonical_standard_headers(self, headers):
-        interesting_headers = ['content-type', 'x-ccs-date']
+        interesting_headers = ['content-type', 'x-altus-date']
         hoi = []
-        if 'x-ccs-date' in headers:
-            raise Exception("x-ccs-date found in headers!")
-        headers['x-ccs-date'] = self._get_date()
+        if 'x-altus-date' in headers:
+            raise Exception("x-altus-date found in headers!")
+        headers['x-altus-date'] = self._get_date()
         for ih in interesting_headers:
             found = False
             for key in headers:
@@ -114,9 +114,9 @@ class RSAv1Auth(BaseSigner):
         return formatdate(usegmt=True)
 
     def _inject_signature(self, request, signature):
-        if 'x-ccs-auth' in request.headers:
-            raise Exception("x-ccs-auth found in headers!")
-        request.headers['x-ccs-auth'] = self._get_signature_header(signature)
+        if 'x-altus-auth' in request.headers:
+            raise Exception("x-altus-auth found in headers!")
+        request.headers['x-altus-auth'] = self._get_signature_header(signature)
 
     def _get_signature_header(self, signature):
         auth_params = OrderedDict()

+ 11 - 2
desktop/core/ext-py/navoptapi-0.1.0/ccscli/compat.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/compat.py

@@ -15,9 +15,11 @@
 # language governing permissions and limitations under the License.
 
 import copy
+import os
 import sys
 
-from ccscli.thirdparty import six  # noqa
+from altuscli.thirdparty import six  # noqa
+
 
 if six.PY3:
     from base64 import encodebytes  # noqa
@@ -148,7 +150,7 @@ def copy_kwargs(kwargs):
     return copy_kwargs
 
 
-def compat_input(prompt):
+def compat_input(prompt, interactive_long_input=False):
     """
     Cygwin's pty's are based on pipes. Therefore, when it interacts with a Win32
     program (such as Win32 python), what that program sees is a pipe instead of
@@ -160,6 +162,13 @@ def compat_input(prompt):
 
     See https://github.com/mintty/mintty/issues/56 for more details.
     """
+    is_windows = sys.platform.startswith('win')
+    if interactive_long_input:
+        # See THUN-222 for context on why this is necessary
+        if is_windows is False:
+            os.system('stty -icanon')
     sys.stdout.write(prompt)
     sys.stdout.flush()
+    if is_windows is False:
+        os.system('stty sane')
     return raw_input()

+ 9 - 9
desktop/core/ext-py/navoptapi-0.1.0/ccscli/configloader.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/configloader.py

@@ -19,7 +19,7 @@ import copy
 import os
 import shlex
 
-from ccscli.exceptions import ConfigNotFound, ConfigParseError
+from altuscli.exceptions import ConfigNotFound, ConfigParseError
 
 from six.moves import configparser
 
@@ -177,12 +177,12 @@ def build_profile_map(parsed_ini_config):
     default to be prepended with "profile", e.g.::
 
         [profile test]
-        ccs_... = foo
-        ccs_... = bar
+        altus_... = foo
+        altus_... = bar
 
         [profile bar]
-        ccs_... = foo
-        ccs_... = bar
+        altus_... = foo
+        altus_... = bar
 
         # This is *not* a profile
         [preview]
@@ -198,16 +198,16 @@ def build_profile_map(parsed_ini_config):
     the sub dictionary is a profile name.  For example, the above config file
     would be converted from::
 
-        {"profile test": {"ccs_...": "foo", "ccs...": "bar"},
-         "profile bar": {"ccs...": "foo", "ccs...": "bar"},
+        {"profile test": {"altus_...": "foo", "altus_...": "bar"},
+         "profile bar": {"altus_...": "foo", "altus_...": "bar"},
          "preview": {"otherstuff": ...},
          "foobar": {"morestuff": ...},
          }
 
     into::
 
-        {"profiles": {"test": {"ccs_...": "foo", "ccs...": "bar"},
-                      "bar": {"ccs...": "foo", "ccs...": "bar"},
+        {"profiles": {"test": {"altus_...": "foo", "altus_...": "bar"},
+                      "bar": {"altus_...": "foo", "altus_...": "bar"},
          "preview": {"otherstuff": ...},
          "foobar": {"morestuff": ...},
         }

+ 18 - 18
desktop/core/ext-py/navoptapi-0.1.0/ccscli/credentials.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/credentials.py

@@ -17,16 +17,16 @@ from collections import namedtuple
 import logging
 import os
 
-from ccscli import CCS_ACCESS_KEY_ID_KEY_NAME, CCS_PRIVATE_KEY_KEY_NAME
-import ccscli.compat
-from ccscli.compat import json
-from ccscli.configloader import raw_config_parse
-from ccscli.exceptions import ConfigNotFound
-from ccscli.exceptions import NoCredentialsError
-from ccscli.exceptions import PartialCredentialsError
-from ccscli.exceptions import UnknownCredentialError
-
-LOG = logging.getLogger('ccscli.credentials')
+from altuscli import ALTUS_ACCESS_KEY_ID_KEY_NAME, ALTUS_PRIVATE_KEY_KEY_NAME
+import altuscli.compat
+from altuscli.compat import json
+from altuscli.configloader import raw_config_parse
+from altuscli.exceptions import ConfigNotFound
+from altuscli.exceptions import NoCredentialsError
+from altuscli.exceptions import PartialCredentialsError
+from altuscli.exceptions import UnknownCredentialError
+
+LOG = logging.getLogger('altuscli.credentials')
 ReadOnlyCredentials = namedtuple('ReadOnlyCredentials',
                                  ['access_key_id', 'private_key', 'method'])
 ACCESS_KEY_ID = 'access_key_id'
@@ -62,9 +62,9 @@ def create_credential_resolver(context):
         # concept to retrieve credentials.
         # The one edge case is if all three values are provided via
         # env vars:
-        # export CCS_ACCESS_KEY_ID=foo
-        # export CCS_PRIVATE_KEY=bar
-        # export CCS_PROFILE=baz
+        # export ALTUS_ACCESS_KEY_ID=foo
+        # export ALTUS_PRIVATE_KEY=bar
+        # export ALTUS_PROFILE=baz
         # Then, just like our client() calls, the explicit credentials
         # will take precedence.
         #
@@ -97,8 +97,8 @@ class Credentials(object):
         self._normalize()
 
     def _normalize(self):
-        self.access_key_id = ccscli.compat.ensure_unicode(self.access_key_id)
-        self.private_key = ccscli.compat.ensure_unicode(self.private_key)
+        self.access_key_id = altuscli.compat.ensure_unicode(self.access_key_id)
+        self.private_key = altuscli.compat.ensure_unicode(self.private_key)
 
     def get_frozen_credentials(self):
         return ReadOnlyCredentials(self.access_key_id,
@@ -127,8 +127,8 @@ class CredentialProvider(object):
 
 class EnvProvider(CredentialProvider):
     METHOD = 'env'
-    ACCESS_KEY_ID_ENV_VAR = 'CCS_ACCESS_KEY_ID'
-    PRIVATE_KEY_ENV_VAR = 'CCS_PRIVATE_KEY'
+    ACCESS_KEY_ID_ENV_VAR = 'ALTUS_ACCESS_KEY_ID'
+    PRIVATE_KEY_ENV_VAR = 'ALTUS_PRIVATE_KEY'
 
     def __init__(self, environ=None, mapping=None):
         super(EnvProvider, self).__init__()
@@ -282,7 +282,7 @@ class SharedCredentialProvider(CredentialProvider):
         if self._profile_name in available_creds:
             config = available_creds[self._profile_name]
             access_key_id, private_key = self._extract_creds_from_mapping(
-                config, CCS_ACCESS_KEY_ID_KEY_NAME, CCS_PRIVATE_KEY_KEY_NAME)
+                config, ALTUS_ACCESS_KEY_ID_KEY_NAME, ALTUS_PRIVATE_KEY_KEY_NAME)
             # We store the private key in the credentials file as a one-line
             # value in which the newlines in the PEM file are replaced with
             # '\n'. We need to replace them back as the RawConfigParser we use

+ 30 - 30
desktop/core/ext-py/navoptapi-0.1.0/ccscli/exceptions.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/exceptions.py

@@ -15,9 +15,9 @@
 # language governing permissions and limitations under the License.
 
 
-class CCSCLIError(Exception):
+class AltusCLIError(Exception):
     """
-    The base exception class for CCS CLI exceptions.
+    The base exception class for Altus CLI exceptions.
     """
     fmt = 'An unspecified error occured'
 
@@ -27,32 +27,32 @@ class CCSCLIError(Exception):
         self.kwargs = kwargs
 
 
-class ValidationError(CCSCLIError):
+class ValidationError(AltusCLIError):
     """
     An exception occurred validating parameters.
     """
     fmt = "Invalid value ('{value}') for param {param} of type {type_name}"
 
 
-class ParamValidationError(CCSCLIError):
+class ParamValidationError(AltusCLIError):
     fmt = 'Parameter validation failed:\n{report}'
 
 
-class DataNotFoundError(CCSCLIError):
+class DataNotFoundError(AltusCLIError):
     """
     The data associated with a particular path could not be loaded.
     """
     fmt = 'Unable to load data for: {data_path}'
 
 
-class ExecutableNotFoundError(CCSCLIError):
+class ExecutableNotFoundError(AltusCLIError):
     """
     The executable was not found.
     """
     fmt = 'Could not find executable named: {executable_name}'
 
 
-class OperationNotPageableError(CCSCLIError):
+class OperationNotPageableError(AltusCLIError):
     fmt = 'Operation cannot be paginated: {operation_name}'
 
 
@@ -78,7 +78,7 @@ class ClientError(Exception):
         self.response = error_response
 
 
-class UnseekableStreamError(CCSCLIError):
+class UnseekableStreamError(AltusCLIError):
     """
     Need to seek a stream, but stream does not support seeking.
     """
@@ -86,12 +86,12 @@ class UnseekableStreamError(CCSCLIError):
            'is not seekable.')
 
 
-class EndpointConnectionError(CCSCLIError):
+class EndpointConnectionError(AltusCLIError):
     fmt = (
         'Could not connect to the endpoint URL: "{endpoint_url}"')
 
 
-class IncompleteReadError(CCSCLIError):
+class IncompleteReadError(AltusCLIError):
     """
     HTTP response did not return expected number of bytes.
     """
@@ -99,46 +99,46 @@ class IncompleteReadError(CCSCLIError):
            'expected is {expected_bytes}.')
 
 
-class PaginationError(CCSCLIError):
+class PaginationError(AltusCLIError):
     fmt = 'Error during pagination: {message}'
 
 
-class UnknownSignatureVersionError(CCSCLIError):
+class UnknownSignatureVersionError(AltusCLIError):
     """
     Requested Signature Version is not known.
     """
     fmt = 'Unknown Signature Version: {signature_version}.'
 
 
-class UnsupportedSignatureVersionError(CCSCLIError):
+class UnsupportedSignatureVersionError(AltusCLIError):
     """
     Error when trying to access a method on a client that does not exist.
     """
     fmt = 'Signature version is not supported: {signature_version}'
 
 
-class NoCredentialsError(CCSCLIError):
+class NoCredentialsError(AltusCLIError):
     """
     No credentials could be found
     """
-    fmt = 'Unable to locate credentials'
+    fmt = 'Unable to locate Altus credentials'
 
 
-class UnknownCredentialError(CCSCLIError):
+class UnknownCredentialError(AltusCLIError):
     """
     Tried to insert before/after an unregistered credential type.
     """
     fmt = 'Credential named {name} not found.'
 
 
-class PartialCredentialsError(CCSCLIError):
+class PartialCredentialsError(AltusCLIError):
     """
     Only partial credentials were found.
     """
     fmt = 'Partial credentials found in {provider}, missing: {cred_var}'
 
 
-class BaseEndpointResolverError(CCSCLIError):
+class BaseEndpointResolverError(AltusCLIError):
     """
     Base error for endpoint resolving errors.
 
@@ -156,7 +156,7 @@ class NoRegionError(BaseEndpointResolverError):
     fmt = 'You must specify a region.'
 
 
-class ProfileNotFound(CCSCLIError):
+class ProfileNotFound(AltusCLIError):
     """
     The specified configuration profile was not found in the
     configuration file.
@@ -165,21 +165,21 @@ class ProfileNotFound(CCSCLIError):
     fmt = 'The config profile ({profile}) could not be found'
 
 
-class ConfigNotFound(CCSCLIError):
+class ConfigNotFound(AltusCLIError):
     """
     The specified configuration file could not be found.
     """
     fmt = 'The specified config file ({path}) could not be found.'
 
 
-class ConfigParseError(CCSCLIError):
+class ConfigParseError(AltusCLIError):
     """
     The configuration file could not be parsed.
     """
     fmt = 'Unable to parse config file: {path}'
 
 
-class ClusterTerminatingError(CCSCLIError):
+class ClusterTerminatingError(AltusCLIError):
 
     """
     The cluster is terminating or has already terminated.
@@ -187,7 +187,7 @@ class ClusterTerminatingError(CCSCLIError):
     fmt = 'Cluster {cluster_name} is terminating.'
 
 
-class ClusterStartingError(CCSCLIError):
+class ClusterStartingError(AltusCLIError):
 
     """
     The cluster is starting.
@@ -195,7 +195,7 @@ class ClusterStartingError(CCSCLIError):
     fmt = 'Cluster {cluster_name} is starting.'
 
 
-class ClusterFailedError(CCSCLIError):
+class ClusterFailedError(AltusCLIError):
 
     """
     The cluster failed to start.
@@ -203,7 +203,7 @@ class ClusterFailedError(CCSCLIError):
     fmt = 'Cluster {cluster_name} failed to start.'
 
 
-class ClusterDoesNotExistError(CCSCLIError):
+class ClusterDoesNotExistError(AltusCLIError):
 
     """
     Cluster with the given name does not exist.
@@ -211,7 +211,7 @@ class ClusterDoesNotExistError(CCSCLIError):
     fmt = 'Cluster {cluster_name} does not exist.'
 
 
-class ClusterStatusNotFound(CCSCLIError):
+class ClusterStatusNotFound(AltusCLIError):
 
     """
     Unable to find cluster status.
@@ -219,7 +219,7 @@ class ClusterStatusNotFound(CCSCLIError):
     fmt = 'Unable to find {cluster_name}\'s status.'
 
 
-class ClusterEndpointNotFound(CCSCLIError):
+class ClusterEndpointNotFound(AltusCLIError):
 
     """
     Unable to find cluster's Cloudera Manager Endpoint.
@@ -227,7 +227,7 @@ class ClusterEndpointNotFound(CCSCLIError):
     fmt = 'Unable to find {cluster_name}\'s Cloudera Manager Endpoint.'
 
 
-class MultipleClustersExist(CCSCLIError):
+class MultipleClustersExist(AltusCLIError):
 
     """
     Multiple clusters exist, expected single cluster.
@@ -235,7 +235,7 @@ class MultipleClustersExist(CCSCLIError):
     fmt = 'Multiple clusters exist, expected single cluster.'
 
 
-class SSHNotFoundError(CCSCLIError):
+class SSHNotFoundError(AltusCLIError):
 
     """
     SSH or Putty not available.
@@ -243,7 +243,7 @@ class SSHNotFoundError(CCSCLIError):
     fmt = 'SSH or Putty not available.'
 
 
-class WrongPuttyKeyError(CCSCLIError):
+class WrongPuttyKeyError(AltusCLIError):
 
     """
     A wrong key has been used with a compatible program.

+ 4 - 4
desktop/core/ext-py/navoptapi-0.1.0/ccscli/signers.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/signers.py

@@ -14,9 +14,9 @@
 # ANY KIND, either express or implied. See the License for the specific
 # language governing permissions and limitations under the License.
 
-from ccscli import UNSIGNED
-import ccscli.auth
-from ccscli.exceptions import UnknownSignatureVersionError
+from altuscli import UNSIGNED
+import altuscli.auth
+from altuscli.exceptions import UnknownSignatureVersionError
 
 
 class RequestSigner(object):
@@ -45,7 +45,7 @@ class RequestSigner(object):
         Get an auth instance which can be used to sign a request
         using the given signature version.
         """
-        cls = ccscli.auth.AUTH_TYPE_MAPS.get(signature_version)
+        cls = altuscli.auth.AUTH_TYPE_MAPS.get(signature_version)
         if cls is None:
             raise UnknownSignatureVersionError(
                 signature_version=signature_version)

+ 0 - 0
desktop/core/ext-py/navoptapi-0.1.0/ccscli/thirdparty/__init__.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/thirdparty/__init__.py


+ 0 - 0
desktop/core/ext-py/navoptapi-0.1.0/ccscli/thirdparty/six.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/thirdparty/six.py


+ 7 - 7
desktop/core/ext-py/navoptapi-0.1.0/ccscli/utils.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/utils.py

@@ -20,9 +20,9 @@ import functools
 import re
 import signal
 
-from ccscli import LIST_TYPE
-from ccscli import OBJECT_TYPE
-from ccscli.compat import OrderedDict
+from altuscli import LIST_TYPE
+from altuscli import OBJECT_TYPE
+from altuscli.compat import OrderedDict
 import dateutil.parser
 from dateutil.tz import tzlocal
 from dateutil.tz import tzutc
@@ -34,7 +34,7 @@ SAFE_CHARS = '-._~'
 def get_service_module_name(service_model):
     name = service_model.service_name
     name = name.replace('Cloudera', '')
-    name = name.replace('CCS', '')
+    name = name.replace('Altus', '')
     name = re.sub('\W+', '', name)
     return name
 
@@ -197,7 +197,7 @@ class ArgumentGenerator(object):
     """Generate sample input based on a shape model.
 
     This class contains a ``generate_skeleton`` method that will take
-    an input shape (created from ``ccscli.model``) and generate
+    an input shape (created from ``altuscli.model``) and generate
     a sample dictionary corresponding to the input shape.
 
     The specific values used are place holder values. For strings an
@@ -213,11 +213,11 @@ class ArgumentGenerator(object):
     Example usage::
 
         clidriver = CLIDriver
-        ddb = clidriver.get_service_model('mastodon')
+        ddb = clidriver.get_service_model('dataeng')
         arg_gen = ArgumentGenerator()
         sample_input = arg_gen.generate_skeleton(
             ddb.operation_model('createCluster').input_shape)
-        print("Sample input for mastodon.createCluster: %s" % sample_input)
+        print("Sample input for dataeng.createCluster: %s" % sample_input)
 
     """
     def __init__(self):

+ 3 - 3
desktop/core/ext-py/navoptapi-0.1.0/ccscli/validate.py → desktop/core/ext-py/navoptapi-0.1.0/altuscli/validate.py

@@ -17,9 +17,9 @@
 import datetime
 import decimal
 
-from ccscli.compat import six
-from ccscli.exceptions import ParamValidationError
-from ccscli.utils import parse_to_aware_datetime
+from altuscli.compat import six
+from altuscli.exceptions import ParamValidationError
+from altuscli.utils import parse_to_aware_datetime
 
 
 def validate_parameters(params, shape):

+ 0 - 81
desktop/core/ext-py/navoptapi-0.1.0/ccscli/serialize.py

@@ -1,81 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-from ccscli import validate
-from ccscli.compat import json
-from ccscli.compat import OrderedDict
-
-
-def create_serializer():
-    serializer = Serializer()
-    validator = validate.ParamValidator()
-    return validate.ParamValidationDecorator(validator, serializer)
-
-
-class Serializer(object):
-    DEFAULT_ENCODING = 'utf-8'
-
-    def serialize_to_request(self, parameters, operation_model):
-        # Don't serialize any parameter with a None value.
-        filtered_parameters = OrderedDict(
-            (k, v) for k, v in parameters.items() if v is not None)
-
-        serialized = {}
-        serialized['method'] = operation_model.http['method']
-        serialized['headers'] = {'Content-Type': 'application/json'}
-        serialized['url_path'] = operation_model.http['requestUri']
-
-        serialized_body = OrderedDict()
-        if len(filtered_parameters) != 0:
-            self._serialize(serialized_body,
-                            filtered_parameters,
-                            operation_model.input_shape)
-        serialized['body'] = json.dumps(serialized_body).encode(self.DEFAULT_ENCODING)
-
-        return serialized
-
-    def _serialize(self, serialized, value, shape, key=None):
-        serialize_method_name = '_serialize_type_%s' % shape.type_name
-        method = getattr(self, serialize_method_name, self._default_serialize)
-        method(serialized, value, shape, key)
-
-    def _serialize_type_object(self, serialized, value, shape, key):
-        if key is not None:
-            # If a key is provided, this is a result of a recursive call, so we
-            # need to add a new child dict as the value of the passed in dict.
-            # Below we will add all the structure members to the new serialized
-            # dictionary we just created.
-            serialized[key] = OrderedDict()
-            serialized = serialized[key]
-
-        for member_key, member_value in value.items():
-            member_shape = shape.members[member_key]
-            self._serialize(serialized, member_value, member_shape, member_key)
-
-    def _serialize_type_array(self, serialized, value, shape, key):
-        array_obj = []
-        serialized[key] = array_obj
-        for array_item in value:
-            wrapper = {}
-            # JSON list serialization is the only case where we aren't setting
-            # a key on a dict.  We handle this by using a __current__ key on a
-            # wrapper dict to serialize each list item before appending it to
-            # the serialized list.
-            self._serialize(wrapper, array_item, shape.member, "__current__")
-            array_obj.append(wrapper["__current__"])
-
-    def _default_serialize(self, serialized, value, shape, key):
-        serialized[key] = value

+ 3 - 3
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/__init__.py

@@ -24,7 +24,7 @@ del get_versions
 
 VERSION = __version__
 
-CCSCLI_ROOT = os.path.dirname(os.path.abspath(__file__))
+ALTUSCLI_ROOT = os.path.dirname(os.path.abspath(__file__))
 
 
 # Used to specify anonymous (unsigned) request signature
@@ -49,8 +49,8 @@ COMPLEX_TYPES = set([OBJECT_TYPE,
                      LIST_TYPE])
 
 DEFAULT_PROFILE_NAME = 'default'
-CCS_ACCESS_KEY_ID_KEY_NAME = 'ccs_access_key_id'
-CCS_PRIVATE_KEY_KEY_NAME = 'ccs_private_key'
+ALTUS_ACCESS_KEY_ID_KEY_NAME = 'altus_access_key_id'
+ALTUS_PRIVATE_KEY_KEY_NAME = 'altus_private_key'
 
 # Prepopulate the cache with special cases that don't match our regular
 # transformation.

+ 4 - 4
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/_version.py

@@ -1,5 +1,5 @@
 
-# This file was generated by 'versioneer.py' (0.17) from
+# This file was generated by 'versioneer.py' (0.18) from
 # revision-control system data, or from the parent directory name of an
 # unpacked source archive. Distribution tarballs contain a pre-generated copy
 # of this file.
@@ -8,11 +8,11 @@ import json
 
 version_json = '''
 {
- "date": "2017-03-15T10:41:50-0700",
+ "date": "2017-05-18T08:28:19-0700",
  "dirty": true,
  "error": null,
- "full-revisionid": "9db772a3329363767a2ad503a538a2e02e7f0bdc",
- "version": "0+untagged.3628.g9db772a.dirty"
+ "full-revisionid": "4b9a5db00b3f4596052e358e98692e4206045656",
+ "version": "0+untagged.4944.g4b9a5db.dirty"
 }
 '''  # END VERSION_JSON
 

+ 9 - 9
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/api_lib.py

@@ -19,9 +19,9 @@ import logging
 import os
 import platform
 
-from ccscli.auth import RSAv1Auth
-from ccscli.credentials import Credentials
-from ccscli.signers import RequestSigner
+from altuscli.auth import RSAv1Auth
+from altuscli.credentials import Credentials
+from altuscli.signers import RequestSigner
 
 from navoptapi.serialize import Serializer
 
@@ -29,7 +29,7 @@ from requests import put, Request, Session
 
 import six
 
-LOG = logging.getLogger('ccscli.navopt')
+LOG = logging.getLogger('altuscli.navopt')
 ROOT_LOGGER = logging.getLogger('')
 LOG_FORMAT = ('%(asctime)s - %(threadName)s - %(name)s - %(levelname)s - %(message)s')
 
@@ -43,17 +43,17 @@ class ApiLib(object):
         # get Credentials
         self._access_key = access_key
         self._private_key = private_key
-        self._endpoint_url = "http://" + host_name + ":8982/" + service_name + "/"
+        self._endpoint_url = "https://" + host_name + "/" + service_name + "/"
         self._service_name = service_name
         self._cred = Credentials(access_key, private_key,
                                  method='shared-credentials-file')
         self._signer = RequestSigner(RSAv1Auth.AUTH_METHOD_NAME, self._cred)
 
     def _build_user_agent_header(self):
-        return 'CCSCLI/%s Python/%s %s/%s' % (VERSION,
-                                              platform.python_version(),
-                                              platform.system(),
-                                              platform.release())
+        return 'ALTUSCLI/%s Python/%s %s/%s' % (VERSION,
+                                                platform.python_version(),
+                                                platform.system(),
+                                                platform.release())
 
     def _encode_headers(self, headers):
         # In place encoding of headers to utf-8 if they are unicode.

+ 0 - 127
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/auth.py

@@ -1,127 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-from base64 import urlsafe_b64encode
-from email.utils import formatdate
-import logging
-
-from ccscli.compat import json
-from ccscli.compat import OrderedDict
-from ccscli.compat import urlsplit
-from ccscli.exceptions import NoCredentialsError
-from Crypto.Hash import SHA256
-from Crypto.PublicKey import RSA
-from Crypto.Signature import PKCS1_v1_5
-
-
-LOG = logging.getLogger('ccscli.auth')
-
-
-class BaseSigner(object):
-    def add_auth(self, request):
-        raise NotImplementedError("add_auth")
-
-
-class RSAv1Auth(BaseSigner):
-    """
-    RSA signing with a SHA-256 hash returning a base64 encoded signature.
-    """
-    AUTH_METHOD_NAME = 'rsav1'
-
-    def __init__(self, credentials):
-        self.credentials = credentials
-
-    def sign_string(self, string_to_sign):
-        try:
-            # We expect the private key to be the an PKCS8 pem formatted string.
-            key = RSA.importKey(self.credentials.private_key)
-        except:
-            message = \
-                "Failed to import private key from: '%s'. The private key is " \
-                "corrupted or it is not in PKCS8 PEM format. The private key " \
-                "was extracted either from 'env' (environment variables), " \
-                "'shared-credentials-file' (a profile in the shared " \
-                "credential file, by default under ~/.ccs/credentials), or " \
-                "'auth-config-file' (a file containing the credentials whose " \
-                "location was supplied on the command line.)" % \
-                self.credentials.method
-            LOG.debug(message, exc_info=True)
-            raise Exception(message)
-        # We sign the hash.
-        h = SHA256.new(string_to_sign.encode('utf-8'))
-        signer = PKCS1_v1_5.new(key)
-        return urlsafe_b64encode(signer.sign(h)).strip().decode('utf-8')
-
-    def canonical_standard_headers(self, headers):
-        interesting_headers = ['content-type', 'x-ccs-date']
-        hoi = []
-        if 'x-ccs-date' in headers:
-            raise Exception("x-ccs-date found in headers!")
-        headers['x-ccs-date'] = self._get_date()
-        for ih in interesting_headers:
-            found = False
-            for key in headers:
-                lk = key.lower()
-                if headers[key] is not None and lk == ih:
-                    hoi.append(headers[key].strip())
-                    found = True
-            if not found:
-                hoi.append('')
-        return '\n'.join(hoi)
-
-    def canonical_string(self, method, split, headers):
-        cs = method.upper() + '\n'
-        cs += self.canonical_standard_headers(headers) + '\n'
-        cs += split.path + '\n'
-        cs += RSAv1Auth.AUTH_METHOD_NAME
-        return cs
-
-    def get_signature(self, method, split, headers):
-        string_to_sign = self.canonical_string(method, split, headers)
-        LOG.debug('StringToSign:\n%s', string_to_sign)
-        return self.sign_string(string_to_sign)
-
-    def add_auth(self, request):
-        if self.credentials is None:
-            raise NoCredentialsError
-        LOG.debug("Calculating signature using RSAv1Auth.")
-        LOG.debug('HTTP request method: %s', request.method)
-        split = urlsplit(request.url)
-        signature = self.get_signature(request.method,
-                                       split,
-                                       request.headers)
-        self._inject_signature(request, signature)
-
-    def _get_date(self):
-        return formatdate(usegmt=True)
-
-    def _inject_signature(self, request, signature):
-        if 'x-ccs-auth' in request.headers:
-            raise Exception("x-ccs-auth found in headers!")
-        request.headers['x-ccs-auth'] = self._get_signature_header(signature)
-
-    def _get_signature_header(self, signature):
-        auth_params = OrderedDict()
-        auth_params['access_key_id'] = self.credentials.access_key_id
-        auth_params['auth_method'] = RSAv1Auth.AUTH_METHOD_NAME
-        encoded_auth_params = json.dumps(auth_params).encode('utf-8')
-        return "%s.%s" % (
-            urlsafe_b64encode(encoded_auth_params).strip().decode('utf-8'),
-            signature)
-
-
-AUTH_TYPE_MAPS = {
-    RSAv1Auth.AUTH_METHOD_NAME: RSAv1Auth,
-}

+ 0 - 165
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/compat.py

@@ -1,165 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-import copy
-import sys
-
-from ccscli.thirdparty import six  # noqa
-
-if six.PY3:
-    from base64 import encodebytes  # noqa
-    from email.utils import formatdate  # noqa
-    from http.client import HTTPResponse  # noqa
-    import locale
-    from six.moves import http_client
-    from urllib.parse import urlsplit  # noqa
-    from urllib.parse import urlunsplit  # noqa
-
-    raw_input = input
-
-    class HTTPHeaders(http_client.HTTPMessage):
-        pass
-
-    def get_stdout_text_writer():
-        return sys.stdout
-
-    def ensure_unicode(s, encoding=None, errors=None):
-        # NOOP in Python 3, because every string is already unicode
-        return s
-
-    def compat_open(filename, mode='r', encoding=None):
-        """Back-port open() that accepts an encoding argument.
-
-        In python3 this uses the built in open() and in python2 this
-        uses the io.open() function.
-
-        If the file is not being opened in binary mode, then we'll
-        use locale.getpreferredencoding() to find the preferred
-        encoding.
-
-        """
-        if 'b' not in mode:
-            encoding = locale.getpreferredencoding()
-        return open(filename, mode, encoding=encoding)
-
-else:
-    from base64 import encodestring as encodebytes  # noqa
-    import codecs
-    from email.message import Message
-    from email.Utils import formatdate  # noqa
-    from httplib import HTTPResponse  # noqa
-    import io
-    import locale
-    from urlparse import urlsplit  # noqa
-    from urlparse import urlunsplit  # noqa
-
-    raw_input = raw_input
-
-    class HTTPHeaders(Message):
-
-        # The __iter__ method is not available in python2.x, so we have
-        # to port the py3 version.
-        def __iter__(self):
-            for field, value in self._headers:
-                yield field
-
-    def get_stdout_text_writer():
-        # In python3, all the sys.stdout/sys.stderr streams are in text
-        # mode.  This means they expect unicode, and will encode the
-        # unicode automatically before actually writing to stdout/stderr.
-        # In python2, that's not the case.  In order to provide a consistent
-        # interface, we can create a wrapper around sys.stdout that will take
-        # unicode, and automatically encode it to the preferred encoding.
-        # That way consumers can just call get_stdout_text_writer() and write
-        # unicode to the returned stream.  Note that get_stdout_text_writer
-        # just returns sys.stdout in the PY3 section above because python3
-        # handles this.
-        return codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
-
-    def ensure_unicode(s, encoding='utf-8', errors='strict'):
-        if isinstance(s, six.text_type):
-            return s
-        return unicode(s, encoding, errors)
-
-    def compat_open(filename, mode='r', encoding=None):
-        # See docstring for compat_open in the PY3 section above.
-        if 'b' not in mode:
-            encoding = locale.getpreferredencoding()
-        return io.open(filename, mode, encoding=encoding)
-
-try:
-    from collections import OrderedDict
-except ImportError:
-    from ordereddict import OrderedDict  # noqa
-
-if sys.version_info[:2] == (2, 6):
-    import simplejson as json
-else:
-    import json  # noqa
-
-
-@classmethod
-def from_dict(cls, d):
-    new_instance = cls()
-    for key, value in d.items():
-        new_instance[key] = value
-    return new_instance
-
-
-@classmethod
-def from_pairs(cls, pairs):
-    new_instance = cls()
-    for key, value in pairs:
-        new_instance[key] = value
-    return new_instance
-
-
-HTTPHeaders.from_dict = from_dict
-HTTPHeaders.from_pairs = from_pairs
-
-
-def copy_kwargs(kwargs):
-    """
-    There is a bug in Python versions < 2.6.5 that prevents you from passing
-    unicode keyword args (#4978).  This function takes a dictionary of kwargs and
-    returns a copy.  If you are using Python < 2.6.5, it also encodes the keys to
-    avoid this bug. Oh, and version_info wasn't a namedtuple back then, either!
-    """
-    vi = sys.version_info
-    if vi[0] == 2 and vi[1] <= 6 and vi[3] < 5:
-        copy_kwargs = {}
-        for key in kwargs:
-            copy_kwargs[key.encode('utf-8')] = kwargs[key]
-    else:
-        copy_kwargs = copy.copy(kwargs)
-    return copy_kwargs
-
-
-def compat_input(prompt):
-    """
-    Cygwin's pty's are based on pipes. Therefore, when it interacts with a Win32
-    program (such as Win32 python), what that program sees is a pipe instead of
-    a console. This is important because python buffers pipes, and so on a
-    pty-based terminal, text will not necessarily appear immediately. In most
-    cases, this isn't a big deal. But when we're doing an interactive prompt,
-    the result is that the prompts won't display until we fill the buffer. Since
-    raw_input does not flush the prompt, we need to manually write and flush it.
-
-    See https://github.com/mintty/mintty/issues/56 for more details.
-    """
-    sys.stdout.write(prompt)
-    sys.stdout.flush()
-    return raw_input()

+ 0 - 293
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/credentials.py

@@ -1,293 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-from collections import namedtuple
-import logging
-import os
-
-from ccscli import CCS_ACCESS_KEY_ID_KEY_NAME, CCS_PRIVATE_KEY_KEY_NAME
-import ccscli.compat
-from ccscli.compat import json
-from ccscli.configloader import raw_config_parse
-from ccscli.exceptions import ConfigNotFound
-from ccscli.exceptions import NoCredentialsError
-from ccscli.exceptions import PartialCredentialsError
-from ccscli.exceptions import UnknownCredentialError
-
-LOG = logging.getLogger('ccscli.credentials')
-ReadOnlyCredentials = namedtuple('ReadOnlyCredentials',
-                                 ['access_key_id', 'private_key', 'method'])
-ACCESS_KEY_ID = 'access_key_id'
-PRIVATE_KEY = 'private_key'
-
-
-def create_credential_resolver(context):
-    """Create a default credential resolver.
-
-    This creates a pre-configured credential resolver
-    that includes the default lookup chain for
-    credentials.
-    """
-    profile_name = context.effective_profile
-    auth_file = context.get_config_variable('auth_config')
-    shared_credential_file = context.get_config_variable('credentials_file')
-
-    env_provider = EnvProvider()
-    providers = [
-        env_provider,
-        AuthConfigFile(auth_file),
-        SharedCredentialProvider(
-            creds_filename=shared_credential_file,
-            profile_name=profile_name
-        ),
-    ]
-
-    explicit_profile = context.get_config_variable('profile',
-                                                   methods=('instance',))
-    if explicit_profile is not None:
-        # An explicitly provided profile will negate an EnvProvider.
-        # We will defer to providers that understand the "profile"
-        # concept to retrieve credentials.
-        # The one edge case is if all three values are provided via
-        # env vars:
-        # export CCS_ACCESS_KEY_ID=foo
-        # export CCS_PRIVATE_KEY=bar
-        # export CCS_PROFILE=baz
-        # Then, just like our client() calls, the explicit credentials
-        # will take precedence.
-        #
-        # This precedence is enforced by leaving the EnvProvider in the chain.
-        # This means that the only way a "profile" would win is if the
-        # EnvProvider does not return credentials, which is what we want
-        # in this scenario.
-        providers.remove(env_provider)
-        LOG.debug('Skipping environment variable credential check because '
-                  'profile name was explicitly set.')
-
-    resolver = CredentialResolver(providers=providers)
-    return resolver
-
-
-def get_credentials(context):
-    resolver = create_credential_resolver(context)
-    return resolver.load_credentials()
-
-
-class Credentials(object):
-    """
-    Holds the credentials needed to authenticate requests.
-    """
-
-    def __init__(self, access_key_id, private_key, method):
-        self.access_key_id = access_key_id
-        self.private_key = private_key
-        self.method = method
-        self._normalize()
-
-    def _normalize(self):
-        self.access_key_id = ccscli.compat.ensure_unicode(self.access_key_id)
-        self.private_key = ccscli.compat.ensure_unicode(self.private_key)
-
-    def get_frozen_credentials(self):
-        return ReadOnlyCredentials(self.access_key_id,
-                                   self.private_key,
-                                   self.method)
-
-
-class CredentialProvider(object):
-
-    # Implementations must provide a method.
-    METHOD = None
-
-    def load(self):
-        return True
-
-    def _extract_creds_from_mapping(self, mapping, *key_names):
-        found = []
-        for key_name in key_names:
-            try:
-                found.append(mapping[key_name])
-            except KeyError:
-                raise PartialCredentialsError(provider=self.METHOD,
-                                              cred_var=key_name)
-        return found
-
-
-class EnvProvider(CredentialProvider):
-    METHOD = 'env'
-    ACCESS_KEY_ID_ENV_VAR = 'CCS_ACCESS_KEY_ID'
-    PRIVATE_KEY_ENV_VAR = 'CCS_PRIVATE_KEY'
-
-    def __init__(self, environ=None, mapping=None):
-        super(EnvProvider, self).__init__()
-        if environ is None:
-            environ = os.environ
-        self.environ = environ
-        self._mapping = self._build_mapping(mapping)
-
-    def _build_mapping(self, mapping):
-        # Mapping of variable name to env var name.
-        var_mapping = {}
-        if mapping is None:
-            # Use the class var default.
-            var_mapping[ACCESS_KEY_ID] = self.ACCESS_KEY_ID_ENV_VAR
-            var_mapping[PRIVATE_KEY] = self.PRIVATE_KEY_ENV_VAR
-        else:
-            var_mapping[ACCESS_KEY_ID] = mapping.get(
-                ACCESS_KEY_ID, self.ACCESS_KEY_ID_ENV_VAR)
-            var_mapping[PRIVATE_KEY] = mapping.get(
-                PRIVATE_KEY, self.PRIVATE_KEY_ENV_VAR)
-        return var_mapping
-
-    def load(self):
-        """
-        Search for credentials in explicit environment variables.
-        """
-        if self._mapping[ACCESS_KEY_ID] in self.environ:
-            access_key_id, private_key = self._extract_creds_from_mapping(
-                self.environ, self._mapping[ACCESS_KEY_ID],
-                self._mapping[PRIVATE_KEY])
-            LOG.info('Found credentials in environment variables.')
-            if not os.path.isfile(private_key):
-                LOG.debug("Private key at %s does not exist!" % private_key)
-                raise NoCredentialsError()
-            pem = open(private_key).read()
-            return Credentials(access_key_id, pem, method=self.METHOD)
-        else:
-            return None
-
-
-class CredentialResolver(object):
-
-    def __init__(self, providers):
-        self.providers = providers
-
-    def insert_before(self, name, credential_provider):
-        """
-        Inserts a new instance of ``CredentialProvider`` into the chain that will
-        be tried before an existing one.
-        """
-        try:
-            offset = [p.METHOD for p in self.providers].index(name)
-        except ValueError:
-            raise UnknownCredentialError(name=name)
-        self.providers.insert(offset, credential_provider)
-
-    def insert_after(self, name, credential_provider):
-        """
-        Inserts a new type of ``Credentials`` instance into the chain that will
-        be tried after an existing one.
-        """
-        offset = self._get_provider_offset(name)
-        self.providers.insert(offset + 1, credential_provider)
-
-    def remove(self, name):
-        """
-        Removes a given ``Credentials`` instance from the chain.
-        """
-        available_methods = [p.METHOD for p in self.providers]
-        if name not in available_methods:
-            # It's not present. Fail silently.
-            return
-
-        offset = available_methods.index(name)
-        self.providers.pop(offset)
-
-    def get_provider(self, name):
-        """
-        Return a credential provider by name.
-        """
-        return self.providers[self._get_provider_offset(name)]
-
-    def _get_provider_offset(self, name):
-        try:
-            return [p.METHOD for p in self.providers].index(name)
-        except ValueError:
-            raise UnknownCredentialError(name=name)
-
-    def load_credentials(self):
-        """
-        Goes through the credentials chain, returning the first ``Credentials``
-        that could be loaded.
-        """
-        # First provider to return a non-None response wins.
-        for provider in self.providers:
-            LOG.debug("Looking for credentials via: %s", provider.METHOD)
-            creds = provider.load()
-            if creds is not None:
-                return creds
-
-        raise NoCredentialsError()
-
-
-class AuthConfigFile(CredentialProvider):
-    METHOD = 'auth_config_file'
-
-    def __init__(self, conf):
-        super(AuthConfigFile, self).__init__()
-        self._conf = conf
-
-    def load(self):
-        """
-        load the credential from the json configuration file.
-        """
-        if self._conf is None:
-            return None
-
-        if not os.path.isfile(self._conf):
-            LOG.debug("Conf file at %s does not exist!" % self._conf)
-            raise NoCredentialsError()
-        try:
-            conf = json.loads(open(self._conf).read())
-        except Exception:
-            LOG.debug("Could not read conf: %s", exc_info=True)
-            return None
-
-        if ACCESS_KEY_ID in conf:
-            LOG.debug('Found credentials for key: %s in configuration file.',
-                      conf[ACCESS_KEY_ID])
-            access_key_id, private_key = self._extract_creds_from_mapping(
-                conf,
-                ACCESS_KEY_ID,
-                PRIVATE_KEY)
-            return Credentials(access_key_id, private_key, self.METHOD)
-        raise NoCredentialsError()
-
-
-class SharedCredentialProvider(CredentialProvider):
-    METHOD = 'shared-credentials-file'
-
-    def __init__(self, creds_filename, profile_name):
-        self._creds_filename = creds_filename
-        self._profile_name = profile_name
-
-    def load(self):
-        try:
-            available_creds = raw_config_parse(self._creds_filename)
-        except ConfigNotFound:
-            return None
-        if self._profile_name in available_creds:
-            config = available_creds[self._profile_name]
-            access_key_id, private_key = self._extract_creds_from_mapping(
-                config, CCS_ACCESS_KEY_ID_KEY_NAME, CCS_PRIVATE_KEY_KEY_NAME)
-            # We store the private key in the credentials file as a one-line
-            # value in which the newlines in the PEM file are replaced with
-            # '\n'. We need to replace them back as the RawConfigParser we use
-            # does not do it for us. Note that if the value in the configuration
-            # IS a PEM formatted value this is a no-op.
-            private_key = private_key.replace('\\n', '\n')
-            LOG.info("Found credentials in shared credentials file: %s",
-                     self._creds_filename)
-            return Credentials(access_key_id, private_key, method=self.METHOD)

+ 0 - 130
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_auth.py

@@ -1,130 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-from base64 import urlsafe_b64encode
-try:
-    from collections import OrderedDict
-except ImportError:
-    from ordereddict import OrderedDict   # Python 2.6
-from email.utils import formatdate
-import json
-import logging
-
-from urlparse import urlsplit
-
-from Crypto.Hash import SHA256
-from Crypto.PublicKey import RSA
-from Crypto.Signature import PKCS1_v1_5
-
-
-LOG = logging.getLogger('ccscli.auth')
-
-
-class BaseSigner(object):
-    def add_auth(self, request):
-        raise NotImplementedError("add_auth")
-
-
-class RSAv1Auth(BaseSigner):
-    """
-    RSA signing with a SHA-256 hash returning a base64 encoded signature.
-    """
-    AUTH_METHOD_NAME = 'rsav1'
-
-    def __init__(self, credentials):
-        self.credentials = credentials
-
-    def sign_string(self, string_to_sign):
-        try:
-            # We expect the private key to be the an PKCS8 pem formatted string.
-            key = RSA.importKey(self.credentials.private_key)
-        except:
-            message = \
-                "Failed to import private key from: '%s'. The private key is " \
-                "corrupted or it is not in PKCS8 PEM format. The private key " \
-                "was extracted either from 'env' (environment variables), " \
-                "'shared-credentials-file' (a profile in the shared " \
-                "credential file, by default under ~/.ccs/credentials), or " \
-                "'auth-config-file' (a file containing the credentials whose " \
-                "location was supplied on the command line.)" % \
-                self.credentials.method
-            LOG.debug(message, exc_info=True)
-            raise Exception(message)
-        # We sign the hash.
-        h = SHA256.new(string_to_sign.encode('utf-8'))
-        signer = PKCS1_v1_5.new(key)
-        return urlsafe_b64encode(signer.sign(h)).strip().decode('utf-8')
-
-    def canonical_standard_headers(self, headers):
-        interesting_headers = ['content-type', 'x-ccs-date']
-        hoi = []
-        if 'x-ccs-date' in headers:
-            raise Exception("x-ccs-date found in headers!")
-        headers['x-ccs-date'] = self._get_date()
-        for ih in interesting_headers:
-            found = False
-            for key in headers:
-                lk = key.lower()
-                if headers[key] is not None and lk == ih:
-                    hoi.append(headers[key].strip())
-                    found = True
-            if not found:
-                hoi.append('')
-        return '\n'.join(hoi)
-
-    def canonical_string(self, method, split, headers):
-        cs = method.upper() + '\n'
-        cs += self.canonical_standard_headers(headers) + '\n'
-        cs += split.path + '\n'
-        cs += RSAv1Auth.AUTH_METHOD_NAME
-        return cs
-
-    def get_signature(self, method, split, headers):
-        string_to_sign = self.canonical_string(method, split, headers)
-        LOG.debug('StringToSign:\n%s', string_to_sign)
-        return self.sign_string(string_to_sign)
-
-    def add_auth(self, request):
-        if self.credentials is None:
-            return
-        LOG.debug("Calculating signature using RSAv1Auth.")
-        LOG.debug('HTTP request method: %s', request.method)
-        split = urlsplit(request.url)
-        signature = self.get_signature(request.method,
-                                       split,
-                                       request.headers)
-        self._inject_signature(request, signature)
-
-    def _get_date(self):
-        return formatdate(usegmt=True)
-
-    def _inject_signature(self, request, signature):
-        if 'x-ccs-auth' in request.headers:
-            raise Exception("x-ccs-auth found in headers!")
-        request.headers['x-ccs-auth'] = self._get_signature_header(signature)
-
-    def _get_signature_header(self, signature):
-        auth_params = OrderedDict()
-        auth_params['access_key_id'] = self.credentials.access_key_id
-        auth_params['auth_method'] = RSAv1Auth.AUTH_METHOD_NAME
-        encoded_auth_params = json.dumps(auth_params).encode('utf-8')
-        return "%s.%s" % (
-            urlsafe_b64encode(encoded_auth_params).strip().decode('utf-8'),
-            signature)
-
-
-AUTH_TYPE_MAPS = {
-    RSAv1Auth.AUTH_METHOD_NAME: RSAv1Auth,
-}

+ 0 - 48
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_credentials.py

@@ -1,48 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-from collections import namedtuple
-
-import six
-
-ReadOnlyCredentials = namedtuple('ReadOnlyCredentials',
-                                 ['access_key_id', 'private_key', 'method'])
-
-
-class Credentials(object):
-    """
-    Holds the credentials needed to authenticate requests.
-    """
-
-    def __init__(self, access_key_id, private_key, method):
-        self.access_key_id = access_key_id
-        self.private_key = private_key
-        self.method = method
-        self._normalize()
-
-    def ensure_unicode(self, s, encoding='utf-8', errors='strict'):
-        if isinstance(s, six.text_type):
-            return s
-        return unicode(s, encoding, errors)
-
-    def _normalize(self):
-        self.access_key_id = self.ensure_unicode(self.access_key_id)
-        self.private_key = self.ensure_unicode(self.private_key)
-
-    def get_frozen_credentials(self):
-        return ReadOnlyCredentials(self.access_key_id,
-                                   self.private_key,
-                                   self.method)

+ 0 - 80
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_serialize.py

@@ -1,80 +0,0 @@
-# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-#     http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-try:
-    from collections import OrderedDict
-except ImportError:
-    from ordereddict import OrderedDict  # Python 2.6
-import json
-
-
-class Serializer(object):
-    DEFAULT_ENCODING = 'utf-8'
-
-    def serialize_to_request(self, parameters, operation_model):
-        # Don't serialize any parameter with a None value.
-        filtered_parameters = OrderedDict(
-            (k, v) for k, v in parameters.items() if v is not None)
-
-        serialized = {}
-        # serialized['method'] = operation_model.http['method']
-        # serialized['headers'] = {'Content-Type': 'application/json'}
-        # serialized['url_path'] = operation_model.http['requestUri']
-
-        serialized_body = OrderedDict()
-        if len(filtered_parameters) != 0:
-            self._serialize(serialized_body, filtered_parameters, None)
-
-        serialized['body'] = json.dumps(serialized_body).encode(self.DEFAULT_ENCODING)
-
-        return serialized
-
-    def _serialize(self, serialized, value, shape, key=None):
-        # serialize_method_name = '_serialize_type_%s' % shape.type_name
-        # method = getattr(self, serialize_method_name, self._default_serialize)
-        self._default_serialize(serialized, value, shape, key)
-
-    def _serialize_type_object(self, serialized, value, shape, key):
-        if key is not None:
-            # If a key is provided, this is a result of a recursive call, so we
-            # need to add a new child dict as the value of the passed in dict.
-            # Below we will add all the structure members to the new serialized
-            # dictionary we just created.
-            serialized[key] = OrderedDict()
-            serialized = serialized[key]
-
-        for member_key, member_value in value.items():
-            member_shape = shape.members[member_key]
-            self._serialize(serialized, member_value, member_shape, member_key)
-
-    def _serialize_type_array(self, serialized, value, shape, key):
-        array_obj = []
-        serialized[key] = array_obj
-        for array_item in value:
-            wrapper = {}
-            # JSON list serialization is the only case where we aren't setting
-            # a key on a dict.  We handle this by using a __current__ key on a
-            # wrapper dict to serialize each list item before appending it to
-            # the serialized list.
-            self._serialize(wrapper, array_item, shape.member, "__current__")
-            array_obj.append(wrapper["__current__"])
-
-    def _default_serialize(self, serialized, value, shape, key):
-        if key:
-            serialized[key] = value
-        else:
-            for member_key, member_value in value.items():
-                serialized[member_key] = member_value

+ 0 - 58
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/old_signers.py

@@ -1,58 +0,0 @@
-# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-# http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-import navoptapi.auth
-
-UNSIGNED = object()
-
-
-class RequestSigner(object):
-    """
-    An object to sign requests before they go out over the wire using
-    one of the authentication mechanisms defined in ``auth.py``.
-    """
-    def __init__(self, signature_version, credentials):
-        self._signature_version = signature_version
-        self._credentials = credentials
-
-    @property
-    def signature_version(self):
-        return self._signature_version
-
-    def sign(self, request):
-        """
-        Sign a request before it goes out over the wire.
-        """
-        if self._signature_version != UNSIGNED:
-            signer = self.get_auth_instance(self._signature_version)
-            signer.add_auth(request)
-
-    def get_auth_instance(self, signature_version, **kwargs):
-        """
-        Get an auth instance which can be used to sign a request
-        using the given signature version.
-        """
-        cls = navoptapi.auth.AUTH_TYPE_MAPS.get(signature_version)
-        if cls is None:
-            return
-        # If there's no credentials provided (i.e credentials is None),
-        # then we'll pass a value of "None" over to the auth classes,
-        # which already handle the cases where no credentials have
-        # been provided.
-        frozen_credentials = self._credentials.get_frozen_credentials()
-        kwargs['credentials'] = frozen_credentials
-        auth = cls(**kwargs)
-        return auth

+ 0 - 59
desktop/core/ext-py/navoptapi-0.1.0/navoptapi/signers.py

@@ -1,59 +0,0 @@
-# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-#
-# Modifications made by Cloudera are:
-#     Copyright (c) 2016 Cloudera, Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"). You
-# may not use this file except in compliance with the License. A copy of
-# the License is located at
-#
-# http://aws.amazon.com/apache2.0/
-#
-# or in the "license" file accompanying this file. This file is
-# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
-# ANY KIND, either express or implied. See the License for the specific
-# language governing permissions and limitations under the License.
-
-from ccscli import UNSIGNED
-import ccscli.auth
-from ccscli.exceptions import UnknownSignatureVersionError
-
-
-class RequestSigner(object):
-    """
-    An object to sign requests before they go out over the wire using
-    one of the authentication mechanisms defined in ``auth.py``.
-    """
-    def __init__(self, signature_version, credentials):
-        self._signature_version = signature_version
-        self._credentials = credentials
-
-    @property
-    def signature_version(self):
-        return self._signature_version
-
-    def sign(self, request):
-        """
-        Sign a request before it goes out over the wire.
-        """
-        if self._signature_version != UNSIGNED:
-            signer = self.get_auth_instance(self._signature_version)
-            signer.add_auth(request)
-
-    def get_auth_instance(self, signature_version, **kwargs):
-        """
-        Get an auth instance which can be used to sign a request
-        using the given signature version.
-        """
-        cls = ccscli.auth.AUTH_TYPE_MAPS.get(signature_version)
-        if cls is None:
-            raise UnknownSignatureVersionError(
-                signature_version=signature_version)
-        # If there's no credentials provided (i.e credentials is None),
-        # then we'll pass a value of "None" over to the auth classes,
-        # which already handle the cases where no credentials have
-        # been provided.
-        frozen_credentials = self._credentials.get_frozen_credentials()
-        kwargs['credentials'] = frozen_credentials
-        auth = cls(**kwargs)
-        return auth

+ 1 - 1
desktop/core/ext-py/navoptapi-0.1.0/setup.cfg

@@ -1,7 +1,7 @@
 [flake8]
 max-line-length = 90
 import-order-style = google
-exclude = ccscli/thirdparty/*
+exclude = altuscli/thirdparty/*
 
 [versioneer]
 vcs = git

+ 0 - 1
desktop/core/ext-py/navoptapi-0.1.0/setup.py

@@ -20,7 +20,6 @@ requirements = ["python-dateutil>=2.1,<3.0.0",
                 "asn1crypto>=0.21.1",
                 "rsa>=3.4.2",
                 "colorama>=0.2.5,<=0.3.3",
-                "pycrypto>=2.6.1",
                 "requests>=2.9.1"]
 if sys.version_info[:2] == (2, 6):
     requirements.append("argparse>=1.1")

+ 6 - 6
desktop/core/ext-py/navoptapi-0.1.0/versioneer.py

@@ -1,5 +1,5 @@
 
-# Version: 0.17
+# Version: 0.18
 
 """The Versioneer - like a rocketeer, but for versions.
 
@@ -10,7 +10,7 @@ The Versioneer
 * https://github.com/warner/python-versioneer
 * Brian Warner
 * License: Public Domain
-* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and pypy
+* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy
 * [![Latest Version]
 (https://pypip.in/version/versioneer/badge.svg?style=flat)
 ](https://pypi.python.org/pypi/versioneer/)
@@ -151,8 +151,8 @@ that this commit is two revisions ("+2") beyond the "0.11" tag. For released
 software (exactly equal to a known tag), the identifier will only contain the
 stripped tag, e.g. "0.11".
 
-Other styles are available. See details.md in the Versioneer source tree for
-descriptions.
+Other styles are available. See [details.md](details.md) in the Versioneer
+source tree for descriptions.
 
 ## Debugging
 
@@ -426,7 +426,7 @@ LONG_VERSION_PY['git'] = '''
 # that just contains the computed version number.
 
 # This file is released into the public domain. Generated by
-# versioneer-0.17 (https://github.com/warner/python-versioneer)
+# versioneer-0.18 (https://github.com/warner/python-versioneer)
 
 """Git implementation of _version.py."""
 
@@ -1181,7 +1181,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
 
 
 SHORT_VERSION_PY = """
-# This file was generated by 'versioneer.py' (0.17) from
+# This file was generated by 'versioneer.py' (0.18) from
 # revision-control system data, or from the parent directory name of an
 # unpacked source archive. Distribution tarballs contain a pre-generated copy
 # of this file.