1. Packages
  2. Gcore Provider
  3. API Docs
  4. CdnAppliedPreset
gcore 0.19.0 published on Monday, Apr 14, 2025 by g-core

gcore.CdnAppliedPreset

Explore with Pulumi AI

Represent applied preset

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcore from "@pulumi/gcore";

const liveStreaming = gcore.getCdnPreset({
    id: 52,
    name: "LIVE STREAMING",
});
const originGroup1 = new gcore.CdnOrigingroup("originGroup1", {
    useNext: true,
    origins: [{
        source: "example.com",
        enabled: true,
    }],
});
const cdnExampleCom = new gcore.CdnResource("cdnExampleCom", {
    cname: "cdn.example.com",
    originGroup: originGroup1.cdnOrigingroupId,
    originProtocol: "MATCH",
});
const demoPreset = new gcore.CdnAppliedPreset("demoPreset", {
    presetId: liveStreaming.then(liveStreaming => liveStreaming.id),
    objectId: gcore_cdn_resource.demo_resource.id,
});
Copy
import pulumi
import pulumi_gcore as gcore

live_streaming = gcore.get_cdn_preset(id=52,
    name="LIVE STREAMING")
origin_group1 = gcore.CdnOrigingroup("originGroup1",
    use_next=True,
    origins=[{
        "source": "example.com",
        "enabled": True,
    }])
cdn_example_com = gcore.CdnResource("cdnExampleCom",
    cname="cdn.example.com",
    origin_group=origin_group1.cdn_origingroup_id,
    origin_protocol="MATCH")
