Skip to content

get_stack_policy async

get_stack_policy(
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = 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/async_cloud_formation.py
async def get_stack_policy(
    self,
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = 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.
    """

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

        (
            output,
            http_response,
        ) = await capo_cloudformation._operations.cloud_formation.get_stack_policy.async_get_stack_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(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 = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output