akamai.getPropertyRulesTemplate

Attributes reference

This data source returns this attribute:

  • json - The fully expanded template with variables and all nested templates resolved.

Example Usage

Single JSON template that calls other templates

using System.Collections.Generic;
using Pulumi;

return await Deployment.RunAsync(() => 
{
});
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
import pulumi
import * as pulumi from "@pulumi/pulumi";
{}

Individual JSON rule template file

using System.Collections.Generic;
using Pulumi;

return await Deployment.RunAsync(() => 
{
});
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
    }
}
import pulumi
import * as pulumi from "@pulumi/pulumi";
{}

Call individual template files with this data source

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using Akamai = Pulumi.Akamai;

return await Deployment.RunAsync(() => 
{
    var examplePropertyRulesTemplate = Akamai.GetPropertyRulesTemplate.Invoke(new()
    {
        Templates = new[]
        {
            new Akamai.Inputs.GetPropertyRulesTemplateTemplateInputArgs
            {
                TemplateData = JsonSerializer.Serialize(new Dictionary<string, object?>
                {
                    ["rules"] = new Dictionary<string, object?>
                    {
                        ["name"] = "default",
                        ["children"] = new[]
                        {
                            "#include:rules.json",
                        },
                    },
                }),
                TemplateDir = "property-snippets/",
            },
        },
    });

    var exampleProperty = new Akamai.Property("exampleProperty", new()
    {
        ContractId = @var.Contractid,
        GroupId = @var.Groupid,
        RuleFormat = "v2020-03-04",
        Rules = examplePropertyRulesTemplate.Apply(getPropertyRulesTemplateResult => getPropertyRulesTemplateResult.Json),
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-akamai/sdk/v4/go/akamai"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"rules": map[string]interface{}{
				"name": "default",
				"children": []string{
					"#include:rules.json",
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		examplePropertyRulesTemplate, err := akamai.GetPropertyRulesTemplate(ctx, &akamai.GetPropertyRulesTemplateArgs{
			Templates: []akamai.GetPropertyRulesTemplateTemplate{
				{
					TemplateData: json0,
					TemplateDir:  "property-snippets/",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = akamai.NewProperty(ctx, "exampleProperty", &akamai.PropertyArgs{
			ContractId: pulumi.Any(_var.Contractid),
			GroupId:    pulumi.Any(_var.Groupid),
			RuleFormat: pulumi.String("v2020-03-04"),
			Rules:      *pulumi.String(examplePropertyRulesTemplate.Json),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.akamai.AkamaiFunctions;
import com.pulumi.akamai.inputs.GetPropertyRulesTemplateArgs;
import com.pulumi.akamai.Property;
import com.pulumi.akamai.PropertyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var examplePropertyRulesTemplate = AkamaiFunctions.getPropertyRulesTemplate(GetPropertyRulesTemplateArgs.builder()
            .templates(GetPropertyRulesTemplateTemplateArgs.builder()
                .templateData(serializeJson(
                    jsonObject(
                        jsonProperty("rules", jsonObject(
                            jsonProperty("name", "default"),
                            jsonProperty("children", jsonArray("#include:rules.json"))
                        ))
                    )))
                .templateDir("property-snippets/")
                .build())
            .build());

        var exampleProperty = new Property("exampleProperty", PropertyArgs.builder()        
            .contractId(var_.contractid())
            .groupId(var_.groupid())
            .ruleFormat("v2020-03-04")
            .rules(examplePropertyRulesTemplate.applyValue(getPropertyRulesTemplateResult -> getPropertyRulesTemplateResult.json()))
            .build());

    }
}
import pulumi
import json
import pulumi_akamai as akamai

example_property_rules_template = akamai.get_property_rules_template(templates=[akamai.GetPropertyRulesTemplateTemplateArgs(
    template_data=json.dumps({
        "rules": {
            "name": "default",
            "children": ["#include:rules.json"],
        },
    }),
    template_dir="property-snippets/",
)])
example_property = akamai.Property("exampleProperty",
    contract_id=var["contractid"],
    group_id=var["groupid"],
    rule_format="v2020-03-04",
    rules=example_property_rules_template.json)
import * as pulumi from "@pulumi/pulumi";
import * as akamai from "@pulumi/akamai";

const examplePropertyRulesTemplate = akamai.getPropertyRulesTemplate({
    templates: [{
        templateData: JSON.stringify({
            rules: {
                name: "default",
                children: ["#include:rules.json"],
            },
        }),
        templateDir: "property-snippets/",
    }],
});
const exampleProperty = new akamai.Property("exampleProperty", {
    contractId: _var.contractid,
    groupId: _var.groupid,
    ruleFormat: "v2020-03-04",
    rules: examplePropertyRulesTemplate.then(examplePropertyRulesTemplate => examplePropertyRulesTemplate.json),
});
resources:
  exampleProperty:
    type: akamai:Property
    properties:
      contractId: ${var.contractid}
      groupId: ${var.groupid}
      ruleFormat: v2020-03-04
      rules: ${examplePropertyRulesTemplate.json}
variables:
  examplePropertyRulesTemplate:
    fn::invoke:
      Function: akamai:getPropertyRulesTemplate
      Arguments:
        templates:
          - templateData:
              fn::toJSON:
                rules:
                  name: default
                  children:
                    - '#include:rules.json'
            templateDir: property-snippets/

Using getPropertyRulesTemplate

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getPropertyRulesTemplate(args: GetPropertyRulesTemplateArgs, opts?: InvokeOptions): Promise<GetPropertyRulesTemplateResult>
function getPropertyRulesTemplateOutput(args: GetPropertyRulesTemplateOutputArgs, opts?: InvokeOptions): Output<GetPropertyRulesTemplateResult>
def get_property_rules_template(template_file: Optional[str] = None,
                                templates: Optional[Sequence[GetPropertyRulesTemplateTemplate]] = None,
                                var_definition_file: Optional[str] = None,
                                var_values_file: Optional[str] = None,
                                variables: Optional[Sequence[GetPropertyRulesTemplateVariable]] = None,
                                opts: Optional[InvokeOptions] = None) -> GetPropertyRulesTemplateResult
def get_property_rules_template_output(template_file: Optional[pulumi.Input[str]] = None,
                                templates: Optional[pulumi.Input[Sequence[pulumi.Input[GetPropertyRulesTemplateTemplateArgs]]]] = None,
                                var_definition_file: Optional[pulumi.Input[str]] = None,
                                var_values_file: Optional[pulumi.Input[str]] = None,
                                variables: Optional[pulumi.Input[Sequence[pulumi.Input[GetPropertyRulesTemplateVariableArgs]]]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetPropertyRulesTemplateResult]
func GetPropertyRulesTemplate(ctx *Context, args *GetPropertyRulesTemplateArgs, opts ...InvokeOption) (*GetPropertyRulesTemplateResult, error)
func GetPropertyRulesTemplateOutput(ctx *Context, args *GetPropertyRulesTemplateOutputArgs, opts ...InvokeOption) GetPropertyRulesTemplateResultOutput

> Note: This function is named GetPropertyRulesTemplate in the Go SDK.

public static class GetPropertyRulesTemplate 
{
    public static Task<GetPropertyRulesTemplateResult> InvokeAsync(GetPropertyRulesTemplateArgs args, InvokeOptions? opts = null)
    public static Output<GetPropertyRulesTemplateResult> Invoke(GetPropertyRulesTemplateInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPropertyRulesTemplateResult> getPropertyRulesTemplate(GetPropertyRulesTemplateArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: akamai:index/getPropertyRulesTemplate:getPropertyRulesTemplate
  arguments:
    # arguments dictionary

The following arguments are supported:

TemplateFile string

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

Templates List<GetPropertyRulesTemplateTemplate>

The template you use in your configuration. This argument conflicts with the template_file argument.

VarDefinitionFile string

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

VarValuesFile string

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

Variables List<GetPropertyRulesTemplateVariable>

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

TemplateFile string

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

Templates []GetPropertyRulesTemplateTemplate

The template you use in your configuration. This argument conflicts with the template_file argument.

VarDefinitionFile string

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

VarValuesFile string

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

Variables []GetPropertyRulesTemplateVariable

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

templateFile String

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

templates List<GetPropertyRulesTemplateTemplate>

The template you use in your configuration. This argument conflicts with the template_file argument.

varDefinitionFile String

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

varValuesFile String

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

variables List<GetPropertyRulesTemplateVariable>

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

templateFile string

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

templates GetPropertyRulesTemplateTemplate[]

The template you use in your configuration. This argument conflicts with the template_file argument.

varDefinitionFile string

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

varValuesFile string

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

variables GetPropertyRulesTemplateVariable[]

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

template_file str

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

templates Sequence[GetPropertyRulesTemplateTemplate]

The template you use in your configuration. This argument conflicts with the template_file argument.

var_definition_file str

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

var_values_file str

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

variables Sequence[GetPropertyRulesTemplateVariable]

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

templateFile String

The absolute path to your top-level JSON template file. The top-level template combines smaller, nested JSON templates to form your property rule tree. This argument conflicts with the template argument.

templates List<Property Map>

The template you use in your configuration. This argument conflicts with the template_file argument.

varDefinitionFile String

Required when using var_values_file. The absolute path to the file containing variable definitions and defaults. This argument conflicts with the variables argument.

varValuesFile String

Required when using var_definition_file. The absolute path to the file containing variable values. This argument conflicts with the variables argument.

variables List<Property Map>

The definition of one or more variables. This argument conflicts with the var_definition_file and var_values_file arguments. A variables block includes:

getPropertyRulesTemplate Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Json string
TemplateFile string
Templates List<GetPropertyRulesTemplateTemplate>
VarDefinitionFile string
VarValuesFile string
Variables List<GetPropertyRulesTemplateVariable>
Id string

The provider-assigned unique ID for this managed resource.

Json string
TemplateFile string
Templates []GetPropertyRulesTemplateTemplate
VarDefinitionFile string
VarValuesFile string
Variables []GetPropertyRulesTemplateVariable
id String

The provider-assigned unique ID for this managed resource.

json String
templateFile String
templates List<GetPropertyRulesTemplateTemplate>
varDefinitionFile String
varValuesFile String
variables List<GetPropertyRulesTemplateVariable>
id string

The provider-assigned unique ID for this managed resource.

json string
templateFile string
templates GetPropertyRulesTemplateTemplate[]
varDefinitionFile string
varValuesFile string
variables GetPropertyRulesTemplateVariable[]
id String

The provider-assigned unique ID for this managed resource.

json String
templateFile String
templates List<Property Map>
varDefinitionFile String
varValuesFile String
variables List<Property Map>

Supporting Types

GetPropertyRulesTemplateTemplate

TemplateData string

The content of the JSON template as a string.

TemplateDir string

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

TemplateData string

The content of the JSON template as a string.

TemplateDir string

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

templateData String

The content of the JSON template as a string.

templateDir String

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

templateData string

The content of the JSON template as a string.

templateDir string

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

template_data str

The content of the JSON template as a string.

template_dir str

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

templateData String

The content of the JSON template as a string.

templateDir String

The absolute or relative path to the directory containing the template files. The path must end with property-snippets, the required directory name. For example: template_dir = abspath("${path.root}/property-snippets/"), or template_dir = "property-snippets/".

GetPropertyRulesTemplateVariable

Name string

The name of the variable used in the template.

Value string

The value of the variable passed as a string.

Type string

The type of variable: string, number, bool, or jsonBlock.

Name string

The name of the variable used in the template.

Value string

The value of the variable passed as a string.

Type string

The type of variable: string, number, bool, or jsonBlock.

name String

The name of the variable used in the template.

value String

The value of the variable passed as a string.

type String

The type of variable: string, number, bool, or jsonBlock.

name string

The name of the variable used in the template.

value string

The value of the variable passed as a string.

type string

The type of variable: string, number, bool, or jsonBlock.

name str

The name of the variable used in the template.

value str

The value of the variable passed as a string.

type str

The type of variable: string, number, bool, or jsonBlock.

name String

The name of the variable used in the template.

value String

The value of the variable passed as a string.

type String

The type of variable: string, number, bool, or jsonBlock.

Package Details

Repository
Akamai pulumi/pulumi-akamai
License
Apache-2.0
Notes

This Pulumi package is based on the akamai Terraform Provider.