How to use change_set_id method in localstack

Best Python code snippet using localstack_python

exceptions.py

Source:exceptions.py Github

copy

Full Screen

1from __future__ import print_function2from __future__ import division3from __future__ import absolute_import4class InvalidConfig(Exception):5 def __init__(self, errors):6 super(InvalidConfig, self).__init__(errors)7 self.errors = errors8class InvalidLookupCombination(Exception):9 def __init__(self, lookup, lookups, value, *args, **kwargs):10 message = (11 "Lookup: \"{}\" has non-string return value, must be only lookup "12 "present (not {}) in \"{}\""13 ).format(str(lookup), len(lookups), value)14 super(InvalidLookupCombination, self).__init__(message,15 *args,16 **kwargs)17class InvalidLookupConcatenation(Exception):18 """19 Intermediary Exception to be converted to InvalidLookupCombination once it20 bubbles up there21 """22 def __init__(self, lookup, lookups, *args, **kwargs):23 self.lookup = lookup24 self.lookups = lookups25 super(InvalidLookupConcatenation, self).__init__("", *args, **kwargs)26class UnknownLookupType(Exception):27 def __init__(self, lookup_type, *args, **kwargs):28 message = "Unknown lookup type: \"{}\"".format(lookup_type)29 super(UnknownLookupType, self).__init__(message, *args, **kwargs)30class FailedVariableLookup(Exception):31 def __init__(self, variable_name, lookup, error, *args, **kwargs):32 self.lookup = lookup33 self.error = error34 message = "Couldn't resolve lookup in variable `%s`, " % variable_name35 message += "lookup: ${%s}: " % repr(lookup)36 message += "(%s) %s" % (error.__class__, error)37 super(FailedVariableLookup, self).__init__(message, *args, **kwargs)38class FailedLookup(Exception):39 """40 Intermediary Exception to be converted to FailedVariableLookup once it41 bubbles up there42 """43 def __init__(self, lookup, error, *args, **kwargs):44 self.lookup = lookup45 self.error = error46 super(FailedLookup, self).__init__("Failed lookup", *args, **kwargs)47class InvalidUserdataPlaceholder(Exception):48 def __init__(self, blueprint_name, exception_message, *args, **kwargs):49 message = exception_message + ". "50 message += "Could not parse userdata in blueprint \"%s\". " % (51 blueprint_name)52 message += "Make sure to escape all $ symbols with a $$."53 super(InvalidUserdataPlaceholder, self).__init__(54 message, *args, **kwargs)55class UnresolvedVariables(Exception):56 def __init__(self, blueprint_name, *args, **kwargs):57 message = "Blueprint: \"%s\" hasn't resolved it's variables" % (58 blueprint_name)59 super(UnresolvedVariables, self).__init__(message, *args, **kwargs)60class UnresolvedVariable(Exception):61 def __init__(self, blueprint_name, variable, *args, **kwargs):62 message = (63 "Variable \"%s\" in blueprint \"%s\" hasn't been resolved" % (64 variable.name, blueprint_name65 )66 )67 super(UnresolvedVariable, self).__init__(message, *args, **kwargs)68class UnresolvedVariableValue(Exception):69 """70 Intermediary Exception to be converted to UnresolvedVariable once it71 bubbles up there72 """73 def __init__(self, lookup, *args, **kwargs):74 self.lookup = lookup75 super(UnresolvedVariableValue, self).__init__(76 "Unresolved lookup", *args, **kwargs)77class MissingVariable(Exception):78 def __init__(self, blueprint_name, variable_name, *args, **kwargs):79 message = "Variable \"%s\" in blueprint \"%s\" is missing" % (80 variable_name, blueprint_name)81 super(MissingVariable, self).__init__(message, *args, **kwargs)82class VariableTypeRequired(Exception):83 def __init__(self, blueprint_name, variable_name, *args, **kwargs):84 message = (85 "Variable \"%s\" in blueprint \"%s\" does not have a type" % (86 variable_name, blueprint_name)87 )88 super(VariableTypeRequired, self).__init__(message, *args, **kwargs)89class StackDoesNotExist(Exception):90 def __init__(self, stack_name, *args, **kwargs):91 message = ("Stack: \"%s\" does not exist in outputs or the lookup is "92 "not available in this stacker run") % (stack_name,)93 super(StackDoesNotExist, self).__init__(message, *args, **kwargs)94class MissingParameterException(Exception):95 def __init__(self, parameters, *args, **kwargs):96 self.parameters = parameters97 message = "Missing required cloudformation parameters: %s" % (98 ", ".join(parameters),99 )100 super(MissingParameterException, self).__init__(message, *args,101 **kwargs)102class OutputDoesNotExist(Exception):103 def __init__(self, stack_name, output, *args, **kwargs):104 self.stack_name = stack_name105 self.output = output106 message = "Output %s does not exist on stack %s" % (output,107 stack_name)108 super(OutputDoesNotExist, self).__init__(message, *args, **kwargs)109class MissingEnvironment(Exception):110 def __init__(self, key, *args, **kwargs):111 self.key = key112 message = "Environment missing key %s." % (key,)113 super(MissingEnvironment, self).__init__(message, *args, **kwargs)114class WrongEnvironmentType(Exception):115 def __init__(self, key, *args, **kwargs):116 self.key = key117 message = "Environment key %s can't be merged into a string" % (key,)118 super(WrongEnvironmentType, self).__init__(message, *args, **kwargs)119class ImproperlyConfigured(Exception):120 def __init__(self, cls, error, *args, **kwargs):121 message = "Class \"%s\" is improperly configured: %s" % (122 cls,123 error,124 )125 super(ImproperlyConfigured, self).__init__(message, *args, **kwargs)126class StackDidNotChange(Exception):127 """Exception raised when there are no changes to be made by the128 provider.129 """130class CancelExecution(Exception):131 """Exception raised when we want to cancel executing the plan."""132class ValidatorError(Exception):133 """Used for errors raised by custom validators of blueprint variables.134 """135 def __init__(self, variable, validator, value, exception=None):136 self.variable = variable137 self.validator = validator138 self.value = value139 self.exception = exception140 self.message = ("Validator '%s' failed for variable '%s' with value "141 "'%s'") % (self.validator, self.variable, self.value)142 if self.exception:143 self.message += ": %s: %s" % (self.exception.__class__.__name__,144 str(self.exception))145 def __str__(self):146 return self.message147class ChangesetDidNotStabilize(Exception):148 def __init__(self, change_set_id):149 self.id = change_set_id150 message = "Changeset '%s' did not reach a completed state." % (151 change_set_id152 )153 super(ChangesetDidNotStabilize, self).__init__(message)154class UnhandledChangeSetStatus(Exception):155 def __init__(self, stack_name, change_set_id, status, status_reason):156 self.stack_name = stack_name157 self.id = change_set_id158 self.status = status159 self.status_reason = status_reason160 message = (161 "Changeset '%s' on stack '%s' returned an unhandled status "162 "'%s: %s'." % (change_set_id, stack_name, status,163 status_reason)164 )165 super(UnhandledChangeSetStatus, self).__init__(message)166class UnableToExecuteChangeSet(Exception):167 def __init__(self, stack_name, change_set_id, execution_status):168 self.stack_name = stack_name169 self.id = change_set_id170 self.execution_status = execution_status171 message = ("Changeset '%s' on stack '%s' had bad execution status: "172 "%s" % (change_set_id, stack_name, execution_status))173 super(UnableToExecuteChangeSet, self).__init__(message)174class StackUpdateBadStatus(Exception):175 def __init__(self, stack_name, stack_status, reason, *args, **kwargs):176 self.stack_name = stack_name177 self.stack_status = stack_status178 message = ("Stack: \"%s\" cannot be updated nor re-created from state "179 "%s: %s" % (stack_name, stack_status, reason))180 super(StackUpdateBadStatus, self).__init__(message, *args, **kwargs)181class PlanFailed(Exception):182 def __init__(self, failed_steps, *args, **kwargs):183 self.failed_steps = failed_steps184 step_names = ', '.join(step.name for step in failed_steps)185 message = "The following steps failed: %s" % (step_names,)186 super(PlanFailed, self).__init__(message, *args, **kwargs)187class GraphError(Exception):188 """Raised when the graph is invalid (e.g. acyclic dependencies)189 """190 def __init__(self, exception, stack, dependency):191 self.stack = stack192 self.dependency = dependency193 self.exception = exception194 message = (195 "Error detected when adding '%s' "196 "as a dependency of '%s': %s"197 ) % (dependency, stack, str(exception))...

