Best Python code snippet using localstack_python
provider.py
Source:provider.py
...89 elif resource_id[-1] != "-":90 t_secret_id += "-"91 return None if secret_id == t_secret_id else t_secret_id92 @staticmethod93 def _validate_secret_id(secret_id: SecretIdType) -> bool:94 # The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@-95 return bool(re.match(r"^[A-Za-z0-9/_+=.@-]+\Z", secret_id))96 @staticmethod97 def _raise_if_invalid_secret_id(secret_id: Union[SecretIdType, NameType]):98 # Patches moto's implementation for which secret_ids are not validated, by raising a ValidationException.99 # Skips this check if the secret_id provided appears to be an arn (starting with 'arn:').100 if not re.match(101 r"^arn:", secret_id102 ): # Check if it appears to be an arn: so to skip secret_id check: delegate parsing of arn to handlers.103 if not SecretsmanagerProvider._validate_secret_id(secret_id):104 raise ValidationException(105 "Invalid name. Must be a valid name containing alphanumeric "106 "characters, or any of the following: -/_+=.@!"107 )108 @staticmethod109 def _call_moto_with_request_secret_id(110 context: RequestContext, request: Dict111 ) -> ServiceResponse:112 t_secret_id = SecretsmanagerProvider._transform_context_secret_id(113 request.get("SecretId", None)114 )115 if t_secret_id:116 request.update({"SecretId": t_secret_id})117 return call_moto_with_request(context, request)...
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!!