Skip to content

get_generated_template async

get_generated_template(
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = None,
    format: Optional[TemplateFormat] = None,
    generated_template_name: Optional[GeneratedTemplateName] = None,
) -> GetGeneratedTemplateOutput

Retrieves a generated template. If the template is in an InProgress or Pending status then the template returned will be the template when the template was last in a Complete status. If the template has not yet been in a Complete status then an empty template will be returned.

Parameters:

  • format (Optional[TemplateFormat], default: None ) –

    The language to use to retrieve for the generated template. Supported values are:

    • JSON

    • YAML

  • generated_template_name (Optional[GeneratedTemplateName], default: None ) –

    The name or Amazon Resource Name (ARN) of the generated template. The format is arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}. For example, arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc .

Raises:

Examples:

To get a generated template in JSON format This example gets a generated template ins JSON format.

>>> await client.get_generated_template(generated_template_name='JazzyTemplate')
To get a generated template in YAML format
This example gets a generated template in YAML format.
>>> await client.get_generated_template(generated_template_name='JazzyTemplate', format='YAML')
Source code in docs_src/capo_cloudformation/_services/async_cloud_formation.py
async def get_generated_template(
    self,
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = None,
    format: Optional[
        "capo_cloudformation.types.template_format.TemplateFormat"
    ] = None,
    generated_template_name: Optional[
        "capo_cloudformation.types.generated_template_name.GeneratedTemplateName"
    ] = None,
) -> "capo_cloudformation.types.get_generated_template_output.GetGeneratedTemplateOutput":
    """<p>Retrieves a generated template. If the template is in an <code>InProgress</code> or <code>Pending</code> status then the template returned will be the template when the template was last in a <code>Complete</code> status. If the template has not yet been in a <code>Complete</code> status then an empty template will be returned.</p>

    Args:
        format: <p>The language to use to retrieve for the generated template. Supported values are:</p> <ul> <li> <p> <code>JSON</code> </p> </li> <li> <p> <code>YAML</code> </p> </li> </ul>
        generated_template_name: <p>The name or Amazon Resource Name (ARN) of the generated template. The format is <code>arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}</code>. For example, <code>arn:aws:cloudformation:<i>us-east-1</i>:<i>123456789012</i>:generatedtemplate/<i>2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc</i> </code>.</p>

    Raises:
        capo_cloudformation.errors.generated_template_not_found_exception.GeneratedTemplateNotFoundException: <p>The generated template was not found.</p>
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get a generated template in JSON format
        This example gets a generated template ins JSON format.

        >>> await client.get_generated_template(generated_template_name='JazzyTemplate')
        To get a generated template in YAML format
        This example gets a generated template in YAML format.

        >>> await client.get_generated_template(generated_template_name='JazzyTemplate', format='YAML')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudformation.types.get_generated_template_input.GetGeneratedTemplateInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudformation.types.get_generated_template_output.GetGeneratedTemplateOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.get_generated_template

        (
            output,
            http_response,
        ) = await capo_cloudformation._operations.cloud_formation.get_generated_template.async_get_generated_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetGeneratedTemplate")
    )
    input_: capo_cloudformation.types.get_generated_template_input.GetGeneratedTemplateInput = {}
    if format is not None:
        input_["format"] = format
    if generated_template_name is not None:
        input_["generated_template_name"] = generated_template_name

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output