controllers.views_controller module

class controllers.views_controller.ViewsController(config=None, client=None, call_back=None)[source]

Bases: cohesity_management_sdk.controllers.base_controller.BaseController

A Controller to access Endpoints in the cohesity_management_sdk API.

create_activate_view_aliases(name)[source]

Does a POST request to /public/viewAliases/{name}/activate.

Returns error if op fails.

Args:

name (string): Specifies the View name.

Returns:

ActivateViewAliasesResult: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_clone_directory(body)[source]

Does a POST request to /public/views/cloneDirectory.

Returns error if op fails.

Args:

body (CloneDirectoryParams): Request to clone a directory.

Returns:

void: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_clone_view(body)[source]

Does a POST request to /public/views/clone.

Returns the cloned View.

Args:

body (CloneViewRequest): Request to clone a View.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_lock_file(name, body=None)[source]

Does a POST request to /public/views/{name}/fileLocks.

Returns error if op fails.

Args:

name (string): Specifies the View name. body (LockFileParams, optional): Request to lock a file.

Returns:
FileLockStatus: Response from the API. Get lock file status

response

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_lock_file_by_id(id, body=None)[source]

Does a POST request to /public/views/id/{id}/fileLocks.

Returns error if op fails.

Args:

id (long|int): Specifies the View id. body (LockFileParams, optional): Request to lock a file.

Returns:
FileLockStatus: Response from the API. Get lock file status

response

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_overwrite_view(body)[source]

Does a POST request to /public/views/overwrite.

Specifies source and target view names as params. Returns the modified Target View.

Args:
body (OverwriteViewParam): Request to overwrite a Target view with

contents of a Source view.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_rename_view(body, name)[source]

Does a POST request to /public/views/rename/{name}.

Specify original name of the View in the ‘name’ parameter. Returns the renamed View.

Args:

body (RenameViewParam): Request to rename a View. name (string): Specifies the View name.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_rename_view_by_id(body, id)[source]

Does a POST request to /public/views/rename/id/{id}.

Specify unique id of the View in the ‘id’ parameter. Returns the renamed View.

Args:

body (RenameViewParam): Request to rename a View. id (long|int): Specifies the View id.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_view(body)[source]

Does a POST request to /public/views.

Returns the created View.

Args:

body (CreateViewRequest): Request to create a View.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_view_alias(body)[source]

Does a POST request to /public/viewAliases.

Returns the created View Alias.

Args:

body (ViewAlias): Request to create a View Alias.

Returns:

ViewAlias: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

create_view_user_quota(body=None)[source]

Does a POST request to /public/viewUserQuotas.

Returns error if op fails.

Args:
body (ViewUserQuotaParameters, optional): update user quota

params.

Returns:

UserQuotaAndUsage: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_clear_nlm_locks(body)[source]

Does a DELETE request to /public/nlmLocks.

Returns nothing upon success.

Args:

body (ClearNlmLocksParameters): Request to clear NLM locks.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_view(name)[source]

Does a DELETE request to /public/views/{name}.

Returns delete status upon completion.

Args:

name (string): Specifies the View name.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_view_alias(name)[source]

Does a DELETE request to /public/viewAliases/{name}.

Returns delete status upon completion.

Args:

name (string): Specifies the View Alias name.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_view_by_id(id)[source]

Does a DELETE request to /public/views/id/{id}.

Returns delete status upon completion.

Args:

id (long|int): Specifies the View id.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_view_users_quota(body=None)[source]

Does a DELETE request to /public/viewUserQuotas.

Returns error if op fails.

Args:
body (DeleteViewUsersQuotaParameters, optional): update user quota

params.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_file_lock_status(name, path=None)[source]

Does a GET request to /public/views/{name}/fileLocks.

Returns error if op fails.

Args:

name (string): Specifies the View name. path (string, optional): Specifies the file path that needs to be

locked.

Returns:
FileLockStatus: Response from the API. Get lock file status

