3030from ibm_cloud_sdk_core import BaseService , DetailedResponse , get_query_param
3131from ibm_cloud_sdk_core .authenticators .authenticator import Authenticator
3232from ibm_cloud_sdk_core .get_authenticator import get_authenticator_from_environment
33- from ibm_cloud_sdk_core .utils import datetime_to_string , string_to_datetime
33+ from ibm_cloud_sdk_core .utils import convert_model , datetime_to_string , string_to_datetime
3434
3535from .common import get_sdk_headers
3636
@@ -270,7 +270,11 @@ def update_enterprise(
270270 )
271271 headers .update (sdk_headers )
272272
273- data = {'name' : name , 'domain' : domain , 'primary_contact_iam_id' : primary_contact_iam_id }
273+ data = {
274+ 'name' : name ,
275+ 'domain' : domain ,
276+ 'primary_contact_iam_id' : primary_contact_iam_id ,
277+ }
274278 data = {k : v for (k , v ) in data .items () if v is not None }
275279 data = json .dumps (data )
276280 headers ['content-type' ] = 'application/json'
@@ -334,7 +338,10 @@ def import_account_to_enterprise(
334338 )
335339 headers .update (sdk_headers )
336340
337- data = {'parent' : parent , 'billing_unit_id' : billing_unit_id }
341+ data = {
342+ 'parent' : parent ,
343+ 'billing_unit_id' : billing_unit_id ,
344+ }
338345 data = {k : v for (k , v ) in data .items () if v is not None }
339346 data = json .dumps (data )
340347 headers ['content-type' ] = 'application/json'
@@ -353,7 +360,7 @@ def import_account_to_enterprise(
353360 return response
354361
355362 def create_account (
356- self , parent : str , name : str , owner_iam_id : str , * , traits : dict = None , ** kwargs
363+ self , parent : str , name : str , owner_iam_id : str , * , traits : 'CreateAccountRequestTraits' = None , ** kwargs
357364 ) -> DetailedResponse :
358365 """
359366 Create a new account in an enterprise.
@@ -371,9 +378,9 @@ def create_account(
371378 characters.
372379 :param str owner_iam_id: The IAM ID of the account owner, such as
373380 `IBMid-0123ABC`. The IAM ID must already exist.
374- :param dict traits: (optional) The traits object can be used to opt-out of
375- Multi-Factor Authentication setting when creating a child account in the
376- enterprise. This is an optional field.
381+ :param CreateAccountRequestTraits traits: (optional) The traits object can
382+ be used to opt-out of Multi-Factor Authentication setting when creating a
383+ child account in the enterprise. This is an optional field.
377384 :param dict headers: A `dict` containing the request headers
378385 :return: A `DetailedResponse` containing the result, headers and HTTP status code.
379386 :rtype: DetailedResponse with `dict` result representing a `CreateAccountResponse` object
@@ -385,6 +392,8 @@ def create_account(
385392 raise ValueError ('name must be provided' )
386393 if owner_iam_id is None :
387394 raise ValueError ('owner_iam_id must be provided' )
395+ if traits is not None :
396+ traits = convert_model (traits )
388397 headers = {}
389398 sdk_headers = get_sdk_headers (
390399 service_name = self .DEFAULT_SERVICE_NAME , service_version = 'V1' , operation_id = 'create_account'
@@ -636,7 +645,11 @@ def create_account_group(self, parent: str, name: str, primary_contact_iam_id: s
636645 )
637646 headers .update (sdk_headers )
638647
639- data = {'parent' : parent , 'name' : name , 'primary_contact_iam_id' : primary_contact_iam_id }
648+ data = {
649+ 'parent' : parent ,
650+ 'name' : name ,
651+ 'primary_contact_iam_id' : primary_contact_iam_id ,
652+ }
640653 data = {k : v for (k , v ) in data .items () if v is not None }
641654 data = json .dumps (data )
642655 headers ['content-type' ] = 'application/json'
@@ -791,7 +804,10 @@ def update_account_group(
791804 )
792805 headers .update (sdk_headers )
793806
794- data = {'name' : name , 'primary_contact_iam_id' : primary_contact_iam_id }
807+ data = {
808+ 'name' : name ,
809+ 'primary_contact_iam_id' : primary_contact_iam_id ,
810+ }
795811 data = {k : v for (k , v ) in data .items () if v is not None }
796812 data = json .dumps (data )
797813 headers ['content-type' ] = 'application/json'
@@ -1296,6 +1312,63 @@ def __ne__(self, other: 'CreateAccountGroupResponse') -> bool:
12961312 return not self == other
12971313
12981314
1315+ class CreateAccountRequestTraits :
1316+ """
1317+ The traits object can be used to opt-out of Multi-Factor Authentication setting when
1318+ creating a child account in the enterprise. This is an optional field.
1319+
1320+ :attr str mfa: (optional) By default MFA will be set on the account. To opt out,
1321+ pass the traits object with the mfa field set to empty string.
1322+ """
1323+
1324+ def __init__ (self , * , mfa : str = None ) -> None :
1325+ """
1326+ Initialize a CreateAccountRequestTraits object.
1327+
1328+ :param str mfa: (optional) By default MFA will be set on the account. To
1329+ opt out, pass the traits object with the mfa field set to empty string.
1330+ """
1331+ self .mfa = mfa
1332+
1333+ @classmethod
1334+ def from_dict (cls , _dict : Dict ) -> 'CreateAccountRequestTraits' :
1335+ """Initialize a CreateAccountRequestTraits object from a json dictionary."""
1336+ args = {}
1337+ if 'mfa' in _dict :
1338+ args ['mfa' ] = _dict .get ('mfa' )
1339+ return cls (** args )
1340+
1341+ @classmethod
1342+ def _from_dict (cls , _dict ):
1343+ """Initialize a CreateAccountRequestTraits object from a json dictionary."""
1344+ return cls .from_dict (_dict )
1345+
1346+ def to_dict (self ) -> Dict :
1347+ """Return a json dictionary representing this model."""
1348+ _dict = {}
1349+ if hasattr (self , 'mfa' ) and self .mfa is not None :
1350+ _dict ['mfa' ] = self .mfa
1351+ return _dict
1352+
1353+ def _to_dict (self ):
1354+ """Return a json dictionary representing this model."""
1355+ return self .to_dict ()
1356+
1357+ def __str__ (self ) -> str :
1358+ """Return a `str` version of this CreateAccountRequestTraits object."""
1359+ return json .dumps (self .to_dict (), indent = 2 )
1360+
1361+ def __eq__ (self , other : 'CreateAccountRequestTraits' ) -> bool :
1362+ """Return `true` when self and other are equal, false otherwise."""
1363+ if not isinstance (other , self .__class__ ):
1364+ return False
1365+ return self .__dict__ == other .__dict__
1366+
1367+ def __ne__ (self , other : 'CreateAccountRequestTraits' ) -> bool :
1368+ """Return `true` when self and other are not equal, false otherwise."""
1369+ return not self == other
1370+
1371+
12991372class CreateAccountResponse :
13001373 """
13011374 A newly-created account.
0 commit comments