Show / Hide Table of Contents

Class EngineSplitTraffic

Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions.

To get more information about ServiceSplitTraffic, see:

  • API documentation

Example Usage - App Engine Service Split Traffic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var bucket = new Gcp.Storage.Bucket("bucket", new Gcp.Storage.BucketArgs
    {
    });
    var @object = new Gcp.Storage.BucketObject("object", new Gcp.Storage.BucketObjectArgs
    {
        Bucket = bucket.Name,
        Source = new FileAsset("./test-fixtures/appengine/hello-world.zip"),
    });
    var liveappV1 = new Gcp.AppEngine.StandardAppVersion("liveappV1", new Gcp.AppEngine.StandardAppVersionArgs
    {
        VersionId = "v1",
        Service = "liveapp",
        DeleteServiceOnDestroy = true,
        Runtime = "nodejs10",
        Entrypoint = new Gcp.AppEngine.Inputs.StandardAppVersionEntrypointArgs
        {
            Shell = "node ./app.js",
        },
        Deployment = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentArgs
        {
            Zip = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentZipArgs
            {
                SourceUrl = Output.Tuple(bucket.Name, @object.Name).Apply(values =>
                {
                    var bucketName = values.Item1;
                    var objectName = values.Item2;
                    return $"https://storage.googleapis.com/{bucketName}/{objectName}";
                }),
            },
        },
        EnvVariables = 
        {
            { "port", "8080" },
        },
    });
    var liveappV2 = new Gcp.AppEngine.StandardAppVersion("liveappV2", new Gcp.AppEngine.StandardAppVersionArgs
    {
        VersionId = "v2",
        Service = "liveapp",
        NoopOnDestroy = true,
        Runtime = "nodejs10",
        Entrypoint = new Gcp.AppEngine.Inputs.StandardAppVersionEntrypointArgs
        {
            Shell = "node ./app.js",
        },
        Deployment = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentArgs
        {
            Zip = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentZipArgs
            {
                SourceUrl = Output.Tuple(bucket.Name, @object.Name).Apply(values =>
                {
                    var bucketName = values.Item1;
                    var objectName = values.Item2;
                    return $"https://storage.googleapis.com/{bucketName}/{objectName}";
                }),
            },
        },
        EnvVariables = 
        {
            { "port", "8080" },
        },
    });
    var liveapp = new Gcp.AppEngine.EngineSplitTraffic("liveapp", new Gcp.AppEngine.EngineSplitTrafficArgs
    {
        Service = liveappV2.Service,
        MigrateTraffic = false,
        Split = new Gcp.AppEngine.Inputs.EngineSplitTrafficSplitArgs
        {
            ShardBy = "IP",
            Allocations = Output.Tuple(liveappV1.VersionId, liveappV2.VersionId).Apply(values =>
            {
                var liveappV1VersionId = values.Item1;
                var liveappV2VersionId = values.Item2;
                return 
                {
                    { liveappV1VersionId, 0.75 },
                    { liveappV2VersionId, 0.25 },
                };
            }),
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
EngineSplitTraffic
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.AppEngine
Assembly: Pulumi.Gcp.dll
Syntax
public class EngineSplitTraffic : CustomResource

Constructors

View Source

EngineSplitTraffic(String, EngineSplitTrafficArgs, CustomResourceOptions)

Create a EngineSplitTraffic resource with the given unique name, arguments, and options.

Declaration
public EngineSplitTraffic(string name, EngineSplitTrafficArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

EngineSplitTrafficArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

MigrateTraffic

If set to true traffic will be migrated to this version.

Declaration
public Output<bool?> MigrateTraffic { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

Service

The name of the service these settings apply to.

Declaration
public Output<string> Service { get; }
Property Value
Type Description
Output<System.String>
View Source

Split

Mapping that defines fractional HTTP traffic diversion to different versions within the service. Structure is documented below.

Declaration
public Output<EngineSplitTrafficSplit> Split { get; }
Property Value
Type Description
Output<EngineSplitTrafficSplit>

Methods

View Source

Get(String, Input<String>, EngineSplitTrafficState, CustomResourceOptions)

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

Declaration
public static EngineSplitTraffic Get(string name, Input<string> id, EngineSplitTrafficState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

EngineSplitTrafficState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
EngineSplitTraffic
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.