response

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_file_lock_status_by_id(id, path=None)[source]

Does a GET request to /public/views/id/{id}/fileLocks.

Returns error if op fails.

Args:

id (long|int): Specifies the View id. path (string, optional): Specifies the file path that needs to be

locked.

Returns:
FileLockStatus: Response from the API. Get lock file status

response

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_nfs_connections(view_names=None, view_ids=None, max_count=None)[source]

Does a GET request to /public/nfsConnections.

Returns error if op fails.

Args:
view_names (list of string, optional): Parameters to get Nfs

List of names of views whose connections are to be fetched.

view_ids (list of long|int, optional): List of ids of

views whose connections are to be fetched.

max_count (int): Maximum number of results to return.

Returns:

list of NfsConnection: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_qo_s_policies(ids=None, names=None)[source]

Does a GET request to /public/qosPolicies.

Returns error if op fails.

Args:
ids (list of long|int, optional): Specifies the Ids of QoS

Policies to filter by.

names (list of string, optional): Specifies the names of QoS

Policies to filter by.

Returns:

list of QoSPolicy: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_smb_connections(view_names=None, view_ids=None, max_count=None, include_sid=None)[source]

Does a GET request to /public/smbConnections.

Returns error if op fails.

Args:
view_names (list of string, optional): Parameters to get Smb

Connections. List of names of views whose connections are to be fetched.

view_ids (list of long|int, optional): List of ids of views whose

connections are to be fetched.

max_count (int, optional): Maximum number of results to return. include_sid (bool, optional): Specifies whether to include list of

sids in the result.

Returns:

list of SmbConnection: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_view_by_id(id)[source]

Does a GET request to /public/views/id/{id}.

Returns the View corresponding to the specified View id.

Args:

id (long|int): Specifies the View id.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_view_by_name(name)[source]

Does a GET request to /public/views/{name}.

Returns the View corresponding to the specified View name.

Args:

name (string): Specifies the View name.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_view_dir_quota_info(view_name)[source]

Does a GET request to /public/viewDirectoryQuotas.

Gets directory quota info for a view. Returns error if op fails.

Args:

view_name (string): The name of the view.

Returns:

DirQuotaInfo: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_view_user_quotas(view_name=None, include_usage=None, include_user_with_quota_only=None, exclude_users_within_alert_threshold=None, unix_uid=None, sid=None, user_unix_ids_for_view=None, user_sids_for_view=None, view_names_for_user=None, summary_only=None, page_count=None, max_view_id=None, cookie=None, output_format=None)[source]

Does a GET request to /public/viewUserQuotas.

Returns error if op fails.

Args:
view_name (string, optional): Specifies the name of the input

view. If given, there could be three scenarios with the viewName input parameter: It gives the user quota overrides for this view, and the user quota settings. Returns ‘usersQuotaAndUsage’. If given along with the user id, it returns the quota policy for this user on this view. Returns ‘usersQuotaAndUsage’. If given along with SummaryOnly as true, a user quota summary for this view would be returned. Returns ‘summaryForView’. If not given, then the user id is checked.

include_usage (bool, optional): If set to true, the logical usage

info is included only for users with quota overrides. By default, it is set to false.

include_user_with_quota_only (bool, optional): If set to true, the

result will only contain user with user quota enabled. By default, this field is set to false, and it’s only in effect when ‘SummaryOnly’ is set to false and ‘ViewName’ is specified.

exclude_users_within_alert_threshold (bool, optional): This field

can be set only when includeUsage is set to true. By default, all the users with logical usage > 0 will be returned in the result. If this field is set to true, only the list of users who has exceeded the alert threshold will be returned.

unix_uid (int, optional): If interested in a user via

unix-identifier, include UnixUid. Otherwise, If a valid unix-id to SID mappings are available (i.e., when mixed mode is enabled) the server will perform the necessary id mapping and return the correct usage irrespective of whether the unix id / SID is provided.

sid (string, optional): If interested in a user via smb_client,

