samcli/lib/utils/managed_cloudformation_stack.py [38:89]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    region: Optional[str],
    stack_name: str,
    template_body: str,
    profile: Optional[str] = None,
    parameter_overrides: Optional[Dict[str, Union[str, List[str]]]] = None,
) -> StackOutput:
    """
    create or update a CloudFormation stack

    Parameters
    ----------
    region: str
        AWS region for the CloudFormation stack
    stack_name: str
        CloudFormation stack name
    template_body: str
        CloudFormation template's content
    profile: Optional[str]
        AWS named profile for the AWS account
    parameter_overrides: Optional[Dict[str, Union[str, List[str]]]]
        Values of template parameters, if any.

    Returns
    -------
    StackOutput:
        Stack output section(list of OutputKey, OutputValue pairs)
    """
    try:
        if profile:
            session = boto3.Session(profile_name=profile, region_name=region if region else None)
            cloudformation_client = session.client("cloudformation")
        else:
            cloudformation_client = boto3.client(
                "cloudformation", config=Config(region_name=region if region else None)
            )
    except ProfileNotFound as ex:
        raise AWSServiceClientError(
            f"Error Setting Up Managed Stack Client: the provided AWS name profile '{profile}' is not found. "
            "please check the documentation for setting up a named profile: "
            "https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html"
        ) from ex
    except NoCredentialsError as ex:
        raise AWSServiceClientError(
            "Error Setting Up Managed Stack Client: Unable to resolve credentials for the AWS SDK for Python client. "
            "Please see their documentation for options to pass in credentials: "
            "https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html"
        ) from ex
    except NoRegionError as ex:
        raise RegionError(
            "Error Setting Up Managed Stack Client: Unable to resolve a region. "
            "Please provide a region via the --region parameter or by the AWS_DEFAULT_REGION environment variable."
        ) from ex
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



samcli/lib/utils/managed_cloudformation_stack.py [94:145]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    region: Optional[str],
    stack_name: str,
    template_body: str,
    profile: Optional[str] = None,
    parameter_overrides: Optional[Dict[str, Union[str, List[str]]]] = None,
) -> StackOutput:
    """
    get or create a CloudFormation stack

    Parameters
    ----------
    region: str
        AWS region for the CloudFormation stack
    stack_name: str
        CloudFormation stack name
    template_body: str
        CloudFormation template's content
    profile: Optional[str]
        AWS named profile for the AWS account
    parameter_overrides: Optional[Dict[str, Union[str, List[str]]]]
        Values of template parameters, if any.

    Returns
    -------
    StackOutput:
        Stack output section(list of OutputKey, OutputValue pairs)
    """
    try:
        if profile:
            session = boto3.Session(profile_name=profile, region_name=region if region else None)
            cloudformation_client = session.client("cloudformation")
        else:
            cloudformation_client = boto3.client(
                "cloudformation", config=Config(region_name=region if region else None)
            )
    except ProfileNotFound as ex:
        raise AWSServiceClientError(
            f"Error Setting Up Managed Stack Client: the provided AWS name profile '{profile}' is not found. "
            "please check the documentation for setting up a named profile: "
            "https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html"
        ) from ex
    except NoCredentialsError as ex:
        raise AWSServiceClientError(
            "Error Setting Up Managed Stack Client: Unable to resolve credentials for the AWS SDK for Python client. "
            "Please see their documentation for options to pass in credentials: "
            "https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html"
        ) from ex
    except NoRegionError as ex:
        raise RegionError(
            "Error Setting Up Managed Stack Client: Unable to resolve a region. "
            "Please provide a region via the --region parameter or by the AWS_DEFAULT_REGION environment variable."
        ) from ex
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



