# cm_client.CommandsResourceApi

All URIs are relative to */api/v57*

Method | HTTP request | Description
------------- | ------------- | -------------
[**abort_command**](CommandsResourceApi.md#abort_command) | **POST** /commands/{commandId}/abort | Abort a running command.
[**find_command_by_correlation_id**](CommandsResourceApi.md#find_command_by_correlation_id) | **GET** /commands/commandByCorrelationId/{correlationId} | Retrieve command by the correlation ID that was provided at command creation.
[**get_command_result_data**](CommandsResourceApi.md#get_command_result_data) | **GET** /commands/{commandId}/download | Download the end result of a command.
[**get_command_with_steps**](CommandsResourceApi.md#get_command_with_steps) | **GET** /commands/{commandId}/steps | Retrieve detailed information of an asynchronous command including the command steps.
[**get_standard_error**](CommandsResourceApi.md#get_standard_error) | **GET** /commands/{commandId}/logs/stderr | Download a zip-compressed archive of standard error outputs for the command&#x27;s one-off processes.
[**get_standard_output**](CommandsResourceApi.md#get_standard_output) | **GET** /commands/{commandId}/logs/stdout | Download a zip-compressed archive of standard outputs for the command&#x27;s one-off processes.
[**read_command**](CommandsResourceApi.md#read_command) | **GET** /commands/{commandId} | Retrieve detailed information on an asynchronous command.
[**read_commands**](CommandsResourceApi.md#read_commands) | **GET** /commands/commands | Retrieve detailed information on all recent commands.
[**replication_report**](CommandsResourceApi.md#replication_report) | **GET** /commands/{commandId}/replicationReport | Get the replication report CSV files.
[**retry**](CommandsResourceApi.md#retry) | **POST** /commands/{commandId}/retry | Try to rerun a command.

<a name="abort_command" id="abort_command"></a>
# **abort_command**
> ApiCommand abort_command(command_id)

Abort a running command.

Abort a running command.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Abort a running command.
    api_response = api_instance.abort_command(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->abort_command: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="find_command_by_correlation_id" id="find_command_by_correlation_id"></a>
# **find_command_by_correlation_id**
> ApiCommand find_command_by_correlation_id(correlation_id, start_time=start_time)

Retrieve command by the correlation ID that was provided at command creation.

Retrieve command by the correlation ID that was provided at command creation. Used to recover command references when the command ID is not available.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
correlation_id = 'correlation_id_example' # str | Correlation ID provided at command creation
start_time = 56 # int | Timestamp from which the command was started (optional)

try:
    # Retrieve command by the correlation ID that was provided at command creation.
    api_response = api_instance.find_command_by_correlation_id(correlation_id, start_time=start_time)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->find_command_by_correlation_id: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **correlation_id** | **str**| Correlation ID provided at command creation | 
 **start_time** | **int**| Timestamp from which the command was started | [optional] 

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="get_command_result_data" id="get_command_result_data"></a>
# **get_command_result_data**
> str get_command_result_data(command_id)

Download the end result of a command.

Download the end result of a command.  Content-Type header is explicitly set in the implementation instead of using annotation. In case the MIME type is not set for the command result, application/octet-stream is set.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Download the end result of a command.
    api_response = api_instance.get_command_result_data(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->get_command_result_data: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

**str**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="get_command_with_steps" id="get_command_with_steps"></a>
# **get_command_with_steps**
> ApiCommandWithSteps get_command_with_steps(command_id)

Retrieve detailed information of an asynchronous command including the command steps.

Retrieve detailed information of an asynchronous command including the command steps.  <p>Cloudera Manager keeps the results and statuses of asynchronous commands, which have non-negative command IDs. On the other hand, synchronous commands complete immediately, and their results are passed back in the return object of the command execution API call. Outside of that return object, there is no way to check the result of a synchronous command.</p>

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Retrieve detailed information of an asynchronous command including the command steps.
    api_response = api_instance.get_command_with_steps(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->get_command_with_steps: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

[**ApiCommandWithSteps**](ApiCommandWithSteps.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="get_standard_error" id="get_standard_error"></a>
# **get_standard_error**
> str get_standard_error(command_id)

Download a zip-compressed archive of standard error outputs for the command's one-off processes.

Download a zip-compressed archive of standard error outputs for the command's one-off processes.  Log files are returned zipped together.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Download a zip-compressed archive of standard error outputs for the command's one-off processes.
    api_response = api_instance.get_standard_error(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->get_standard_error: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

**str**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/octet-stream

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="get_standard_output" id="get_standard_output"></a>
# **get_standard_output**
> str get_standard_output(command_id)

Download a zip-compressed archive of standard outputs for the command's one-off processes.

Download a zip-compressed archive of standard outputs for the command's one-off processes.  Log files are returned zipped together.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Download a zip-compressed archive of standard outputs for the command's one-off processes.
    api_response = api_instance.get_standard_output(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->get_standard_output: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

**str**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/octet-stream

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="read_command" id="read_command"></a>
# **read_command**
> ApiCommand read_command(command_id)

Retrieve detailed information on an asynchronous command.

Retrieve detailed information on an asynchronous command.  <p>Cloudera Manager keeps the results and statuses of asynchronous commands, which have non-negative command IDs. On the other hand, synchronous commands complete immediately, and their results are passed back in the return object of the command execution API call. Outside of that return object, there is no way to check the result of a synchronous command.</p>

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.

try:
    # Retrieve detailed information on an asynchronous command.
    api_response = api_instance.read_command(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->read_command: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="read_commands" id="read_commands"></a>
# **read_commands**
> ApiCommandList read_commands(end_time=end_time, limit=limit, name=name, offset=offset, start_time=start_time, success=success)

Retrieve detailed information on all recent commands.

Retrieve detailed information on all recent commands.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
end_time = -1 # int | timestamp of the command end time (optional) (default to -1)
limit = 50 # int | command count to return (from offset) (optional) (default to 50)
name = 'name_example' # str | the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME (optional)
offset = 0 # int | command position to start (optional) (default to 0)
start_time = -1 # int | timestamp of the command start time (optional) (default to -1)
success = true # bool | whether the command was successful, if already finished (optional)

try:
    # Retrieve detailed information on all recent commands.
    api_response = api_instance.read_commands(end_time=end_time, limit=limit, name=name, offset=offset, start_time=start_time, success=success)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->read_commands: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **end_time** | **int**| timestamp of the command end time | [optional] [default to -1]
 **limit** | **int**| command count to return (from offset) | [optional] [default to 50]
 **name** | **str**| the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME | [optional] 
 **offset** | **int**| command position to start | [optional] [default to 0]
 **start_time** | **int**| timestamp of the command start time | [optional] [default to -1]
 **success** | **bool**| whether the command was successful, if already finished | [optional] 

### Return type

[**ApiCommandList**](ApiCommandList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="replication_report" id="replication_report"></a>
# **replication_report**
> str replication_report(command_id, type=type)

Get the replication report CSV files.

Get the replication report CSV files.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | The command id.
type = 'type_example' # str | The requested report type. (optional)

try:
    # Get the replication report CSV files.
    api_response = api_instance.replication_report(command_id, type=type)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->replication_report: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| The command id. | 
 **type** | **str**| The requested report type. | [optional] 

### Return type

**str**

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="retry" id="retry"></a>
# **retry**
> ApiCommand retry(command_id)

Try to rerun a command.

Try to rerun a command.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 56 # int | ID of the command that needs to be run.

try:
    # Try to rerun a command.
    api_response = api_instance.retry(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->retry: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **command_id** | **int**| ID of the command that needs to be run. | 

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