include SID. Otherwise, If a valid unix-id to SID mappings are available (i.e., when mixed mode is enabled) the server will perform the necessary id mapping and return the correct usage irrespective of whether the unix id / SID is provided. The string is of following format - S-1-IdentifierAuthority-SubAuthority1-SubAuthority2-…-SubAuth orityn.

user_unix_ids_for_view (list of int, optional): While making a

query for a view, this specifies a list of specific users with their unix uid for the result.

user_sids_for_view (list of string, optional): While making a

query for a view, this specifies a list of specific users with their Sid for the result.

view_names_for_user (list of string, optional): While making a

query for a user, this specifies a list of specific views for the result.

summary_only (bool, optional): Specifies a flag to just return a

summary. If set to true, and if ViewName is not nil, it returns the summary of users for a view. Otherwise if UserId not nil, and ViewName is nil then it fetches the summary for a user in his views. By default, it is set to false.

page_count (long|int, optional): Specifies the max entries that

should be returned in the result.

max_view_id (long|int, optional): Related to fetching a particular

user’s quota and usage in all his views. It only pertains to the scenario where either UnixUid or Sid is specified, and ViewName is nil. Specify the maxViewId for All the views returned would have view_id’s less than or equal to the given MaxViewId if it is >= 0.

cookie (string, optional): Cookie should be used from previous

call to list user quota overrides. It resumes (or gives the next set of values) from the result of the previous call.

output_format (string, optional): OutputFormat is the Output

format for the output. If it is not specified, default is json.

Returns:

ViewUserQuotas: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_views(tenant_ids=None, all_under_hierarchy=None, view_names=None, view_ids=None, view_box_ids=None, view_box_names=None, match_partial_names=None, max_count=None, include_protection_jobs=None, max_view_id=None, include_inactive=None, job_ids=None, sort_by_logical_usage=None, match_alias_names=None, include_views_with_antivirus_enabled_only=None, include_stats=None, include_views_with_data_lock_enabled_only=None)[source]

Does a GET request to /public/views.

If no parameters are specified, all Views on the Cohesity Cluster are returned. Specifying parameters filters the results that are returned. NOTE: If maxCount is set and the number of Views returned exceeds the maxCount, there are more Views to return. To get the next set of Views, send another request and specify the id of the last View returned in viewList from the previous response.

Args:
tenant_ids (list of string, optional): TenantIds contains ids of

the tenants for which objects are to be returned.

all_under_hierarchy (bool, optional): AllUnderHierarchy specifies

if objects of all the tenants under the hierarchy of the logged in user’s organization should be returned.

view_names (list of string, optional): Filter by a list of View

names.

view_ids (list of long|int, optional): Filter by a list of View

ids.

view_box_ids (list of long|int, optional): Filter by a list of

Storage Domains (View Boxes) specified by id.

view_box_names (list of string, optional): Filter by a list of

View Box names.

match_partial_names (bool, optional): If true, the names in

viewNames are matched by prefix rather than exactly matched.

max_count (int, optional): Specifies a limit on the number of

Views returned.

include_protection_jobs (bool, optional): Specifies if Protection

Jobs information needs to be returned along with view metadata. By default, if not set or set to true, Job information is returned.

max_view_id (long|int, optional): If the number of Views to return

exceeds the maxCount specified in the original request, specify the id of the last View from the viewList in the previous response to get the next set of Views.

include_inactive (bool, optional): Specifies if inactive Views on

this Remote Cluster (which have Snapshots copied by replication) should also be returned. Inactive Views are not counted towards the maxCount. By default, this field is set to false.

job_ids (list of long|int, optional): Filter by Protection Job

ids. Return Views that are being protected by listed Jobs, which are specified by ids.

sort_by_logical_usage (bool, optional): If set to true, the list

is sorted descending by logical usage.

match_alias_names (bool, optional): If true, view aliases are also

matched with the names in viewNames.

include_views_with_antivirus_enabled_only (bool, optional): If set

