def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 name=dict(required=True, type='str'),
                 from_name=dict(required=False, type='str', default=None),
                 ostype=dict(required=False, type='str'),
                 initiator_group_type=dict(required=False,
                                           type='str',
                                           choices=['fcp', 'iscsi', 'mixed']),
                 initiators=dict(required=False,
                                 type='list',
                                 aliases=['initiator']),
                 vserver=dict(required=True, type='str'),
                 force_remove_initiator=dict(required=False,
                                             type='bool',
                                             default=False),
                 bind_portset=dict(required=False, type='str')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 share_name=dict(required=True, type='str'),
                 path=dict(required=False, type='str'),
                 vserver=dict(required=True, type='str'),
                 share_properties=dict(required=False, type='list'),
                 symlink_properties=dict(required=False, type='list'),
                 vscan_fileop_profile=dict(
                     required=False,
                     type='str',
                     choices=['no_scan', 'standard', 'strict',
                              'writes_only'])))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters.get('vserver'))
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=False,
                           choices=['present'],
                           default='present'),
                destination_vserver=dict(required=True, type='str'),
                destination_path=dict(required=True, type='str'),
                source_path=dict(required=True, type='str'),
                source_vserver=dict(required=False, type='str'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module,
                vserver=self.parameters['destination_vserver'])
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 vserver=dict(required=True, type='str'),
                 ostype=dict(
                     required=False,
                     type='str',
                     choices=['windows', 'linux', 'vmware', 'xen', 'hyper_v']),
                 path=dict(required=True, type='str'),
                 size=dict(required=False, type='int')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[('state', 'present',
                                                  ['ostype', 'size'])],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])
Exemplo n.º 5
0
    def __init__(self):
        """
        Initialize the Ontap qos policy group class.
        """
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 name=dict(required=True, type='str'),
                 from_name=dict(required=False, type='str'),
                 vserver=dict(required=True, type='str'),
                 max_throughput=dict(required=False, type='str'),
                 min_throughput=dict(required=False, type='str'),
                 force=dict(required=False, type='bool', default=False)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
Exemplo n.º 6
0
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 name=dict(required=True, type='str'),
                 from_name=dict(required=False, type='str'),
                 root_volume=dict(type='str'),
                 root_volume_aggregate=dict(type='str'),
                 root_volume_security_style=dict(
                     type='str', choices=['unix', 'ntfs', 'mixed', 'unified']),
                 allowed_protocols=dict(type='list'),
                 aggr_list=dict(type='list'),
                 ipspace=dict(type='str', required=False),
                 snapshot_policy=dict(type='str', required=False),
                 language=dict(type='str', required=False),
                 subtype=dict(choices=[
                     'default', 'dp_destination', 'sync_source',
                     'sync_destination'
                 ]),
                 comment=dict(type="str", required=False)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
