Modules
ClusterResources is the object containing all the cluster resources:
- buckets
- bucket_policies
- service_accounts
- iam_policies
- iam_policy_attachments
Source code in minio_manager/classes/resource_parser.py
17 18 19 20 21 22 23 24 25 26 27 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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
parse_bucket_lifecycle_file(lifecycle_file)
¶
Parse a bucket lifecycle config file.
The config files must be in JSON format and can be best obtained by running the following command
mc ilm rule export $cluster/$bucket > $policy_file.json
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lifecycle_file |
str
|
lifecycle config file |
required |
Returns: LifecycleConfig object
Source code in minio_manager/classes/resource_parser.py
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 |
|
parse_bucket_lifecycle_rule(rule_data)
staticmethod
¶
Parse a single bucket object lifecycle rule.
TODO
Implement date and days in Expiration, implement Transition, NoncurrentVersionTransition, Filter, and AbortIncompleteMultipartUpload
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_data |
dict
|
dict with rule data |
required |
Returns: Rule object
Source code in minio_manager/classes/resource_parser.py
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 |
|
parse_bucket_policies(bucket_policies)
staticmethod
¶
Parse a list of bucket policy definitions into BucketPolicy objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bucket_policies |
list
|
list of bucket policies |
required |
Returns: [BucketPolicy]
Source code in minio_manager/classes/resource_parser.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
parse_buckets(buckets)
¶
Parse the provided buckets with the following steps:
For each provided bucket
1. check the provided versioning. If versioning is not provided, set the default.
2. check if an object lifecycle JSON file is provided, use the default_bucket_lifecycle_policy, or skip OLM
3. parse the file and create a LifecycleConfig object for the bucket
4. create a Bucket object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buckets |
list
|
list of buckets to parse |
required |
Returns: [Bucket]: list of Bucket objects
Source code in minio_manager/classes/resource_parser.py
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 |
|
parse_iam_attachments(iam_policy_attachments)
staticmethod
¶
Parse a list of IAM policy attachment definitions into IamPolicyAttachment objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iam_policy_attachments |
list
|
dict of IAM policy attachments |
required |
Returns: [IamPolicyAttachment]
Source code in minio_manager/classes/resource_parser.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
parse_iam_policies(iam_policies)
staticmethod
¶
Parse a list of IAM policy definitions into IamPolicy objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iam_policies |
dict
|
dict of IAM policies |
required |
Returns: [IamPolicy]
Source code in minio_manager/classes/resource_parser.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
parse_resources(resources_file)
¶
Parse resources from a YAML file, ensuring they are valid before trying to use them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resources_file |
str
|
string path to the YAML file |
required |
Source code in minio_manager/classes/resource_parser.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
parse_service_accounts(service_accounts)
staticmethod
¶
Parse a list of service account definitions into ServiceAccount objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_accounts |
list
|
dict of service accounts |
required |
Returns: [ServiceAccount]
Source code in minio_manager/classes/resource_parser.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
Bases: Exception
Base class for Minio Manager errors.
Source code in minio_manager/classes/errors.py
1 2 3 4 5 |
|
Bases: Filter
The MinioManagerFilter is a custom logging Filter that masks secret values.
Source code in minio_manager/classes/logging_config.py
23 24 25 26 27 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 |
|
Bases: Formatter
The MinioManagerFormatter is a custom logging Formatter that provides formatting and colourises log messages.
Source code in minio_manager/classes/logging_config.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
Bases: Logger
The MinioManagerLogger is a custom Logger that implements our MinioManagerFilter and MinioManagerFormatter.
Source code in minio_manager/classes/logging_config.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
The McWrapper is responsible for executing mc commands.
To be replaced with the new functions in the updated MinioAdmin library.
Source code in minio_manager/classes/mc_wrapper.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 |
|
cleanup()
¶
We want to clean up the mc config file before the process finishes as otherwise it can cause issues with subsequent runs for different environments.
Source code in minio_manager/classes/mc_wrapper.py
148 149 150 151 152 153 154 155 156 |
|
configure(endpoint, access_key, secret_key, secure)
¶
Ensure the proper alias is configured for the cluster.
Source code in minio_manager/classes/mc_wrapper.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
find_mc_command()
staticmethod
¶
Configure the path to the mc command, as it may be named 'mcli' on some systems.
Source code in minio_manager/classes/mc_wrapper.py
49 50 51 52 53 54 55 |
|
service_account_add(credentials)
¶
mc admin user svcacct add alias-name 'username' --name "sa-test-key"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials |
ServiceAccount
|
object containing at least the user-friendly name of the service account |
required |
Returns: ServiceAccount with the access and secret keys added to it
Source code in minio_manager/classes/mc_wrapper.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
service_account_delete()
¶
mc admin user svcacct rm alias-name service-account-access-key
Source code in minio_manager/classes/mc_wrapper.py
136 137 138 |
|
service_account_info(access_key)
¶
mc admin user svcacct info alias-name service-account-access-key
Source code in minio_manager/classes/mc_wrapper.py
132 133 134 |
|
service_account_list(access_key)
¶
mc admin user svcacct ls alias-name 'access_key'
Source code in minio_manager/classes/mc_wrapper.py
128 129 130 |
|
service_account_set_policy(access_key, policy_file)
¶
mc admin user svcacct edit alias-name service-account-access-key --policy policy-file
Source code in minio_manager/classes/mc_wrapper.py
144 145 146 |
|
Bucket represents an S3 bucket.
name: The name of the bucket create_service_account: Whether to create a service account for the bucket (True or False) versioning: The versioning configuration for the bucket (Enabled or Suspended) lifecycle_config: The path to a lifecycle configuration JSON file for the bucket
Source code in minio_manager/classes/minio_resources.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
BucketPolicy represents an S3 bucket policy.
bucket: The name of the bucket policy_file: The path to a JSON policy file
Source code in minio_manager/classes/minio_resources.py
44 45 46 47 48 49 50 51 52 53 54 55 |
|
ServiceAccount represents a MinIO service account (or S3 access key).
name: The name of the service account description: The description of the service account access_key: The access key of the service account secret_key: The secret key of the service account policy: Optional custom policy for the service account policy_file: The path to a JSON policy file
Source code in minio_manager/classes/minio_resources.py
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 |
|
generate_service_account_policy()
¶
Generate a policy for a service account that gives access to a bucket with the same name as the service account.
Source code in minio_manager/classes/minio_resources.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
IamPolicy represents an S3 IAM policy.
name: The name of the policy policy_file: The path to a JSON policy file
Source code in minio_manager/classes/minio_resources.py
129 130 131 132 133 134 135 136 137 138 139 |
|
IamPolicyAttachment represents an S3 IAM policy attachment.
username: The name of the user to attach the policies to policies: A list of policies to attach to the user
Source code in minio_manager/classes/minio_resources.py
142 143 144 145 146 147 148 149 150 151 152 |
|
SecretManager is responsible for managing credentials
Source code in minio_manager/classes/secrets.py
18 19 20 21 22 23 24 25 26 27 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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
get_credentials(name, required=False)
¶
Get a password from the configured secret backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
the name of the password entry |
required |
required |
bool
|
whether the credentials must exist |
False
|
Returns: MinioCredentials
Source code in minio_manager/classes/secrets.py
66 67 68 69 70 71 72 73 74 75 76 77 |
|
keepass_get_credentials(name, required)
¶
Get a password from the configured Keepass database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
the name of the password entry |
required |
required |
bool
|
if the entry must exist |
required |
Returns:
Type | Description |
---|---|
ServiceAccount
|
ServiceAccount |
Source code in minio_manager/classes/secrets.py
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 |
|
keepass_set_password(credentials)
¶
Set the password for the given credentials.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials |
ServiceAccount
|
the credentials to set |
required |
Source code in minio_manager/classes/secrets.py
187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
retrieve_keepass_backend()
¶
Back-end implementation for the keepass backend. Two-step process: - first we retrieve the kdbx file from the S3 bucket - then we configure the PyKeePass backend
Returns: PyKeePass object, with the kdbx file loaded
Source code in minio_manager/classes/secrets.py
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 |
|
setup_backend()
¶
We dynamically configure the backend depending on the given backend type.
Source code in minio_manager/classes/secrets.py
59 60 61 62 63 64 |
|
Bases: BaseSettings
The Settings class is responsible for loading the settings from environment variables and the dotenv file, and making them available to the rest of the application.
Source code in minio_manager/classes/settings.py
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 |
|
ControllerUser represents the controller user of our application.
name: The name of the controller user access_key: The access key of the controller user secret_key: The secret key of the controller user
Source code in minio_manager/classes/controller_user.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|