########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
#    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    * See the License for the specific language governing permissions and
#    * limitations under the License.

# Built-in Imports
import os
import requests
import json
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.decorators import operation
import constants


@operation
def validate_node_properties(key, ctx_node_properties):
    if key not in ctx_node_properties:
        raise NonRecoverableError('{0} is a required input. Unable to create.'.format(key))


@operation
def list_all_resource_groups(**_):
    list_rg=requests.get(url=constants.list_resource_group_url, headers=constants.headers)
    print list_rg.text
    #rg_list= extract from json file
    #return rg_list

@operation
def list_all_storage_accounts(**_):
    list_sg = requests.get(url=constants.list_storage_account_url, headers = constants.headers)
    print list_sg.text
    #sg_account_name_list= #extract sg_name
    #return sg_account_name_list

@operation
def list_all_vnets(**_):
    list_vnet = requests.get(url=constants.list_vnet_url, headers = constants.headers)
    print list_vnet.text

    #vnet_list= #extract vnet_name
    #return vnet_list


@operation
def list_all_virtual_machines(**_):
    list_vms = requests.get(url=constants.list_vms_url, headers = constants.headers)
    print list_vms.text
    #vm_list= #extract vnet_name
    #return vm_list


@@ -1088,16 +1088,170 @@
   list_r
+esource_groups_url='https://management.azure.com/subscriptions/'+constants.subscription_id+'/resourcegroups?api-version='+constants.api_version%0A    list_r
 g=reques
@@ -1257,34 +1257,24 @@
 sts.get(url=
-constants.
 list_resourc
@@ -1280,16 +1280,17 @@
 ce_group
+s
 _url, he
@@ -1442,24 +1442,316 @@
 s(**_):%0A    
+resource_group_name = ctx.node.properties%5B'resource_group_name'%5D%0A    list_storage_accounts_url='https://management.azure.com/subscriptions/'+constants.subscription_id+'/resourceGroups/'+resource_group_name+'/providers/Microsoft.Storage/storageAccounts?api-version='+constants.api_version%0A    
 list_sg = re
@@ -1761,34 +1761,24 @@
 sts.get(url=
-constants.
 list_storage
@@ -1785,16 +1785,17 @@
 _account
+s
 _url, he
@@ -1966,272 +1966,839 @@
     
-list_vnet = requests.get(url=constants.list_vnet_url, headers = constants.headers)%0A    print list_vnet.text%0A%0A    #vnet_list= #extract vnet_name%0A    #return vnet_list%0A%0A%0A@operation%0Adef list_all_virtual_machines(**_):%0A    list_vms = requests.get(url=constants.list_vm
+resource_group_name = ctx.node.properties%5B'resource_group_name'%5D%0A    list_vnets_url='https://management.azure.com/subscriptions/'+constants.subscription_id+'/resourceGroups/'+resource_group_name+'/providers/microsoft.network/virtualnetworks?api-version='+constants.api_version%0A    list_vnet = requests.get(url=list_vnets_url, headers = constants.headers)%0A    print list_vnet.text%0A%0A    #vnet_list= #extract vnet_name%0A    #return vnet_list%0A%0A%0A@operation%0Adef list_all_virtual_machines(**_):%0A    resource_group_name = ctx.node.properties%5B'resource_group_name'%5D%0A    list_virtual_machines_url='https://management.azure.com/subscriptions/'+constants.subscription_id+'/resourceGroups/'+resource_group_name+'/providers/Microsoft.Compute/virtualmachines?api-version='+constants.api_version%0A    list_vms = requests.get(url=list_virtual_machine
 s_ur

Update utils.py