Skip to content

get_stack_policy

get_stack_policy(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_name: Optional[StackName] = None,
) -> GetStackPolicyOutput

Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.

Parameters:

  • stack_name (Optional[StackName], default: None ) –

    The name or unique stack ID that's associated with the stack whose policy you want to get.

Raises:

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def get_stack_policy(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_name: Optional["capo_cloudformation.types.stack_name.StackName"] = None,
) -> "capo_cloudformation.types.get_stack_policy_output.GetStackPolicyOutput":
    """<p>Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.</p>

    Args:
        stack_name: <p>The name or unique stack ID that's associated with the stack whose policy you want to get.</p>

    Raises:
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.get_stack_policy_input.GetStackPolicyInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.get_stack_policy_output.GetStackPolicyOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.get_stack_policy

        output, http_response = (
            capo_cloudformation._operations.cloud_formation.get_stack_policy.get_stack_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetStackPolicy")
    )
    input_: capo_cloudformation.types.get_stack_policy_input.GetStackPolicyInput = {}
    if stack_name is not None:
        input_["stack_name"] = stack_name

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output