Best Python code snippet using localstack_python
instance_profile.py
Source:instance_profile.py
...166 app=self.query_runner._splunkd.namespace['app'])167 if (noProxy):168 path += "?noProxy=true"169 return path170def get_instance_profile(splunkrc=None, telemetryConfService=None, serverInfoService=None):171 get_instance_profile.instance = get_instance_profile.instance or InstanceProfile(172 splunkrc, telemetryConfService, serverInfoService)173 return get_instance_profile.instance174def evaluate_roles(roles, rules):175 for reqi in rules:176 if (reqi[0] == "!"):177 reqi = reqi.replace("!", "")178 if roles.get(reqi):179 return False180 elif not roles.get(reqi):181 return False182 return True183def is_lead_node(roles):184 return 'lead_node' in roles and roles['lead_node'] is True...
create.py
Source:create.py
...113 @classmethod114 def clone(cls):115 return type('Meta', cls.__bases__, dict(cls.__dict__))116 def do_command(self):117 self.get_instance_profile()118 tags = self.app.pargs.tags119 if tags:120 tags = tagops.get_and_validate_tags(tags)121 create_platform_version(122 self.app.pargs.version,123 self.app.pargs.major_increment,124 self.app.pargs.minor_increment,125 self.app.pargs.patch_increment,126 self.app.pargs.instance_type,127 {128 'id': self.app.pargs.vpc_id,129 'subnets': self.app.pargs.vpc_subnets,130 'publicip': self.app.pargs.vpc_publicip131 },132 timeout=self.app.pargs.timeout,133 tags=tags,134 )135 def get_instance_profile(self):136 profile_name = self.app.pargs.instance_profile137 if profile_name is None:138 try:139 profile_name = fileoperations.get_instance_profile()140 except NotInitializedError:141 pass142 if profile_name is None\143 or profile_name == iam_attributes.DEFAULT_PLATFORM_BUILDER_ROLE:144 profile_name = commonops.create_instance_profile(145 iam_attributes.DEFAULT_PLATFORM_BUILDER_ROLE,146 iam_attributes.DEFAULT_CUSTOM_PLATFORM_BUILDER_POLICIES147 )148 write_config_setting('global', 'instance_profile', profile_name)149class PlatformCreateController(GenericPlatformCreateController):150 Meta = GenericPlatformCreateController.Meta.clone()151 Meta.label = 'platform create'152 Meta.aliases = ['create']153 Meta.aliases_only = True...
iam.py
Source:iam.py
...4def get(name, platform, env):5 connection = iam.connect_to_region('universal')6 iam_role_name = "iam-%s-%s-%s" % (name, platform, env)7 try:8 instance_profile = connection.get_instance_profile(iam_role_name)9 except BotoServerError:10 instance_profile = connection.get_instance_profile('default-iam-role')11 return instance_profile['get_instance_profile_response']['get_instance_profile_result']['instance_profile']['instance_profile_name']12def getrole(short, group, platform, environment):13 iamconn = iam.connect_to_region('universal')14 if all([short, group, platform, environment]):15 try:16 instance_profile = iamconn.get_instance_profile(short+group+"-"+platform+"-"+environment+"-role")17 return instance_profile['get_instance_profile_response']['get_instance_profile_result']['instance_profile']['instance_profile_name']18 except BotoServerError:19 instance_profile = iamconn.get_instance_profile('default-iam-role')20 return instance_profile['get_instance_profile_response']['get_instance_profile_result']['instance_profile']['instance_profile_name']...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!