def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(
        access_mode=dict(type='str', choices=['consolecli', 'dcui', 'shell', 'ssh'], default=None),
    )

    module = VmwareRestModule(argument_spec=argument_spec,
                              supports_check_mode=True,
                              is_multipart=True,
                              use_object_handler=True)
    access_mode = module.params['access_mode']

    if access_mode is None:
        access_mode = SLUG.keys()
        for mode in access_mode:
            get_mode(module, mode)
    else:
        get_mode(module, access_mode)

    module.exit()
Exemple #2
0
def main():
    argument_spec = VmwareRestModule.create_argument_spec(use_filters=True)
    argument_spec.update(object_type=dict(type="str", default="datacenter"))

    module = VmwareRestModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        use_object_handler=True,
    )
    object_type = module.params["object_type"]

    url = module.get_url_with_filter(object_type)

    module.get(url=url, key=object_type)
    module.exit()
def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(access_mode=dict(
        type="str",
        choices=["consolecli", "dcui", "shell", "ssh"],
        default=None,
    ))

    module = VmwareRestModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        is_multipart=True,
        use_object_handler=True,
    )
    access_mode = module.params["access_mode"]

    if access_mode is None:
        access_mode = SLUG.keys()
        for mode in access_mode:
            get_mode(module, mode)
    else:
        get_mode(module, access_mode)

    module.exit()
def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(
        subsystem=dict(
            type="str",
            required=False,
            choices=[
                "applmgmt",
                "databasestorage",
                "lastcheck",
                "load",
                "mem",
                "softwarepackages",
                "storage",
                "swap",
                "system",
            ],
        ),
        asset=dict(type="str", required=False),
    )

    module = VmwareRestModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        is_multipart=True,
        use_object_handler=True,
    )
    subsystem = module.params["subsystem"]
    asset = module.params["asset"]

    if asset is not None:
        url = API["appliance"]["base"] + ("/health/%s/messages" % asset)

        module.get(url=url, key=asset)
    elif subsystem is None:
        subsystem = SLUG.keys()
        for sys in subsystem:
            get_subsystem(module, sys)
    else:
        get_subsystem(module, subsystem)

    module.exit()
Exemple #5
0
def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(
        subsystem=dict(
            type='str',
            required=False,
            choices=[
                'applmgmt',
                'databasestorage',
                'lastcheck',
                'load',
                'mem',
                'softwarepackages',
                'storage',
                'swap',
                'system',
            ],
        ),
        asset=dict(type='str', required=False),
    )

    module = VmwareRestModule(argument_spec=argument_spec,
                              supports_check_mode=True,
                              is_multipart=True,
                              use_object_handler=True)
    subsystem = module.params['subsystem']
    asset = module.params['asset']

    if asset is not None:
        url = (API['appliance']['base'] + ('/health/%s/messages' % asset))

        module.get(url=url, key=asset)
    elif subsystem is None:
        subsystem = SLUG.keys()
        for sys in subsystem:
            get_subsystem(module, sys)
    else:
        get_subsystem(module, subsystem)

    module.exit()
def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(
        category_name=dict(type='str', required=False),
        category_id=dict(type='str', required=False),
        used_by_name=dict(type='str', required=False),
        used_by_type=dict(
            type='str',
            required=False,
            choices=[
                'cluster',
                'content_library',
                'content_type',
                'datacenter',
                'datastore',
                'folder',
                'host',
                'local_library',
                'network',
                'resource_pool',
                'subscribed_library',
                'tag',
                'vm',
            ],
        ),
        used_by_id=dict(type='str', required=False),
    )

    required_together = [['used_by_name', 'used_by_type']]

    mutually_exclusive = [
        ['category_name', 'category_id', 'used_by_id', 'used_by_name'],
        ['category_name', 'category_id', 'used_by_id', 'used_by_type'],
    ]

    module = VmwareRestModule(argument_spec=argument_spec,
                              required_together=required_together,
                              mutually_exclusive=mutually_exclusive,
                              supports_check_mode=True)

    category_name = module.params['category_name']
    category_id = module.params['category_id']
    used_by_name = module.params['used_by_name']
    used_by_type = module.params['used_by_type']
    used_by_id = module.params['used_by_id']

    url = module.get_url('category')
    data = {}
    if category_name is not None:
        category_id = module.get_id('category', category_name)
    if category_id is not None:
        url += '/id:' + category_id
        module.get(url=url)
    else:
        if used_by_name is not None:
            used_by_id = module.get_id(used_by_type, used_by_name)
        url += '?~action=list-used-categories'
        data = {'used_by_entity': used_by_id}
        module.post(url=url, data=data)
    module.exit()
Exemple #7
0
def main():
    argument_spec = VmwareRestModule.create_argument_spec()
    argument_spec.update(
        category_name=dict(type="str", required=False),
        category_id=dict(type="str", required=False),
        used_by_name=dict(type="str", required=False),
        used_by_type=dict(
            type="str",
            required=False,
            choices=[
                "cluster",
                "content_library",
                "content_type",
                "datacenter",
                "datastore",
                "folder",
                "host",
                "local_library",
                "network",
                "resource_pool",
                "subscribed_library",
                "tag",
                "vm",
            ],
        ),
        used_by_id=dict(type="str", required=False),
    )

    required_together = [["used_by_name", "used_by_type"]]

    mutually_exclusive = [
        ["category_name", "category_id", "used_by_id", "used_by_name"],
        ["category_name", "category_id", "used_by_id", "used_by_type"],
    ]

    module = VmwareRestModule(
        argument_spec=argument_spec,
        required_together=required_together,
        mutually_exclusive=mutually_exclusive,
        supports_check_mode=True,
    )

    category_name = module.params["category_name"]
    category_id = module.params["category_id"]
    used_by_name = module.params["used_by_name"]
    used_by_type = module.params["used_by_type"]
    used_by_id = module.params["used_by_id"]

    url = module.get_url("category")
    data = {}
    if category_name is not None:
        category_id = module.get_id("category", category_name)
    if category_id is not None:
        url += "/id:" + category_id
        module.get(url=url)
    else:
        if used_by_name is not None:
            used_by_id = module.get_id(used_by_type, used_by_name)
        url += "?~action=list-used-categories"
        data = {"used_by_entity": used_by_id}
        module.post(url=url, data=data)
    module.exit()