Exemplo n.º 7
0
    def __init__(self):
        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
        self.argument_spec.update(
            dict(skip=dict(required=False,
                           type='str',
                           default=None,
                           choices=['mvip', 'svip']),
                 mvip=dict(required=False, type='str', default=None),
                 svip=dict(required=False, type='str', default=None)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[('skip', 'svip', ['mvip']),
                                                 ('skip', 'mvip', ['svip'])],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.module.params.copy()
        self.msg = ""

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the ElementSW Python SDK")
        else:
            self.elem = netapp_utils.create_sf_connection(self.module,
                                                          port=442)
Exemplo n.º 8
0
    def __init__(self):
        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()

        self.argument_spec.update(
            dict(modify_cluster_full_threshold=dict(
                type='dict',
                options=dict(stage2_aware_threshold=dict(type='int',
                                                         default=None),
                             stage3_block_threshold_percent=dict(type='int',
                                                                 default=None),
                             max_metadata_over_provision_factor=dict(
                                 type='int', default=None))),
                 encryption_at_rest=dict(type='str',
                                         choices=['present', 'absent']),
                 set_ntp_info=dict(type='dict',
                                   options=dict(
                                       broadcastclient=dict(type='bool',
                                                            default=False),
                                       ntp_servers=dict(type='list'))),
                 enable_virtual_volumes=dict(type='bool', default=True)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)
Exemplo n.º 9
0
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=False,
                           choices=['present', 'absent'],
                           default='present'),
                from_name=dict(required=False, type='str'),
                snapshot=dict(required=True, type="str"),
                volume=dict(required=True, type="str"),
                async_bool=dict(required=False, type="bool", default=False),
                comment=dict(required=False, type="str"),
                snapmirror_label=dict(required=False, type="str"),
                ignore_owners=dict(required=False, type="bool", default=False),
                snapshot_instance_uuid=dict(required=False, type="str"),
                vserver=dict(required=True, type="str"),
            ))
        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])
        return
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(dict(
            state=dict(required=False, choices=['present', 'absent'], default='present'),
            vserver=dict(required=True, type='str'),
            volume=dict(required=True, type='str'),
            quota_target=dict(required=True, type='str'),
            qtree=dict(required=False, type='str', default=""),
            type=dict(required=True, type='str', choices=['user', 'group', 'tree']),
            policy=dict(required=False, type='str'),
            set_quota_status=dict(required=False, type='bool'),
            file_limit=dict(required=False, type='str', default='-'),
            disk_limit=dict(required=False, type='str', default='-'),
            threshold=dict(required=False, type='str', default='-')
        ))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            supports_check_mode=True
        )

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=self.parameters['vserver'])
    def __init__(self):
        """
            Initialize the NetAppOntapServiceProcessorNetwork class
        """
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            choices=['present'],
                            default='present'),
                 address_type=dict(required=True, choices=['ipv4', 'ipv6']),
                 is_enabled=dict(required=True, type='bool'),
                 node=dict(required=True, type='str'),
                 dhcp=dict(required=False, choices=['v4', 'none']),
                 gateway_ip_address=dict(required=False, type='str'),
                 ip_address=dict(required=False, type='str'),
                 netmask=dict(required=False, type='str'),
                 prefix_length=dict(required=False, type='int'),
                 wait_for_completion=dict(required=False,
                                          type='bool',
                                          default=False)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        self.set_playbook_zapi_key_map()

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module,
                                                           vserver=None)
        return
