mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Add docs and CLI examples for new modules
Affected Modules: - boto_efs - namecheap_users - namecheap_domains - namecheap_ssl
This commit is contained in:
parent
424e83d472
commit
df1cf551ad
@ -2,6 +2,8 @@
|
||||
'''
|
||||
Connection module for Amazon EFS
|
||||
|
||||
.. versionadded:: Nitrogen
|
||||
|
||||
:configuration: This module accepts explicit EFS credentials but can also
|
||||
utilize IAM roles assigned to the instance through Instance Profiles or
|
||||
it can read them from the ~/.aws/credentials file or from these
|
||||
@ -143,6 +145,12 @@ def create_file_system(name,
|
||||
|
||||
returns
|
||||
(dict) - A dict of the data for the elastic file system
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.create_file_system efs-name generalPurpose
|
||||
'''
|
||||
import os
|
||||
import base64
|
||||
@ -202,6 +210,12 @@ def create_mount_target(filesystemid,
|
||||
|
||||
returns
|
||||
(dict) - A dict of the response data
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.create_mount_target filesystemid subnetid
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
@ -230,6 +244,12 @@ def create_tags(filesystemid,
|
||||
|
||||
tags
|
||||
(dict) - The tags to add to the file system
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.create_tags
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
@ -256,6 +276,12 @@ def delete_file_system(filesystemid,
|
||||
|
||||
filesystemid
|
||||
(string) - ID of the file system to delete.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.delete_file_system filesystemid
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
@ -284,6 +310,12 @@ def delete_mount_target(mounttargetid,
|
||||
|
||||
mounttargetid
|
||||
(string) - ID of the mount target to delete
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.delete_mount_target mounttargetid
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
@ -306,6 +338,12 @@ def delete_tags(filesystemid,
|
||||
|
||||
tags
|
||||
(list[string]) - The tag keys to delete to the file system
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.delete_tags
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
@ -328,6 +366,12 @@ def get_file_systems(filesystemid=None,
|
||||
|
||||
returns
|
||||
(list[dict]) - list of all elastic file system properties
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.get_file_systems efs-id
|
||||
'''
|
||||
|
||||
result = None
|
||||
@ -371,6 +415,12 @@ def get_mount_targets(filesystemid=None,
|
||||
|
||||
returns
|
||||
(list[dict]) - list of all mount point properties
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.get_mount_targets
|
||||
'''
|
||||
|
||||
result = None
|
||||
@ -404,6 +454,12 @@ def get_tags(filesystemid,
|
||||
|
||||
returns
|
||||
(list) - list of tags as key/value pairs
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.get_tags efs-id
|
||||
'''
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
response = client.describe_tags(FileSystemId=filesystemid)
|
||||
@ -432,6 +488,12 @@ def set_security_groups(mounttargetid,
|
||||
|
||||
securitygroups
|
||||
(list[string]) - list of no more than 5 VPC security group IDs.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' boto_efs.set_security_groups my-mount-target-id my-sec-group
|
||||
'''
|
||||
|
||||
client = _get_conn(key=key, keyid=keyid, profile=profile, region=region)
|
||||
|
@ -2,6 +2,8 @@
|
||||
'''
|
||||
Namecheap management
|
||||
|
||||
.. versionadded:: Nitrogen
|
||||
|
||||
General Notes
|
||||
-------------
|
||||
|
||||
@ -66,6 +68,13 @@ def reactivate(domain_name):
|
||||
amount charged for reactivation
|
||||
orderid unique integer value for the order
|
||||
transactionid unique integer value for the transaction
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_domains.reactivate my-domain-name
|
||||
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.domains.reactivate')
|
||||
opts['DomainName'] = domain_name
|
||||
@ -94,12 +103,11 @@ def renew(domain_name, years, promotion_code=None):
|
||||
domain_name
|
||||
string The domain name you wish to renew
|
||||
|
||||
years
|
||||
integer Number of years to renew
|
||||
CLI Example:
|
||||
|
||||
Optional parameters:
|
||||
promotion_code
|
||||
string Promotional code for renewing the domain
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_domains.renew my-domain-name 5
|
||||
'''
|
||||
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.domains.renew')
|
||||
@ -130,18 +138,11 @@ def create(domain_name, years, **kwargs):
|
||||
whoisguardenable True,False if enabled for this domain
|
||||
nonrealtimedomain True,False if domain registration is instant or not
|
||||
|
||||
Required parameters:
|
||||
domain_name
|
||||
string The name of the domain to purchase
|
||||
CLI Example:
|
||||
|
||||
years
|
||||
integer Number of years to register
|
||||
Default Value: 2
|
||||
Other required parameters:
|
||||
see https://www.namecheap.com/support/api/methods/domains/create.aspx
|
||||
.. code-block:: bash
|
||||
|
||||
If registering TLDs, please refer to https://www.namecheap.com/support/api/extended-attributes.aspx
|
||||
for additional parameters
|
||||
salt 'my-minion' namecheap_domains.create my-domain-name 2
|
||||
'''
|
||||
idn_codes = set(['afr',
|
||||
'alb',
|
||||
@ -319,6 +320,12 @@ def check(*domains_to_check):
|
||||
|
||||
domains_to_check
|
||||
array of strings List of domains to check
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_domains.check domain-to-check
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.domains.check')
|
||||
opts['DomainList'] = ','.join(domains_to_check)
|
||||
@ -344,6 +351,12 @@ def get_info(domain_name):
|
||||
|
||||
domain_name
|
||||
string Domain name to get information about
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_domains.get_info my-domain-name
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.domains.getinfo')
|
||||
opts['DomainName'] = domain_name
|
||||
@ -361,6 +374,12 @@ def get_info(domain_name):
|
||||
def get_tld_list():
|
||||
'''
|
||||
Returns a list of TLDs as objects
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_domains.get_tld_list
|
||||
'''
|
||||
|
||||
response_xml = salt.utils.namecheap.get_request(salt.utils.namecheap.get_opts('namecheap.domains.gettldlist'))
|
||||
@ -412,6 +431,12 @@ def get_list(list_type=None,
|
||||
sort_by
|
||||
string Possible values are NAME/NAME_DESC/EXPIREDATE/
|
||||
EXPIREDATE_DESC/CREATEDATE/CREATEDATE_DESC
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_domains.get_list
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.domains.getList')
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
'''
|
||||
Namecheap management
|
||||
|
||||
.. versionadded:: Nitrogen
|
||||
|
||||
General Notes
|
||||
-------------
|
||||
|
||||
@ -100,6 +102,12 @@ def reissue(csr_file,
|
||||
|
||||
Other required parameters:
|
||||
please see https://www.namecheap.com/support/api/methods/ssl/reissue.aspx
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.reissue my-csr-file my-cert-id apachessl
|
||||
'''
|
||||
return __get_certificates('namecheap.ssl.reissue', "SSLReissueResult", csr_file, certificate_id, web_server_type,
|
||||
approver_email, http_dc_validation, kwargs)
|
||||
@ -148,6 +156,12 @@ def activate(csr_file,
|
||||
|
||||
Other required parameters:
|
||||
please see https://www.namecheap.com/support/api/methods/ssl/activate.aspx
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.activate my-csr-file my-cert-id apachessl
|
||||
'''
|
||||
return __get_certificates('namecheap.ssl.activate', 'SSLActivateResult', csr_file, certificate_id, web_server_type,
|
||||
approver_email, http_dc_validation, kwargs)
|
||||
@ -278,6 +292,12 @@ def renew(years, certificate_id, certificate_type, promotion_code=None):
|
||||
Optional parameters:
|
||||
promotional_code
|
||||
string Promotional (coupon) code for the certificate
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.renew 1 my-cert-id RapidSSL
|
||||
'''
|
||||
|
||||
valid_certs = set(['QuickSSL Premium',
|
||||
@ -434,6 +454,12 @@ Symantec Secure Site 1 25 24
|
||||
Symantec Secure Site 1 25 24
|
||||
Pro
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.create 2 RapidSSL
|
||||
'''
|
||||
valid_certs = set(['QuickSSL Premium',
|
||||
'RapidSSL',
|
||||
@ -525,6 +551,12 @@ def parse_csr(csr_file, certificate_type, http_dc_validation=False):
|
||||
http_dc_validation
|
||||
bool True if a Comodo certificate and validation should be done with files
|
||||
instead of emails and to return the info to do so
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.parse_csr my-csr-file PremiumSSL
|
||||
'''
|
||||
valid_certs = set(['QuickSSL Premium',
|
||||
'RapidSSL',
|
||||
@ -608,6 +640,12 @@ def get_list(**kwargs):
|
||||
SSLTYPE,SSLTYPE_DESC,
|
||||
EXPIREDATETIME,EXPIREDATETIME_DESC,
|
||||
Host_Name,Host_Name_DESC
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.get_list Processing
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.ssl.getList')
|
||||
for key, value in kwargs.iteritems():
|
||||
@ -646,6 +684,12 @@ def get_info(certificate_id, returncertificate=False, returntype=None):
|
||||
returntype
|
||||
string Type of returned certificate. Parameter takes "Individual (for X.509 format) or PKCS7"
|
||||
Required if returncertificate is True
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block::
|
||||
|
||||
salt 'my-minion' namecheap_ssl.get_info my-cert-id
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.ssl.getinfo')
|
||||
opts['certificateID'] = certificate_id
|
||||
|
@ -2,6 +2,8 @@
|
||||
'''
|
||||
Namecheap management
|
||||
|
||||
.. versionadded:: Nitrogen
|
||||
|
||||
General Notes
|
||||
-------------
|
||||
|
||||
@ -60,13 +62,19 @@ def __virtual__():
|
||||
|
||||
def get_balances():
|
||||
'''
|
||||
Gets information about fund in the user's account.This method returns the following information:
|
||||
Gets information about fund in the user's account. This method returns the following information:
|
||||
Available Balance, Account Balance, Earned Amount, Withdrawable Amount and Funds Required for AutoRenew.
|
||||
|
||||
NOTE: If a domain setup with automatic renewal is expiring within the next 90 days,
|
||||
the FundsRequiredForAutoRenew attribute shows the amount needed in your Namecheap account to complete auto renewal.
|
||||
|
||||
returns a dictionary of the results
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_users.get_balances
|
||||
'''
|
||||
opts = salt.utils.namecheap.get_opts('namecheap.users.getBalances')
|
||||
|
||||
@ -80,6 +88,23 @@ def get_balances():
|
||||
|
||||
|
||||
def check_balances(minimum=100):
|
||||
'''
|
||||
Checks if the provided minimum value is present in the user's account.
|
||||
|
||||
Returns a boolean. Returns ``False`` if the user's account balance is less than the
|
||||
provided minimum or ``True`` if greater than the minimum.
|
||||
|
||||
minimum
|
||||
The value to check. Defaults to ``100``.
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt 'my-minion' namecheap_users.check_balances
|
||||
salt 'my-minion' namecheap_users.check_balances minimum=150
|
||||
|
||||
'''
|
||||
min_float = float(minimum)
|
||||
result = get_balances()
|
||||
if result['accountbalance'] <= min_float:
|
||||
|
Loading…
Reference in New Issue
Block a user