Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/intersight/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZm
Z
dd
lmZddlmZd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: intersight_rest_api
short_description: REST API configuration for Cisco Intersight
description:
- Direct REST API configuration for Cisco Intersight.
- All REST API resources and properties must be specified.
- For more information see L(Cisco Intersight,https://intersight.com/apidocs).
extends_documentation_fragment: intersight
options:
  resource_path:
    description:
    - Resource URI being configured related to api_uri.
    type: str
    required: yes
  query_params:
    description:
    - Query parameters for the Intersight API query language.
    type: dict
  update_method:
    description:
    - The HTTP method used for update operations.
    - Some Intersight resources require POST operations for modifications.
    type: str
    choices: [ patch, post ]
    default: patch
  api_body:
    description:
    - The payload for API requests used to modify resources.
    type: dict
  state:
    description:
    - If C(present), will verify the resource is present and will create if needed.
    - If C(absent), will verify the resource is absent and will delete if needed.
    choices: [present, absent]
    default: present
author:
- David Soper (@dsoper2)
- CiscoUcs (@CiscoUcs)
version_added: '2.8'
so
- name: Configure Boot Policy
  intersight_rest_api:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    api_key_uri: "{{ api_key_uri }}"
    validate_certs: "{{ validate_certs }}"
    resource_path: /boot/PrecisionPolicies
    query_params:
      $filter: "Name eq 'vmedia-localdisk'"
    api_body: {
      "Name": "vmedia-hdd",
      "ConfiguredBootMode": "Legacy",
      "BootDevices": [
        {
          "ObjectType": "boot.VirtualMedia",
          "Enabled": true,
          "Name": "remote-vmedia",
          "Subtype": "cimc-mapped-dvd"
        },
        {
          "ObjectType": "boot.LocalDisk",
          "Enabled": true,
          "Name": "localdisk",
          "Slot": "MRAID",
          "Bootloader": null
        }
      ],
    }
    state: present

- name: Delete Boot Policy
  intersight_rest_api:
    api_private_key: "{{ api_private_key }}"
    api_key_id: "{{ api_key_id }}"
    api_key_uri: "{{ api_key_uri }}"
    validate_certs: "{{ validate_certs }}"
    resource_path: /boot/PrecisionPolicies
    query_params:
      $filter: "Name eq 'vmedia-localdisk'"
    state: absent
s�
api_repsonse:
  description: The API response output returned by the specified resource.
  returned: always
  type: dict
  sample:
    "api_response": {
      "BootDevices": [
        {
          "Enabled": true,
          "Name": "remote-vmedia",
          "ObjectType": "boot.VirtualMedia",
          "Subtype": "cimc-mapped-dvd"
        },
        {
          "Bootloader": null,
          "Enabled": true,
          "Name": "boot-lun",
          "ObjectType": "boot.LocalDisk",
          "Slot": "MRAID"
        }
      ],
      "ConfiguredBootMode": "Legacy",
      "Name": "vmedia-localdisk",
      "ObjectType": "boot.PrecisionPolicy",
    }
N(tIntersightModuletintersight_argument_spec(t
AnsibleModule(t	iteritemscC`sbidd6|jjdd6|jjdd6}|j|�}|jd�r^|dd}n|S(s9
    GET a resource and return the 1st element found
    tgetthttp_methodt
resource_pathtquery_paramstResultsi(tmoduletparamstcall_apiR(t
intersighttoptionst
response_dict((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pytget_resource�scC`s�y`xUt|�D]G\}}tjd|�s||kr@qnt|||�stSqWtSWn.ttfk
r�|r�||kr�tStSXdS(NsP(ass)?w(or)?d(Rtretsearchtcompare_valuestFalsetTruetAttributeErrort	TypeError(texpectedtactualtkeytvalue((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pyR�scC`s|jjs�|r�i|jjdd6|jjdd6|jjdd6|d6}|j|�}|jd�r�|dd|jd	<q�q�id
d6|jjdd6|jjdd6}|j|�}d|kr�t|�}n||jd	<nt|jd<dS(
Nt
update_methodR
Rtapi_bodytbodytmoidRitapi_responsetposttMoidtchanged(Rt
check_modeRRRtresultRR(RR&RRtresp((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pytconfigure_resource�s&
cC`s_|jjsNidd6|jjdd6|d6}|j|�i|jd<nt|jd<dS(NtdeleteR
RR&R'R*(RR+RRR,R(RR&R((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pytdelete_resource�s

cC`s�t}|jdtdddt�dtdddi�dtddd	d
dgdd
�dtdddi�d
tddd	ddgdd��t|dt�}t|�}i|jd<t|�|jd<|jd
dkr�t	}t
|jd�}nt}t	}d}t	}|s"|r|jdjd�r|jdd}|rot
|jd|jd�}qt||�n|r�|r�t||�n|j|j�dS(NRttypetstrtrequiredRtdicttdefaultR#tchoicestpatchR(R$tstatetabsenttpresenttsupports_check_modeR'R)(R	tupdateR4RR
RR,RRRtbooltNoneRRR0R.t	exit_json(t
argument_specRRtrequest_deletetrequest_configR&tresource_values_match((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pytmain�s8	!"	
" 
t__main__(t
__future__RRRR1t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRt1ansible.module_utils.remote_management.intersightRR	tansible.module_utils.basicR
tansible.module_utils.sixRRRR.R0RDt__name__(((sd/usr/lib/python2.7/site-packages/ansible/modules/remote_management/intersight/intersight_rest_api.pyt<module>s$


*+				
	.

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]