Skip to content

Commit

Permalink
Documentation update and Version Bump (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuragsharma-123 authored Feb 1, 2024
1 parent 57450af commit 66d1b16
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.4.1] - 2024-02-01
### Added
- Added some more functions in admin client.

## [2.4.0] - 2024-01-27
### Added
- Added new functions in admin client.
Expand Down
56 changes: 56 additions & 0 deletions docs/clients/admin/admin_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,59 @@ __Returns__

`(Object)`: Spotinst API response

<h2 id="spotinst_sdk2.clients.admin.AdminClient.update_user_to_user_group_mapping">update_user_to_user_group_mapping</h2>

```python
AdminClient.update_user_to_user_group_mapping(user_id, user_group_ids)
```

Update the mapping of a given user to user groups

__Arguments__

- __user_id (String)__: Identifier of a user.
- __user_group_ids (List)__: A list of the user groups to register the given user to

__Returns__

`(Object)`: Spotinst API response

<h2 id="spotinst_sdk2.clients.admin.AdminClient.update_user_to_policy_mapping">update_user_to_policy_mapping</h2>

```python
AdminClient.update_user_to_policy_mapping(user_id, policies)
```

Update the mapping of a given user to policies

__Arguments__

- __user_id (String)__: Identifier of a user.
- __policies (List)__: A list of policies to register under the given user

__Returns__

`(Object)`: Spotinst API response

<h2 id="spotinst_sdk2.clients.admin.AdminClient.create_programmatic_user">create_programmatic_user</h2>

```python
AdminClient.create_programmatic_user(name,
description,
accounts=None,
policies=None)
```

Create a programmatic user

__Arguments__

- __name (String)__: Name of the programmatic user
- __description (String)__: Brief description of the user
- __accounts (List)__: All the accounts the programmatic user will have access to
- __policies (List)__: All the policies the programmatic user will have access to

__Returns__

`(Object)`: Spotinst API response

20 changes: 12 additions & 8 deletions spotinst_sdk2/clients/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def get_users(self):
url=self.__base_setup_url + "/organization/user", entity_name="user"
)

formatted_response = self.convert_json(response, self.camel_to_underscore)
formatted_response = self.convert_json(
response, self.camel_to_underscore)

return formatted_response["response"]["items"]

Expand All @@ -340,7 +341,8 @@ def get_user_details(self, user_id):
url=self.__base_setup_url + "/user/" + user_id, entity_name="user"
)

formatted_response = self.convert_json(response, self.camel_to_underscore)
formatted_response = self.convert_json(
response, self.camel_to_underscore)

return formatted_response["response"]["items"][0]

Expand All @@ -360,8 +362,7 @@ def delete_user(self, user_id):

return response


def update_user_group_mapping(self, user_id, user_group_ids):
def update_user_to_user_group_mapping(self, user_id, user_group_ids):
"""
Update the mapping of a given user to user groups
Expand All @@ -378,11 +379,12 @@ def update_user_group_mapping(self, user_id, user_group_ids):
entity_name="user",
)

formatted_response = self.convert_json(response, self.camel_to_underscore)
formatted_response = self.convert_json(
response, self.camel_to_underscore)

return formatted_response["response"]["status"]

def update_user_policy_mapping(self, user_id, policies):
def update_user_to_policy_mapping(self, user_id, policies):
"""
Update the mapping of a given user to policies
Expand All @@ -399,7 +401,8 @@ def update_user_policy_mapping(self, user_id, policies):
entity_name="user",
)

formatted_response = self.convert_json(response, self.camel_to_underscore)
formatted_response = self.convert_json(
response, self.camel_to_underscore)

return formatted_response["response"]["status"]

Expand Down Expand Up @@ -435,5 +438,6 @@ def create_programmatic_user(self, name, description, accounts=None, policies=No
body=json.dumps(payload),
entity_name="programmaticUser",
)
formatted_response = self.convert_json(response, self.camel_to_underscore)
formatted_response = self.convert_json(
response, self.camel_to_underscore)
return formatted_response["response"]["items"][0]
2 changes: 1 addition & 1 deletion spotinst_sdk2/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.4.0'
__version__ = '2.4.1'

0 comments on commit 66d1b16

Please sign in to comment.