rs_server_osam/utils/cloud_provider_api_handler.md
OVH Handler module
OVHApiHandler
Handler for interacting with the OVH Cloud API for project users.
This class manages the OVH API client, providing methods to create, retrieve, and delete users associated with a cloud project.
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
__init__()
Initializes the OVH API client and retrieves the service name dynamically.
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
36 37 38 39 40 41 42 43 44 45 46 47 48 | |
__open_ovh_connection()
Establishes a connection to the OVH API using credentials from environment variables.
Returns:
| Type | Description |
|---|---|
Client
|
ovh.Client: An authenticated OVH API client. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the connection to the OVH API fails. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
apply_user_access_policy(user_id, access_policy)
Applies the provided S3 access policy to a specified user via the OVH API.
This method sends a POST request to the OVH cloud API to assign a policy document to the user's object storage account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The identifier of the user to whom the policy should be applied. |
required |
access_policy
|
dict
|
The access policy document as a dictionary. |
required |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates any exception raised by the |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
create_user(description=None, role=None, roles=None, timeout_seconds=60, poll_interval=2)
Creates a new user in the OVH cloud project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description
|
str | None
|
Optional description for the user. |
None
|
role
|
(deprecated) Optional legacy role specification. |
None
|
|
roles
|
Optional list of roles for the user. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The created user object as returned by the OVH API. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
delete_user(user_id)
Deletes a user from the OVH cloud project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user to delete. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Response from the OVH API upon successful deletion. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
143 144 145 146 147 148 149 150 151 152 153 | |
get_all_users()
Retrieves a list of all users associated with the OVH cloud project.
Returns:
| Type | Description |
|---|---|
list[dict]
|
list[dict]: A list of user dictionaries. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
77 78 79 80 81 82 83 84 | |
get_user(user_id)
Retrieves details of a specific user by user ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
A dictionary containing user details. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
86 87 88 89 90 91 92 93 94 95 96 | |
get_user_s3_access_key(user_id)
Retrieves the S3 access key for a given user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | None
|
The S3 access key. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_user_s3_secret_key(user_id, access_key)
Retrieves the S3 secret key for a given user and access key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
access_key
|
str
|
The S3 access key associated with the secret key to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The S3 secret key. |
Source code in docs/rs-server/services/osam/rs_server_osam/utils/cloud_provider_api_handler.py
173 174 175 176 177 178 179 180 181 182 183 184 185 | |