Exemplo n.º 12
0
    def __init__(self):
        """
            Initialize the ONTAP Broadcast Domain class
        """
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=False,
                           choices=['present', 'absent'],
                           default='present'),
                name=dict(required=True,
                          type='str',
                          aliases=["broadcast_domain"]),
                ipspace=dict(required=False, type='str'),
                mtu=dict(required=False, type='str'),
                ports=dict(required=False, type='list'),
                from_name=dict(required=False, type='str'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
        return
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 nodes=dict(required=False, type='list', aliases=["node"]),
                 package_version=dict(required=True, type='str'),
                 package_url=dict(required=True, type='str'),
                 ignore_validation_warning=dict(required=False,
                                                type='bool',
                                                default=False)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
Exemplo n.º 14
0
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(dict(
            state=dict(required=False, choices=['present', 'absent'], default='present'),
            name=dict(required=True, type='str'),

            applications=dict(required=True, type='list', aliases=['application'],
                              choices=['console', 'http', 'ontapi', 'rsh', 'snmp',
                                       'sp', 'service-processor', 'ssh', 'telnet'],),
            authentication_method=dict(required=True, type='str',
                                       choices=['community', 'password', 'publickey', 'domain', 'nsswitch', 'usm', 'cert']),
            set_password=dict(required=False, type='str', no_log=True),
            role_name=dict(required=False, type='str'),
            lock_user=dict(required=False, type='bool'),
            vserver=dict(required=True, type='str'),
        ))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            required_if=[
                ('state', 'present', ['role_name'])
            ],
            supports_check_mode=True
        )

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=self.parameters['vserver'])
Exemplo n.º 15
0
    def __init__(self):
        self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()

        self.argument_spec.update(
            dict(
                state=dict(type='str',
                           choices=['present', 'absent'],
                           default='present'),
                snmp_v3_enabled=dict(type='bool'),
                networks=dict(type='dict',
                              options=dict(access=dict(
                                  type='str', choices=['ro', 'rw', 'rosys']),
                                           cidr=dict(type='int', default=None),
                                           community=dict(type='str',
                                                          default=None),
                                           network=dict(type='str',
                                                        default=None))),
                usm_users=dict(
                    type='dict',
                    options=dict(
                        access=dict(type='str',
                                    choices=['rouser', 'rwuser', 'rosys']),
                        name=dict(type='str', default=None),
                        password=dict(type='str', default=None),
                        passphrase=dict(type='str', default=None),
                        secLevel=dict(type='str',
                                      choices=['auth', 'noauth', 'priv']))),
            ))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            required_if=[('state', 'present', ['snmp_v3_enabled']),
                         ('snmp_v3_enabled', True, ['usm_users']),
                         ('snmp_v3_enabled', False, ['networks'])],
            supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if self.parameters.get('state') == "present":
            if self.parameters.get('usm_users') is not None:
                # Getting the configuration details to configure SNMP Version3
                self.access_usm = self.parameters.get('usm_users')['access']
                self.name = self.parameters.get('usm_users')['name']
                self.password = self.parameters.get('usm_users')['password']
                self.passphrase = self.parameters.get(
                    'usm_users')['passphrase']
                self.secLevel = self.parameters.get('usm_users')['secLevel']
            if self.parameters.get('networks') is not None:
                # Getting the configuration details to configure SNMP Version2
                self.access_network = self.parameters.get('networks')['access']
                self.cidr = self.parameters.get('networks')['cidr']
                self.community = self.parameters.get('networks')['community']
                self.network = self.parameters.get('networks')['network']

        if HAS_SF_SDK is False:
            self.module.fail_json(
                msg="Unable to import the SolidFire Python SDK")
        else:
            self.sfe = netapp_utils.create_sf_connection(module=self.module)
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=False,
                           choices=['present', 'absent'],
                           default='present'),
                name=dict(required=True, type='str'),
                from_name=dict(required=False, type='str'),
                flexvol_name=dict(type='str'),
                vserver=dict(required=True, type='str'),
                export_policy=dict(required=False, type='str'),
                security_style=dict(required=False,
                                    choices=['unix', 'ntfs', 'mixed']),
                oplocks=dict(required=False, choices=['enabled', 'disabled']),
                unix_permissions=dict(required=False, type='str'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[('state', 'present',
                                                  ['flexvol_name'])],
                                    supports_check_mode=True)
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])
Exemplo n.º 17
0
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 name=dict(required=True, type='str'),
                 job_minutes=dict(required=False, type='list'),
                 job_months=dict(required=False, type='list'),
                 job_hours=dict(required=False, type='list'),
                 job_days_of_month=dict(required=False, type='list'),
                 job_days_of_week=dict(required=False, type='list')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        self.set_playbook_zapi_key_map()

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(dict(
            state=dict(required=False, choices=['present'], default='present'),
            cluster_name=dict(required=False, type='str'),
            cluster_ip_address=dict(required=False, type='str'),
            license_code=dict(required=False, type='str'),
            license_package=dict(required=False, type='str'),
            node_serial_number=dict(required=False, type='str')
        ))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            supports_check_mode=True,
            required_together=[
                ['license_package', 'node_serial_number']
            ]
        )

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):
        """
        Parse arguments, setup state variables,
        check parameters and ensure request module is installed
        """
        self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=True, choices=['present', 'absent']),
                 region=dict(required=True, type='str'),
                 name=dict(required=True, type='str'),
                 from_name=dict(required=False, type='str'),
                 fileSystemId=dict(required=False, type='str')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[
                                        ('state', 'present',
                                         ['state', 'name', 'fileSystemId']),
                                    ],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()

        # set up state variables
        self.parameters = self.na_helper.set_parameters(self.module.params)
        # Calling generic AWSCVS restApi class
        self.restApi = AwsCvsRestAPI(self.module)

        # Checking for the parameters passed and create new parameters list
        self.data = {}
        for key in self.parameters.keys():
            self.data[key] = self.parameters[key]
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(base_dn=dict(required=False, type='str'),
                 base_scope=dict(required=False,
                                 default=None,
                                 choices=['subtree', 'onelevel', 'base']),
                 bind_dn=dict(required=False, default=None, type='str'),
                 bind_password=dict(type='str',
                                    required=False,
                                    default=None,
                                    no_log=True),
                 name=dict(required=True, type='str'),
                 ldap_servers=dict(required_if=[["state", "present"]],
                                   type='list'),
                 min_bind_level=dict(required=False,
                                     default=None,
                                     choices=['anonymous', 'simple', 'sasl']),
                 port=dict(required=False, default=None, type='int'),
                 query_timeout=dict(required=False, default=None, type='int'),
                 referral_enabled=dict(required=False,
                                       default=None,
                                       choices=['true', 'false']),
                 schema=dict(
                     required_if=[["state", "present"]],
                     default=None,
                     type='str',
                     choices=['AD-IDMU', 'AD-SFU', 'MS-AD-BIS', 'RFC-2307']),
                 session_security=dict(required=False,
                                       default=None,
                                       choices=['true', 'false']),
                 state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 use_start_tls=dict(required=False,
                                    default=None,
                                    choices=['true', 'false']),
                 vserver=dict(required=True, type='str')))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            supports_check_mode=True,
            required_if=[('state', 'present', ['ldap_servers', 'schema'])],
        )
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])

        self.simple_attributes = [
            'base_dn', 'base_scope', 'bind_dn', 'bind_password',
            'min_bind_level', 'port', 'query_timeout', 'referral_enabled',
            'session_security', 'use_start_tls'
        ]
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=False,
                           type='str',
                           choices=['present', 'absent'],
                           default='present'),
                name=dict(required=True, type='str', aliases=['policy_name']),
                protocol=dict(required=False,
                              type='list',
                              default=None,
                              choices=[
                                  'any', 'nfs', 'nfs3', 'nfs4', 'cifs',
                                  'flexcache'
                              ]),
                client_match=dict(required=False, type='list'),
                ro_rule=dict(required=False,
                             type='list',
                             default=None,
                             choices=[
                                 'any', 'none', 'never', 'krb5', 'krb5i',
                                 'krb5p', 'ntlm', 'sys'
                             ]),
                rw_rule=dict(required=False,
                             type='list',
                             default=None,
                             choices=[
                                 'any', 'none', 'never', 'krb5', 'krb5i',
                                 'krb5p', 'ntlm', 'sys'
                             ]),
                super_user_security=dict(required=False,
                                         type='list',
                                         default=None,
                                         choices=[
                                             'any', 'none', 'never', 'krb5',
                                             'krb5i', 'krb5p', 'ntlm', 'sys'
                                         ]),
                allow_suid=dict(required=False, type='bool'),
                rule_index=dict(required=False, type='int'),
                vserver=dict(required=True, type='str'),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        self.set_playbook_zapi_key_map()

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(name=dict(required=True, type='str'),
                 disks=dict(required=False, type='list'),
                 disk_count=dict(required=False, type='int', default=None),
                 disk_size=dict(required=False, type='int'),
                 disk_type=dict(required=False,
                                choices=[
                                    'ATA', 'BSAS', 'FCAL', 'FSAS', 'LUN',
                                    'MSATA', 'SAS', 'SSD', 'VMDISK'
                                ]),
                 from_name=dict(required=False, type='str'),
                 mirror_disks=dict(required=False, type='list'),
                 nodes=dict(required=False, type='list'),
                 is_mirrored=dict(required=False, type='bool'),
                 raid_size=dict(required=False, type='int'),
                 raid_type=dict(required=False,
                                choices=['raid4', 'raid_dp', 'raid_tec']),
                 service_state=dict(required=False,
                                    choices=['online', 'offline']),
                 spare_pool=dict(required=False, choices=['Pool0', 'Pool1']),
                 state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 unmount_volumes=dict(required=False, type='bool'),
                 wait_for_online=dict(required=False,
                                      type='bool',
                                      default=False),
                 time_out=dict(required=False, type='int', default=100)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[
                                        ('service_state', 'offline',
                                         ['unmount_volumes']),
                                    ],
                                    mutually_exclusive=[
                                        ('is_mirrored', 'disks'),
                                        ('is_mirrored', 'mirror_disks'),
                                        ('is_mirrored', 'spare_pool'),
                                        ('spare_pool', 'disks')
                                    ],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        if self.parameters.get(
                'mirror_disks'
        ) is not None and self.parameters.get('disks') is None:
            self.module.fail_json(
                mgs="mirror_disks require disks options to be set")
        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(dict(
            state=dict(required=False, type='str', choices=['present', 'absent'], default='present'),
            source_vserver=dict(required=False, type='str'),
            destination_vserver=dict(required=False, type='str'),
            source_volume=dict(required=False, type='str'),
            destination_volume=dict(required=False, type='str'),
            source_path=dict(required=False, type='str'),
            destination_path=dict(required=False, type='str'),
            schedule=dict(required=False, type='str'),
            policy=dict(required=False, type='str'),
            relationship_type=dict(required=False, type='str',
                                   choices=['data_protection', 'load_sharing',
                                            'vault', 'restore',
                                            'transition_data_protection',
                                            'extended_data_protection']
                                   ),
            source_hostname=dict(required=False, type='str'),
            connection_type=dict(required=False, type='str',
                                 choices=['ontap_ontap', 'elementsw_ontap', 'ontap_elementsw'],
                                 default='ontap_ontap'),
            source_username=dict(required=False, type='str'),
            source_password=dict(required=False, type='str', no_log=True),
            max_transfer_rate=dict(required=False, type='int'),
            identity_preserve=dict(required=False, type='bool')
        ))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            required_together=(['source_volume', 'destination_volume'],
                               ['source_vserver', 'destination_vserver']),
            supports_check_mode=True
        )

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        # setup later if required
        self.source_server = None
        # only for ElementSW -> ONTAP snapmirroring, validate if ElementSW SDK is available
        if self.parameters.get('connection_type') in ['elementsw_ontap', 'ontap_elementsw']:
            if HAS_SF_SDK is False:
                self.module.fail_json(msg="Unable to import the SolidFire Python SDK")
        if HAS_NETAPP_LIB is False:
            self.module.fail_json(msg="the python NetApp-Lib module is required")
        if self.parameters.get('connection_type') != 'ontap_elementsw':
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
        else:
            if self.parameters.get('source_username'):
                self.module.params['username'] = self.parameters['source_username']
            if self.parameters.get('source_password'):
                self.module.params['password'] = self.parameters['source_password']
            self.module.params['hostname'] = self.parameters['source_hostname']
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 source_intercluster_lifs=dict(
                     required=False,
                     type='list',
                     aliases=['source_intercluster_lif']),
                 dest_intercluster_lifs=dict(required=False,
                                             type='list',
                                             aliases=['dest_intercluster_lif'
                                                      ]),
                 passphrase=dict(required=False, type='str', no_log=True),
                 dest_hostname=dict(required=True, type='str'),
                 dest_username=dict(required=False, type='str'),
                 dest_password=dict(required=False, type='str', no_log=True),
                 source_cluster_name=dict(required=False, type='str'),
                 dest_cluster_name=dict(required=False, type='str')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_together=[[
                                        'source_intercluster_lifs',
                                        'dest_intercluster_lifs'
                                    ]],
                                    required_if=[('state', 'absent', [
                                        'source_cluster_name',
                                        'dest_cluster_name'
                                    ])],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
            # set destination server connection
            self.module.params['hostname'] = self.parameters['dest_hostname']
            if self.parameters.get('dest_username'):
                self.module.params['username'] = self.parameters[
                    'dest_username']
            if self.parameters.get('dest_password'):
                self.module.params['password'] = self.parameters[
                    'dest_password']
            self.dest_server = netapp_utils.setup_na_ontap_zapi(
                module=self.module)
            # reset to source host connection for asup logs
            self.module.params['hostname'] = self.parameters['hostname']
 def __init__(self):
     self.use_rest = False
     # Volume_autosize returns KB and not B like Volume so values are shifted down 1
     self._size_unit_map = dict(
         k=1,
         m=1024,
         g=1024**2,
         t=1024**3,
     )
     self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
     self.argument_spec.update(
         dict(volume=dict(required=True, type="str"),
              mode=dict(required=False,
                        choices=['grow', 'grow_shrink', 'off']),
              vserver=dict(required=True, type='str'),
              grow_threshold_percent=dict(required=False, type='int'),
              increment_size=dict(required=False, type='str'),
              maximum_size=dict(required=False, type='str'),
              minimum_size=dict(required=False, type='str'),
              reset=dict(required=False, type='bool'),
              shrink_threshold_percent=dict(required=False, type='int')))
     self.module = AnsibleModule(
         argument_spec=self.argument_spec,
         supports_check_mode=True,
         mutually_exclusive=[['reset', 'maximum_size'],
                             ['reset', 'increment_size'],
                             ['reset', 'minimum_size'],
                             ['reset', 'grow_threshold_percent'],
                             ['reset', 'shrink_threshold_percent'],
                             ['reset', 'mode']])
     self.na_helper = NetAppModule()
     self.parameters = self.na_helper.set_parameters(self.module.params)
     # API should be used for ONTAP 9.6 or higher, ZAPI for lower version
     self.restApi = OntapRestAPI(self.module)
     if self.restApi.is_rest():
         self.use_rest = True
         # increment size and reset are not supported with rest api
         if self.parameters.get('increment_size'):
             self.module.fail_json(
                 msg=
                 "Rest API does not support increment size, please switch to ZAPI"
             )
         if self.parameters.get('reset'):
             self.module.fail_json(
                 msg="Rest API does not support reset, please switch to ZAPI"
             )
     else:
         if HAS_NETAPP_LIB is False:
             self.module.fail_json(
                 msg="the python NetApp-Lib module is required")
         else:
             self.server = netapp_utils.setup_na_ontap_zapi(
                 module=self.module, vserver=self.parameters['vserver'])
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 interface_name=dict(required=True, type='str'),
                 home_node=dict(required=False, type='str', default=None),
                 home_port=dict(required=False, type='str'),
                 role=dict(required=False, type='str'),
                 address=dict(required=False, type='str'),
                 netmask=dict(required=False, type='str'),
                 vserver=dict(required=True, type='str'),
                 firewall_policy=dict(required=False, type='str',
                                      default=None),
                 failover_policy=dict(required=False,
                                      type='str',
                                      default=None,
                                      choices=[
                                          'disabled', 'system-defined',
                                          'local-only', 'sfo-partner-only',
                                          'broadcast-domain-wide'
                                      ]),
                 admin_status=dict(required=False, choices=['up', 'down']),
                 subnet_name=dict(required=False, type='str'),
                 is_auto_revert=dict(required=False, type='bool',
                                     default=None),
                 protocols=dict(required=False, type='list'),
                 force_subnet_association=dict(required=False,
                                               type='bool',
                                               default=None),
                 dns_domain_name=dict(required=False, type='str'),
                 listen_for_dns_query=dict(required=False, type='bool'),
                 is_dns_update_enabled=dict(required=False, type='bool')))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            mutually_exclusive=[['subnet_name', 'address'],
                                ['subnet_name', 'netmask']],
            supports_check_mode=True)
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(admin_server_ip=dict(required=False, default=None,
                                      type='str'),
                 admin_server_port=dict(required=False,
                                        default=None,
                                        type='str'),
                 clock_skew=dict(required=False, default=None, type='str'),
                 comment=dict(required=False, default=None, type='str'),
                 kdc_ip=dict(required_if=[["state", "present"]],
                             default=None,
                             type='str'),
                 kdc_port=dict(required=False, default=None, type='str'),
                 kdc_vendor=dict(required_if=[["state", "present"]],
                                 default=None,
                                 type='str',
                                 choices=['Microsoft', 'Other']),
                 pw_server_ip=dict(required=False, default=None, type='str'),
                 pw_server_port=dict(required=False, default=None, type='str'),
                 realm=dict(required=True, type='str'),
                 state=dict(required=False,
                            choices=['present', 'absent'],
                            default='present'),
                 vserver=dict(required=True, type='str')))

        self.module = AnsibleModule(
            argument_spec=self.argument_spec,
            supports_check_mode=True,
            required_if=[('state', 'present', ['kdc_vendor', 'kdc_ip'])],
        )
        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(
                module=self.module, vserver=self.parameters['vserver'])

        self.simple_attributes = [
            'admin_server_ip',
            'admin_server_port',
            'clock_skew',
            'kdc_ip',
            'kdc_port',
            'kdc_vendor',
        ]
    def __init__(self):
        """
        Parse arguments, setup state variables,
        check parameters and ensure request module is installed
        """
        self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
        self.argument_spec.update(
            dict(
                state=dict(required=True, choices=['present', 'absent']),
                region=dict(required=True, type='str'),
                creationToken=dict(required=True, type='str'),
                quotaInBytes=dict(required=False, type='int'),
                serviceLevel=dict(required=False,
                                  choices=['standard', 'premium', 'extreme']),
                exportPolicy=dict(
                    type='dict',
                    options=dict(rules=dict(
                        type='list',
                        options=dict(
                            allowedClients=dict(required=False, type='str'),
                            cifs=dict(required=False, type='bool'),
                            nfsv3=dict(required=False, type='bool'),
                            nfsv4=dict(required=False, type='bool'),
                            ruleIndex=dict(required=False, type='int'),
                            unixReadOnly=dict(required=False, type='bool'),
                            unixReadWrite=dict(required=False,
                                               type='bool'))))),
            ))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[
                                        ('state', 'present', [
                                            'region', 'creationToken',
                                            'quotaInBytes'
                                        ]),
                                    ],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()

        # set up state variables
        self.parameters = self.na_helper.set_parameters(self.module.params)

        # Calling generic AWSCVS restApi class
        self.restApi = AwsCvsRestAPI(self.module)

        self.data = {}
        for key in self.parameters.keys():
            self.data[key] = self.parameters[key]
    def __init__(self):
        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False, type='str', default='present'),
                 node=dict(required=False, type='str'),
                 firmware_type=dict(
                     required=True,
                     type='str',
                     choices=['service-processor', 'shelf', 'acp', 'disk']),
                 clear_logs=dict(required=False, type='bool', default=True),
                 package=dict(required=False, type='str'),
                 install_baseline_image=dict(required=False,
                                             type='bool',
                                             default=False),
                 update_type=dict(required=False, type='str'),
                 shelf_module_fw=dict(required=False, type='str'),
                 disk_fw=dict(required=False, type='str')))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    required_if=[
                                        ('firmware_type', 'acp', ['node']),
                                        ('firmware_type', 'disk', ['node']),
                                        ('firmware_type', 'service-processor',
                                         ['node', 'update_type']),
                                    ],
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)
        if self.parameters.get('firmware_type') == 'service-processor':
            if self.parameters.get(
                    'install_baseline_image') and self.parameters.get(
                        'package') is not None:
                self.module.fail_json(
                    msg=
                    'Do not specify both package and install_baseline_image: true'
                )
            if not self.parameters.get('package') and self.parameters.get(
                    'install_baseline_image') == 'False':
                self.module.fail_json(
                    msg=
                    'Specify at least one of package or install_baseline_image'
                )
        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
    def __init__(self):

        self.argument_spec = netapp_utils.na_ontap_host_argument_spec()
        self.argument_spec.update(
            dict(state=dict(required=False,
                            type='str',
                            choices=['present', 'absent'],
                            default='present'),
                 vserver=dict(required=True, type='str'),
                 peer_vserver=dict(required=True, type='str'),
                 peer_cluster=dict(required=False, type='str'),
                 applications=dict(required=False,
                                   type='list',
                                   choices=[
                                       'snapmirror', 'file_copy', 'lun_copy',
                                       'flexcache'
                                   ]),
                 dest_hostname=dict(required=False, type='str'),
                 dest_username=dict(required=False, type='str'),
                 dest_password=dict(required=False, type='str', no_log=True)))

        self.module = AnsibleModule(argument_spec=self.argument_spec,
                                    supports_check_mode=True)

        self.na_helper = NetAppModule()
        self.parameters = self.na_helper.set_parameters(self.module.params)

        if HAS_NETAPP_LIB is False:
            self.module.fail_json(
                msg="the python NetApp-Lib module is required")
        else:
            self.server = netapp_utils.setup_na_ontap_zapi(module=self.module)
            if self.parameters.get('dest_hostname'):
                self.module.params['hostname'] = self.parameters[
                    'dest_hostname']
                if self.parameters.get('dest_username'):
                    self.module.params['username'] = self.parameters[
                        'dest_username']
                if self.parameters.get('dest_password'):
                    self.module.params['password'] = self.parameters[
                        'dest_password']
                self.dest_server = netapp_utils.setup_na_ontap_zapi(
                    module=self.module)
                # reset to source host connection for asup logs
                self.module.params['hostname'] = self.parameters['hostname']