to true, the list will contain only the views for which antivirus scan is enabled.

include_stats (bool, optional): If set to true, stats of views

will be returned. By default this parameter is set to false.

include_views_with_data_lock_enabled_only (bool, optional): If set

to true, the list will contain only the views for which either file level data lock is enabled or view level data lock is enabled.

Returns:

GetViewsResult: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_views_by_share_name(tenant_ids=None, all_under_hierarchy=None, share_name=None, max_count=None, pagination_cookie=None, match_partial_names=None)[source]

Does a GET request to /public/shares.

If no parameters are specified, all shares on the Cohesity Cluster are returned. Specifying share name/prefix filters the results that are returned. NOTE: If maxCount is set and the number of Views returned exceeds the maxCount, there are more Views to return. To get the next set of Views, send another request and specify the pagination cookie from the previous response.

Args:
tenant_ids (list of string, optional): TenantIds contains ids of

the tenants for which objects are to be returned.

all_under_hierarchy (bool, optional): AllUnderHierarchy specifies

if objects of all the tenants under the hierarchy of the logged in user’s organization should be returned.

share_name (string, optional): The share name(substring) that

needs to be searched against existing views and aliases.

max_count (int, optional): Specifies a limit on the number of

Views returned.

pagination_cookie (string, optional): Expected to be empty in the

first call to GetViewsByShareName. To get the next set of results, set this value to the pagination cookie value returned in the response of the previous call.

match_partial_names (bool, optional): If true, the names in

viewNames are matched by prefix rather than exactly matched.

Returns:

GetViewsByShareNameResult: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

list_nlm_locks(file_path=None, view_name=None, page_count=None, cookie=None)[source]

Does a GET request to /public/nlmLocks.

If no parameters are specified, all NLM locks currently on the Cohesity Cluster are returned. Specifying parameters filters the results that are returned.

Args:
file_path (string, optional): Specifies the filepath in the view

relative to the root filesystem. If this field is specified, viewName field must also be specified.

view_name (string, optional): Specifies the name of the View in

which to search. If a view name is not specified, all the views in the Cluster is searched. This field is mandatory if filePath field is specified.

page_count (int, optional): Specifies the maximum number of NLM

locks to return in the response. This field cannot be set above 1000. If this is not set, maximum of 1000 entries are returned.

cookie (string, optional): Specifies the opaque string returned in

the previous response. If this is set, next set of active opens just after the previous response are returned. If this is not set, first set of NLM locks are returned.

Returns:

ListNlmLocksResponse: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_user_quota_settings(body=None)[source]

Does a PUT request to /public/viewUserQuotasSettings.

Returns error if op fails.

Args:
body (UpdateUserQuotaSettingsForView, optional): update user quota

metadata params.

Returns:
UserQuotaSettings: Response from the API. The User Quota settings

applied to a view.

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_view(body)[source]

Does a PUT request to /public/views.

Returns the updated View.

Args:

body (UpdateViewParam): Request to update a view.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_view_alias(body)[source]

Does a PUT request to /public/viewAliases.

Returns the updated View Alias.

Args:

body (UpdateViewAliasParam): Request to update a View.

Returns:

ViewAlias: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_view_by_name(name, body)[source]

Does a PUT request to /public/views/{name}.

Returns the updated View.

Args:

name (string): Specifies the View name. body (UpdateViewParam): Request to update a view.

Returns:

View: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_view_dir_quota(body)[source]

Does a PUT request to /public/viewDirectoryQuotas.

Updates a directory quota policy for a view. Returns error if op fails.

Args:
body (UpdateDirQuotaArgs): Request to update view directory quota

policy.

Returns:

DirQuotaInfo: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_view_user_quota(body=None)[source]

Does a PUT request to /public/viewUserQuotas.

Returns error if op fails.

Args:
body (ViewUserQuotaParameters, optional): update user quota

params.

Returns:

UserQuotaAndUsage: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.