Package cm_api :: Package endpoints :: Module types
[hide private]
[frames] | no frames]

Module types

source code

Classes [hide private]
  Attr
Encapsulates information about an attribute in the JSON encoding of the object.
  ROAttr
Subclass that just defines the attribute as read-only.
  BaseApiObject
The BaseApiObject helps with (de)serialization from/to JSON.
  BaseApiResource
A specialization of BaseApiObject that provides some utility methods for resources.
  ApiList
A list of some api object
  ApiHostRef
  ApiServiceRef
  ApiClusterRef
  ApiRoleRef
  ApiRoleConfigGroupRef
  ApiCommand
  ApiBulkCommandList
  ApiCommandMetadata
  ApiMetricData
Metric reading data.
  ApiMetric
Metric information.
  ApiActivity
  ApiCmPeer
  ApiLicensedFeatureUsage
  ApiHdfsReplicationArguments
  ApiHdfsCloudReplicationArguments
  ApiHdfsReplicationResult
  ApiHiveTable
  ApiImpalaUDF
  ApiHiveUDF
  ApiHiveReplicationArguments
  ApiHiveReplicationResult
  ApiReplicationCommand
  ApiReplicationSchedule
  ApiHBaseSnapshotPolicyArguments
  ApiHdfsSnapshotPolicyArguments
  ApiHBaseSnapshot
  ApiHBaseSnapshotError
  ApiHdfsSnapshot
  ApiHdfsSnapshotError
  ApiHBaseSnapshotResult
  ApiHdfsSnapshotResult
  ApiSnapshotCommand
  ApiSnapshotPolicy
  ApiBatchRequestElement
One element in a batch request.
  ApiBatchResponseElement
One element in a batch response.
  ApiBatchResponseList
A list of batch response objects.
  ApiConfig
  ApiImpalaQuery
  ApiWatchedDir
  ApiWatchedDirList
  ApiImpalaQueryResponse
  ApiImpalaQueryDetailsResponse
  ApiImpalaCancelResponse
  ApiImpalaQueryAttribute
  ApiMr2AppInformation
  ApiYarnApplication
  ApiYarnApplicationResponse
  ApiYarnKillResponse
  ApiYarnApplicationAttribute
  ApiTimeSeriesRequest
  ApiProductVersion
  ApiClusterTemplateConfig
  ApiClusterTemplateRoleConfigGroup
  ApiClusterTemplateRole
  ApiClusterTemplateHostTemplate
  ApiClusterTemplateHostInfo
  ApiClusterTemplateVariable
  ApiClusterTemplateRoleConfigGroupInfo
  ApiClusterTemplateInstantiator
  ApiClusterTemplateService
  ApiClusterTemplate
Functions [hide private]
 
check_api_version(resource_root, min_version)
Checks if the resource_root's API version it at least the given minimum version.
source code
 
call(method, path, ret_type, ret_is_list=False, data=None, params=None, api_version=1)
Generic function for calling a resource method and automatically dealing with serialization of parameters and deserialization of return values.
source code
 
config_to_api_list(dic)
Converts a python dictionary into a list containing the proper ApiConfig encoding for configuration data.
source code
 
config_to_json(dic)
Converts a python dictionary into a JSON payload.
source code
 
json_to_config(dic, full=False)
Converts a JSON-decoded config dictionary to a python dictionary.
source code
Variables [hide private]
  __package__ = 'cm_api.endpoints'
Function Details [hide private]

call(method, path, ret_type, ret_is_list=False, data=None, params=None, api_version=1)

source code 

Generic function for calling a resource method and automatically dealing with serialization of parameters and deserialization of return values.

Parameters:
  • method - method to call (must be bound to a resource; e.g., "resource_root.get").
  • path - the full path of the API method to call.
  • ret_type - return type of the call.
  • ret_is_list - whether the return type is an ApiList.
  • data - Optional data to send as payload to the call.
  • params - Optional query parameters for the call.
  • api_version - minimum API version for the call.

config_to_api_list(dic)

source code 

Converts a python dictionary into a list containing the proper ApiConfig encoding for configuration data.

Parameters:
  • dic - Key-value pairs to convert.
Returns:
JSON dictionary of an ApiConfig list (*not* an ApiList).

config_to_json(dic)

source code 

Converts a python dictionary into a JSON payload.

The payload matches the expected "apiConfig list" type used to update configuration parameters using the API.

Parameters:
  • dic - Key-value pairs to convert.
Returns:
String with the JSON-encoded data.

json_to_config(dic, full=False)

source code 

Converts a JSON-decoded config dictionary to a python dictionary.

When materializing the full view, the values in the dictionary will be instances of ApiConfig, instead of strings.

Parameters:
  • dic - JSON-decoded config dictionary.
  • full - Whether to materialize the full view of the config data.
Returns:
Python dictionary with config data.