1#!/usr/bin/python
2#
3# @author: Gaurav Rastogi (grastogi@avinetworks.com)
4#          Eric Anderson (eanderson@avinetworks.com)
5# module_check: supported
6# Avi Version: 17.1.1
7#
8# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
9# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
10#
11
12ANSIBLE_METADATA = {'metadata_version': '1.1',
13                    'status': ['preview'],
14                    'supported_by': 'community'}
15
16DOCUMENTATION = '''
17---
18module: avi_certificatemanagementprofile
19author: Gaurav Rastogi (@grastogi23) <grastogi@avinetworks.com>
20
21short_description: Module for setup of CertificateManagementProfile Avi RESTful Object
22description:
23    - This module is used to configure CertificateManagementProfile object
24    - more examples at U(https://github.com/avinetworks/devops)
25requirements: [ avisdk ]
26version_added: "2.3"
27options:
28    state:
29        description:
30            - The state that should be applied on the entity.
31        default: present
32        choices: ["absent", "present"]
33    avi_api_update_method:
34        description:
35            - Default method for object update is HTTP PUT.
36            - Setting to patch will override that behavior to use HTTP PATCH.
37        version_added: "2.5"
38        default: put
39        choices: ["put", "patch"]
40    avi_api_patch_op:
41        description:
42            - Patch operation to use when using avi_api_update_method as patch.
43        version_added: "2.5"
44        choices: ["add", "replace", "delete"]
45    name:
46        description:
47            - Name of the pki profile.
48        required: true
49    script_params:
50        description:
51            - List of customparams.
52    script_path:
53        description:
54            - Script_path of certificatemanagementprofile.
55        required: true
56    tenant_ref:
57        description:
58            - It is a reference to an object of type tenant.
59    url:
60        description:
61            - Avi controller URL of the object.
62    uuid:
63        description:
64            - Unique object identifier of the object.
65extends_documentation_fragment:
66    - avi
67'''
68
69EXAMPLES = """
70- name: Example to create CertificateManagementProfile object
71  avi_certificatemanagementprofile:
72    controller: 10.10.25.42
73    username: admin
74    password: something
75    state: present
76    name: sample_certificatemanagementprofile
77"""
78
79RETURN = '''
80obj:
81    description: CertificateManagementProfile (api/certificatemanagementprofile) object
82    returned: success, changed
83    type: dict
84'''
85
86from ansible.module_utils.basic import AnsibleModule
87try:
88    from ansible.module_utils.network.avi.avi import (
89        avi_common_argument_spec, avi_ansible_api, HAS_AVI)
90except ImportError:
91    HAS_AVI = False
92
93
94def main():
95    argument_specs = dict(
96        state=dict(default='present',
97                   choices=['absent', 'present']),
98        avi_api_update_method=dict(default='put',
99                                   choices=['put', 'patch']),
100        avi_api_patch_op=dict(choices=['add', 'replace', 'delete']),
101        name=dict(type='str', required=True),
102        script_params=dict(type='list',),
103        script_path=dict(type='str', required=True),
104        tenant_ref=dict(type='str',),
105        url=dict(type='str',),
106        uuid=dict(type='str',),
107    )
108    argument_specs.update(avi_common_argument_spec())
109    module = AnsibleModule(
110        argument_spec=argument_specs, supports_check_mode=True)
111    if not HAS_AVI:
112        return module.fail_json(msg=(
113            'Avi python API SDK (avisdk>=17.1) or requests is not installed. '
114            'For more details visit https://github.com/avinetworks/sdk.'))
115    return avi_ansible_api(module, 'certificatemanagementprofile',
116                           set([]))
117
118
119if __name__ == '__main__':
120    main()
121