ServiceArgs

data class ServiceArgs(val grpcConfig: Output<String>? = null, val openapiConfig: Output<String>? = null, val project: Output<String>? = null, val protocOutputBase64: Output<String>? = null, val serviceName: Output<String>? = null) : ConvertibleToJava<ServiceArgs>

This resource creates and rolls out a Cloud Endpoints service using OpenAPI or gRPC. View the relevant docs for OpenAPI and gRPC.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as std from "@pulumi/std";
const openapiService = new gcp.endpoints.Service("openapi_service", {
serviceName: "api-name.endpoints.project-id.cloud.goog",
project: "project-id",
openapiConfig: std.file({
input: "openapi_spec.yml",
}).then(invoke => invoke.result),
});
const grpcService = new gcp.endpoints.Service("grpc_service", {
serviceName: "api-name.endpoints.project-id.cloud.goog",
project: "project-id",
grpcConfig: std.file({
input: "service_spec.yml",
}).then(invoke => invoke.result),
protocOutputBase64: std.filebase64({
input: "compiled_descriptor_file.pb",
}).then(invoke => invoke.result),
});
import pulumi
import pulumi_gcp as gcp
import pulumi_std as std
openapi_service = gcp.endpoints.Service("openapi_service",
service_name="api-name.endpoints.project-id.cloud.goog",
project="project-id",
openapi_config=std.file(input="openapi_spec.yml").result)
grpc_service = gcp.endpoints.Service("grpc_service",
service_name="api-name.endpoints.project-id.cloud.goog",
project="project-id",
grpc_config=std.file(input="service_spec.yml").result,
protoc_output_base64=std.filebase64(input="compiled_descriptor_file.pb").result)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var openapiService = new Gcp.Endpoints.Service("openapi_service", new()
{
ServiceName = "api-name.endpoints.project-id.cloud.goog",
Project = "project-id",
OpenapiConfig = Std.File.Invoke(new()
{
Input = "openapi_spec.yml",
}).Apply(invoke => invoke.Result),
});
var grpcService = new Gcp.Endpoints.Service("grpc_service", new()
{
ServiceName = "api-name.endpoints.project-id.cloud.goog",
Project = "project-id",
GrpcConfig = Std.File.Invoke(new()
{
Input = "service_spec.yml",
}).Apply(invoke => invoke.Result),
ProtocOutputBase64 = Std.Filebase64.Invoke(new()
{
Input = "compiled_descriptor_file.pb",
}).Apply(invoke => invoke.Result),
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/endpoints"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
invokeFile, err := std.File(ctx, &std.FileArgs{
Input: "openapi_spec.yml",
}, nil)
if err != nil {
return err
}
_, err = endpoints.NewService(ctx, "openapi_service", &endpoints.ServiceArgs{
ServiceName: pulumi.String("api-name.endpoints.project-id.cloud.goog"),
Project: pulumi.String("project-id"),
OpenapiConfig: pulumi.String(invokeFile.Result),
})
if err != nil {
return err
}
invokeFile1, err := std.File(ctx, &std.FileArgs{
Input: "service_spec.yml",
}, nil)
if err != nil {
return err
}
invokeFilebase642, err := std.Filebase64(ctx, &std.Filebase64Args{
Input: "compiled_descriptor_file.pb",
}, nil)
if err != nil {
return err
}
_, err = endpoints.NewService(ctx, "grpc_service", &endpoints.ServiceArgs{
ServiceName: pulumi.String("api-name.endpoints.project-id.cloud.goog"),
Project: pulumi.String("project-id"),
GrpcConfig: pulumi.String(invokeFile1.Result),
ProtocOutputBase64: pulumi.String(invokeFilebase642.Result),
})
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.gcp.endpoints.Service;
import com.pulumi.gcp.endpoints.ServiceArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FileArgs;
import com.pulumi.std.inputs.Filebase64Args;
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) {
var openapiService = new Service("openapiService", ServiceArgs.builder()
.serviceName("api-name.endpoints.project-id.cloud.goog")
.project("project-id")
.openapiConfig(StdFunctions.file(FileArgs.builder()
.input("openapi_spec.yml")
.build()).result())
.build());
var grpcService = new Service("grpcService", ServiceArgs.builder()
.serviceName("api-name.endpoints.project-id.cloud.goog")
.project("project-id")
.grpcConfig(StdFunctions.file(FileArgs.builder()
.input("service_spec.yml")
.build()).result())
.protocOutputBase64(StdFunctions.filebase64(Filebase64Args.builder()
.input("compiled_descriptor_file.pb")
.build()).result())
.build());
}
}
resources:
openapiService:
type: gcp:endpoints:Service
name: openapi_service
properties:
serviceName: api-name.endpoints.project-id.cloud.goog
project: project-id
openapiConfig:
fn::invoke:
function: std:file
arguments:
input: openapi_spec.yml
return: result
grpcService:
type: gcp:endpoints:Service
name: grpc_service
properties:
serviceName: api-name.endpoints.project-id.cloud.goog
project: project-id
grpcConfig:
fn::invoke:
function: std:file
arguments:
input: service_spec.yml
return: result
protocOutputBase64:
fn::invoke:
function: std:filebase64
arguments:
input: compiled_descriptor_file.pb
return: result

The example in examples/endpoints_on_compute_engine shows the API from the quickstart running on a Compute Engine VM and reachable through Cloud Endpoints, which may also be useful.

Import

This resource does not support import.

Constructors

Link copied to clipboard
constructor(grpcConfig: Output<String>? = null, openapiConfig: Output<String>? = null, project: Output<String>? = null, protocOutputBase64: Output<String>? = null, serviceName: Output<String>? = null)

Properties

Link copied to clipboard
val grpcConfig: Output<String>? = null

The full text of the Service Config YAML file (Example located here). If provided, must also provide protoc_output_base64. open_api config must not be provided.

Link copied to clipboard
val openapiConfig: Output<String>? = null

The full text of the OpenAPI YAML configuration as described here. Either this, or both of grpc_config and protoc_output_base64 must be specified.

Link copied to clipboard
val project: Output<String>? = null

The project ID that the service belongs to. If not provided, provider project is used.

Link copied to clipboard
val protocOutputBase64: Output<String>? = null

The full contents of the Service Descriptor File generated by protoc. This should be a compiled .pb file, base64-encoded.

Link copied to clipboard
val serviceName: Output<String>? = null

The name of the service. Usually of the form $apiname.endpoints.$projectid.cloud.goog.

Functions

Link copied to clipboard
open override fun toJava(): ServiceArgs