mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #42811 from hibbert/allow_creation_token_boto_efs/develop
develop: Allow creation_token to be passed into create_file_system an…
This commit is contained in:
commit
b72718ee82
@ -135,6 +135,7 @@ def create_file_system(name,
|
|||||||
key=None,
|
key=None,
|
||||||
profile=None,
|
profile=None,
|
||||||
region=None,
|
region=None,
|
||||||
|
creation_token=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
'''
|
'''
|
||||||
Creates a new, empty file system.
|
Creates a new, empty file system.
|
||||||
@ -146,6 +147,10 @@ def create_file_system(name,
|
|||||||
(string) - The PerformanceMode of the file system. Can be either
|
(string) - The PerformanceMode of the file system. Can be either
|
||||||
generalPurpose or maxIO
|
generalPurpose or maxIO
|
||||||
|
|
||||||
|
creation_token
|
||||||
|
(string) - A unique name to be used as reference when creating an EFS.
|
||||||
|
This will ensure idempotency. Set to name if not specified otherwise
|
||||||
|
|
||||||
returns
|
returns
|
||||||
(dict) - A dict of the data for the elastic file system
|
(dict) - A dict of the data for the elastic file system
|
||||||
|
|
||||||
@ -155,10 +160,11 @@ def create_file_system(name,
|
|||||||
|
|
||||||
salt 'my-minion' boto_efs.create_file_system efs-name generalPurpose
|
salt 'my-minion' boto_efs.create_file_system efs-name generalPurpose
|
||||||
'''
|
'''
|
||||||
import os
|
|
||||||
import base64
|
if creation_token is None:
|
||||||
creation_token = base64.b64encode(os.urandom(46), ['-', '_'])
|
creation_token = name
|
||||||
tags = [{"Key": "Name", "Value": name}]
|
|
||||||
|
tags = {"Key": "Name", "Value": name}
|
||||||
|
|
||||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||||
|
|
||||||
@ -372,6 +378,7 @@ def get_file_systems(filesystemid=None,
|
|||||||
key=None,
|
key=None,
|
||||||
profile=None,
|
profile=None,
|
||||||
region=None,
|
region=None,
|
||||||
|
creation_token=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
'''
|
'''
|
||||||
Get all EFS properties or a specific instance property
|
Get all EFS properties or a specific instance property
|
||||||
@ -380,6 +387,12 @@ def get_file_systems(filesystemid=None,
|
|||||||
filesystemid
|
filesystemid
|
||||||
(string) - ID of the file system to retrieve properties
|
(string) - ID of the file system to retrieve properties
|
||||||
|
|
||||||
|
creation_token
|
||||||
|
(string) - A unique token that identifies an EFS.
|
||||||
|
If fileysystem created via create_file_system this would
|
||||||
|
either be explictitly passed in or set to name.
|
||||||
|
You can limit your search with this.
|
||||||
|
|
||||||
returns
|
returns
|
||||||
(list[dict]) - list of all elastic file system properties
|
(list[dict]) - list of all elastic file system properties
|
||||||
|
|
||||||
@ -393,9 +406,16 @@ def get_file_systems(filesystemid=None,
|
|||||||
result = None
|
result = None
|
||||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||||
|
|
||||||
if filesystemid:
|
if filesystemid and creation_token:
|
||||||
|
response = client.describe_file_systems(FileSystemId=filesystemid,
|
||||||
|
CreationToken=creation_token)
|
||||||
|
result = response["FileSystems"]
|
||||||
|
elif filesystemid:
|
||||||
response = client.describe_file_systems(FileSystemId=filesystemid)
|
response = client.describe_file_systems(FileSystemId=filesystemid)
|
||||||
result = response["FileSystems"]
|
result = response["FileSystems"]
|
||||||
|
elif creation_token:
|
||||||
|
response = client.describe_file_systems(CreationToken=creation_token)
|
||||||
|
result = response["FileSystems"]
|
||||||
else:
|
else:
|
||||||
response = client.describe_file_systems()
|
response = client.describe_file_systems()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user