def exec_module(self, **kwargs):
    for key in list(self.module_arg_spec.keys()):
        if hasattr(self, key):
            setattr(self, key, kwargs[key])
        elif (kwargs[key] is not None):
            self.body[key] = kwargs[key]
    self.inflate_parameters(self.module_arg_spec, self.body, 0)
    old_response = None
    response = None
    self.mgmt_client = self.get_mgmt_svc_client(GenericRestClient, base_url=self._cloud_environment.endpoints.resource_manager)
    self.url = (((((('/providers' + '/Microsoft.Billing') + '/enrollmentAccounts') + '/{{ enrollment_account_name }}') + '/providers') + '/Microsoft.Subscription') + '/createSubscription')
    self.url = self.url.replace('{{ enrollment_account_name }}', self.name)
    old_response = self.get_resource()
    if (not old_response):
        self.log("SubscriptionFactory instance doesn't exist")
        if (self.state == 'absent'):
            self.log("Old instance didn't exist")
        else:
            self.to_do = Actions.Create
    else:
        self.log('SubscriptionFactory instance already exists')
        if (self.state == 'absent'):
            self.to_do = Actions.Delete
        else:
            modifiers = {}
            self.create_compare_modifiers(self.module_arg_spec, '', modifiers)
            self.results['modifiers'] = modifiers
            self.results['compare'] = []
            self.create_compare_modifiers(self.module_arg_spec, '', modifiers)
            if (not self.default_compare(modifiers, self.body, old_response, '', self.results)):
                self.to_do = Actions.Update
    if ((self.to_do == Actions.Create) or (self.to_do == Actions.Update)):
        self.log('Need to Create / Update the SubscriptionFactory instance')
        if self.check_mode:
            self.results['changed'] = True
            return self.results
        response = self.create_update_resource()
        self.results['changed'] = True
        self.log('Creation / Update done')
    elif (self.to_do == Actions.Delete):
        self.log('SubscriptionFactory instance deleted')
        self.results['changed'] = True
        if self.check_mode:
            return self.results
        self.delete_resource()
        while self.get_resource():
            time.sleep(20)
    else:
        self.log('SubscriptionFactory instance unchanged')
        self.results['changed'] = False
        response = old_response
    if response:
        self.results['subscription_link'] = response['subscription_link']
    return self.results
def exec_module(self, **kwargs):
    for key in list(self.module_arg_spec.keys()):
        if hasattr(self, key):
            setattr(self, key, kwargs[key])
        elif (kwargs[key] is not None):
            self.body[key] = kwargs[key]
    self.inflate_parameters(self.module_arg_spec, self.body, 0)
    old_response = None
    response = None
    self.mgmt_client = self.get_mgmt_svc_client(GenericRestClient, base_url=self._cloud_environment.endpoints.resource_manager)
    self.url = (((((('/providers' + '/Microsoft.Billing') + '/enrollmentAccounts') + '/{{ enrollment_account_name }}') + '/providers') + '/Microsoft.Subscription') + '/createSubscription')
    self.url = self.url.replace('{{ enrollment_account_name }}', self.name)
    old_response = self.get_resource()
    if (not old_response):
        self.log("SubscriptionFactory instance doesn't exist")
        if (self.state == 'absent'):
            self.log("Old instance didn't exist")
        else:
            self.to_do = Actions.Create
    else:
        self.log('SubscriptionFactory instance already exists')
        if (self.state == 'absent'):
            self.to_do = Actions.Delete
        else:
            modifiers = {}
            self.create_compare_modifiers(self.module_arg_spec, , modifiers)
            self.results['modifiers'] = modifiers
            self.results['compare'] = []
            self.create_compare_modifiers(self.module_arg_spec, , modifiers)
            if (not self.default_compare(modifiers, self.body, old_response, , self.results)):
                self.to_do = Actions.Update
    if ((self.to_do == Actions.Create) or (self.to_do == Actions.Update)):
        self.log('Need to Create / Update the SubscriptionFactory instance')
        if self.check_mode:
            self.results['changed'] = True
            return self.results
        response = self.create_update_resource()
        self.results['changed'] = True
        self.log('Creation / Update done')
    elif (self.to_do == Actions.Delete):
        self.log('SubscriptionFactory instance deleted')
        self.results['changed'] = True
        if self.check_mode:
            return self.results
        self.delete_resource()
        while self.get_resource():
            time.sleep(20)
    else:
        self.log('SubscriptionFactory instance unchanged')
        self.results['changed'] = False
        response = old_response
    if response:
        self.results['subscription_link'] = response['subscription_link']
    return self.results