demo_preset = gcore.CdnAppliedPreset("demoPreset",
    preset_id=live_streaming.id,
    object_id=gcore_cdn_resource["demo_resource"]["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		liveStreaming, err := gcore.GetCdnPreset(ctx, &gcore.GetCdnPresetArgs{
			Id:   52,
			Name: "LIVE STREAMING",
		}, nil)
		if err != nil {
			return err
		}
		originGroup1, err := gcore.NewCdnOrigingroup(ctx, "originGroup1", &gcore.CdnOrigingroupArgs{
			UseNext: pulumi.Bool(true),
			Origins: gcore.CdnOrigingroupOriginArray{
				&gcore.CdnOrigingroupOriginArgs{
					Source:  pulumi.String("example.com"),
					Enabled: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = gcore.NewCdnResource(ctx, "cdnExampleCom", &gcore.CdnResourceArgs{
			Cname:          pulumi.String("cdn.example.com"),
			OriginGroup:    originGroup1.CdnOrigingroupId,
			OriginProtocol: pulumi.String("MATCH"),
		})
		if err != nil {
			return err
		}
		_, err = gcore.NewCdnAppliedPreset(ctx, "demoPreset", &gcore.CdnAppliedPresetArgs{
			PresetId: pulumi.Float64(liveStreaming.Id),
			ObjectId: pulumi.Any(gcore_cdn_resource.Demo_resource.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcore = Pulumi.Gcore;

return await Deployment.RunAsync(() => 
{
    var liveStreaming = Gcore.GetCdnPreset.Invoke(new()
    {
        Id = 52,
        Name = "LIVE STREAMING",
    });

    var originGroup1 = new Gcore.CdnOrigingroup("originGroup1", new()
    {
        UseNext = true,
        Origins = new[]
        {
            new Gcore.Inputs.CdnOrigingroupOriginArgs
            {
                Source = "example.com",
                Enabled = true,
            },
        },
    });

    var cdnExampleCom = new Gcore.CdnResource("cdnExampleCom", new()
    {
        Cname = "cdn.example.com",
        OriginGroup = originGroup1.CdnOrigingroupId,
        OriginProtocol = "MATCH",
    });

    var demoPreset = new Gcore.CdnAppliedPreset("demoPreset", new()
    {
        PresetId = liveStreaming.Apply(getCdnPresetResult => getCdnPresetResult.Id),
        ObjectId = gcore_cdn_resource.Demo_resource.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.GcoreFunctions;
import com.pulumi.gcore.inputs.GetCdnPresetArgs;
import com.pulumi.gcore.CdnOrigingroup;
import com.pulumi.gcore.CdnOrigingroupArgs;
import com.pulumi.gcore.inputs.CdnOrigingroupOriginArgs;
import com.pulumi.gcore.CdnResource;
import com.pulumi.gcore.CdnResourceArgs;
import com.pulumi.gcore.CdnAppliedPreset;
import com.pulumi.gcore.CdnAppliedPresetArgs;
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 liveStreaming = GcoreFunctions.getCdnPreset(GetCdnPresetArgs.builder()
            .id(52)
            .name("LIVE STREAMING")
            .build());

        var originGroup1 = new CdnOrigingroup("originGroup1", CdnOrigingroupArgs.builder()
            .useNext(true)
            .origins(CdnOrigingroupOriginArgs.builder()
                .source("example.com")
                .enabled(true)
                .build())
            .build());

        var cdnExampleCom = new CdnResource("cdnExampleCom", CdnResourceArgs.builder()
            .cname("cdn.example.com")
            .originGroup(originGroup1.cdnOrigingroupId())
            .originProtocol("MATCH")
            .build());

        var demoPreset = new CdnAppliedPreset("demoPreset", CdnAppliedPresetArgs.builder()
            .presetId(liveStreaming.applyValue(getCdnPresetResult -> getCdnPresetResult.id()))
            .objectId(gcore_cdn_resource.demo_resource().id())
            .build());

    }
}
Copy
resources:
  originGroup1:
    type: gcore:CdnOrigingroup
    properties:
      useNext: true
      origins:
        - source: example.com
          enabled: true
  cdnExampleCom:
    type: gcore:CdnResource
    properties:
      cname: cdn.example.com
      originGroup: ${originGroup1.cdnOrigingroupId}
      originProtocol: MATCH
  demoPreset:
    type: gcore:CdnAppliedPreset
    properties:
      presetId: ${liveStreaming.id}
      objectId: ${gcore_cdn_resource.demo_resource.id}
variables:
  liveStreaming:
    fn::invoke:
      function: gcore:getCdnPreset
      arguments:
        id: 52
        name: LIVE STREAMING
Copy

Create CdnAppliedPreset Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new CdnAppliedPreset(name: string, args: CdnAppliedPresetArgs, opts?: CustomResourceOptions);
@overload
def CdnAppliedPreset(resource_name: str,
                     args: CdnAppliedPresetArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def CdnAppliedPreset(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     object_id: Optional[float] = None,
                     preset_id: Optional[float] = None,
                     cdn_applied_preset_id: Optional[str] = None)
func NewCdnAppliedPreset(ctx *Context, name string, args CdnAppliedPresetArgs, opts ...ResourceOption) (*CdnAppliedPreset, error)
public CdnAppliedPreset(string name, CdnAppliedPresetArgs args, CustomResourceOptions? opts = null)
public CdnAppliedPreset(String name, CdnAppliedPresetArgs args)
public CdnAppliedPreset(String name, CdnAppliedPresetArgs args, CustomResourceOptions options)
type: gcore:CdnAppliedPreset
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CdnAppliedPresetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CdnAppliedPresetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CdnAppliedPresetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CdnAppliedPresetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CdnAppliedPresetArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var cdnAppliedPresetResource = new Gcore.CdnAppliedPreset("cdnAppliedPresetResource", new()
{
    ObjectId = 0,
    PresetId = 0,
    CdnAppliedPresetId = "string",
});
Copy
example, err := gcore.NewCdnAppliedPreset(ctx, "cdnAppliedPresetResource", &gcore.CdnAppliedPresetArgs{
ObjectId: pulumi.Float64(0),
PresetId: pulumi.Float64(0),
CdnAppliedPresetId: pulumi.String("string"),
})
Copy
var cdnAppliedPresetResource = new CdnAppliedPreset("cdnAppliedPresetResource", CdnAppliedPresetArgs.builder()
    .objectId(0)
    .presetId(0)
    .cdnAppliedPresetId("string")
    .build());
Copy
cdn_applied_preset_resource = gcore.CdnAppliedPreset("cdnAppliedPresetResource",
    object_id=0,
    preset_id=0,
    cdn_applied_preset_id="string")
Copy
const cdnAppliedPresetResource = new gcore.CdnAppliedPreset("cdnAppliedPresetResource", {
    objectId: 0,
    presetId: 0,
    cdnAppliedPresetId: "string",
});
Copy
type: gcore:CdnAppliedPreset
properties:
    cdnAppliedPresetId: string
    objectId: 0
    presetId: 0
Copy

CdnAppliedPreset Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The CdnAppliedPreset resource accepts the following input properties:

ObjectId This property is required. double
ID of CDN object (resource, rule) for which preset will be applied
PresetId This property is required. double
ID of CDN preset which will be applied to the object
CdnAppliedPresetId string
The ID of this resource.
ObjectId This property is required. float64
ID of CDN object (resource, rule) for which preset will be applied
PresetId This property is required. float64
ID of CDN preset which will be applied to the object
CdnAppliedPresetId string
The ID of this resource.
objectId This property is required. Double
ID of CDN object (resource, rule) for which preset will be applied
presetId This property is required. Double
ID of CDN preset which will be applied to the object
cdnAppliedPresetId String
The ID of this resource.
objectId This property is required. number
ID of CDN object (resource, rule) for which preset will be applied
presetId This property is required. number
ID of CDN preset which will be applied to the object
cdnAppliedPresetId string
The ID of this resource.
object_id This property is required. float
ID of CDN object (resource, rule) for which preset will be applied
preset_id This property is required. float
ID of CDN preset which will be applied to the object
cdn_applied_preset_id str
The ID of this resource.
objectId This property is required. Number
ID of CDN object (resource, rule) for which preset will be applied
presetId This property is required. Number
ID of CDN preset which will be applied to the object
cdnAppliedPresetId String
The ID of this resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the CdnAppliedPreset resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing CdnAppliedPreset Resource

Get an existing CdnAppliedPreset resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CdnAppliedPresetState, opts?: CustomResourceOptions): CdnAppliedPreset
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cdn_applied_preset_id: Optional[str] = None,
        object_id: Optional[float] = None,
        preset_id: Optional[float] = None) -> CdnAppliedPreset
func GetCdnAppliedPreset(ctx *Context, name string, id IDInput, state *CdnAppliedPresetState, opts ...ResourceOption) (*CdnAppliedPreset, error)
public static CdnAppliedPreset Get(string name, Input<string> id, CdnAppliedPresetState? state, CustomResourceOptions? opts = null)
public static CdnAppliedPreset get(String name, Output<String> id, CdnAppliedPresetState state, CustomResourceOptions options)
resources:  _:    type: gcore:CdnAppliedPreset    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CdnAppliedPresetId string
The ID of this resource.
ObjectId double
ID of CDN object (resource, rule) for which preset will be applied
PresetId double
ID of CDN preset which will be applied to the object
CdnAppliedPresetId string
The ID of this resource.
ObjectId float64
ID of CDN object (resource, rule) for which preset will be applied
PresetId float64
ID of CDN preset which will be applied to the object
cdnAppliedPresetId String
The ID of this resource.
objectId Double
ID of CDN object (resource, rule) for which preset will be applied
presetId Double
ID of CDN preset which will be applied to the object
cdnAppliedPresetId string
The ID of this resource.
objectId number
ID of CDN object (resource, rule) for which preset will be applied
presetId number
ID of CDN preset which will be applied to the object
cdn_applied_preset_id str
The ID of this resource.
object_id float
ID of CDN object (resource, rule) for which preset will be applied
preset_id float
ID of CDN preset which will be applied to the object
cdnAppliedPresetId String
The ID of this resource.
objectId Number
ID of CDN object (resource, rule) for which preset will be applied
presetId Number
ID of CDN preset which will be applied to the object

Import

import using <preset_id>:<object_id>

$ pulumi import gcore:index/cdnAppliedPreset:CdnAppliedPreset demo_preset 52:123456
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
gcore g-core/terraform-provider-gcore
License
Notes
This Pulumi package is based on the gcore Terraform Provider.