Full Screen

Full Screen

cfn_stack.py

Source:cfn_stack.py Github

copy

Full Screen

1# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"). You4# may not use this file except in compliance with the License. A copy of5# the License is located at6#7# http://aws.amazon.com/apache2.0/8#9# or in the "license" file accompanying this file. This file is10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF11# ANY KIND, either express or implied. See the License for the specific12# language governing permissions and limitations under the License.13class CFNStack(object):14 def __init__(15 self,16 stack_id=None,17 stack_name=None,18 change_set_id=None,19 description=None,20 creation_time=None,21 deletion_time=None,22 last_updated_time=None,23 stack_status=None,24 stack_status_reason=None,25 enable_termination_protection=None,26 ):27 self.stack_id = stack_id28 self.stack_name = stack_name29 self.change_set_id = change_set_id30 self.description = description31 self.creation_time = creation_time32 self.deletion_time = deletion_time33 self.last_updated_time = last_updated_time34 self.stack_status = stack_status35 self.stack_status_reason = stack_status_reason36 self.enable_termination_protection = enable_termination_protection37 def __str__(self):38 return self.stack_name39 @classmethod40 def json_to_stack_object(cls, cfn_stack_json):41 return CFNStack(42 stack_id=cfn_stack_json.get('StackId'),43 stack_name=cfn_stack_json.get('StackName'),44 change_set_id=cfn_stack_json.get('ChangeSetId'),45 description=cfn_stack_json.get('Sescription'),46 creation_time=cfn_stack_json.get('CreationTime'),47 deletion_time=cfn_stack_json.get('DeletionTime'),48 last_updated_time=cfn_stack_json.get('LastUpdatedTime'),49 stack_status=cfn_stack_json.get('StackStatus'),50 stack_status_reason=cfn_stack_json.get('StackStatusReason'),51 enable_termination_protection=cfn_stack_json.get(52 'EnableTerminationProtection'53 )...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful