discord 2.0.0 published on Friday, Mar 7, 2025 by lucky3028
discord.getLocalImage
Explore with Pulumi AI
A simple helper to get data URI of a local image.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as discord from "@pulumi/discord";
const logo = discord.getLocalImage({
file: "logo.png",
});
const server = new discord.Server("server", {iconDataUri: logo.then(logo => logo.dataUri)});
import pulumi
import pulumi_discord as discord
logo = discord.get_local_image(file="logo.png")
server = discord.Server("server", icon_data_uri=logo.data_uri)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/discord/v2/discord"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
logo, err := discord.GetLocalImage(ctx, &discord.GetLocalImageArgs{
File: "logo.png",
}, nil)
if err != nil {
return err
}
_, err = discord.NewServer(ctx, "server", &discord.ServerArgs{
IconDataUri: pulumi.String(logo.DataUri),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Discord = Pulumi.Discord;
return await Deployment.RunAsync(() =>
{
var logo = Discord.GetLocalImage.Invoke(new()
{
File = "logo.png",
});
var server = new Discord.Server("server", new()
{
IconDataUri = logo.Apply(getLocalImageResult => getLocalImageResult.DataUri),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.discord.DiscordFunctions;
import com.pulumi.discord.inputs.GetLocalImageArgs;
import com.pulumi.discord.Server;
import com.pulumi.discord.ServerArgs;
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 logo = DiscordFunctions.getLocalImage(GetLocalImageArgs.builder()
.file("logo.png")
.build());
var server = new Server("server", ServerArgs.builder()
.iconDataUri(logo.applyValue(getLocalImageResult -> getLocalImageResult.dataUri()))
.build());
}
}
resources:
server:
type: discord:Server
properties:
# ...
iconDataUri: ${logo.dataUri}
variables:
logo:
fn::invoke:
function: discord:getLocalImage
arguments:
file: logo.png
Using getLocalImage
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 getLocalImage(args: GetLocalImageArgs, opts?: InvokeOptions): Promise<GetLocalImageResult>
function getLocalImageOutput(args: GetLocalImageOutputArgs, opts?: InvokeOptions): Output<GetLocalImageResult>
def get_local_image(file: Optional[str] = None,
id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetLocalImageResult
def get_local_image_output(file: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetLocalImageResult]
func GetLocalImage(ctx *Context, args *GetLocalImageArgs, opts ...InvokeOption) (*GetLocalImageResult, error)
func GetLocalImageOutput(ctx *Context, args *GetLocalImageOutputArgs, opts ...InvokeOption) GetLocalImageResultOutput
> Note: This function is named GetLocalImage
in the Go SDK.
public static class GetLocalImage
{
public static Task<GetLocalImageResult> InvokeAsync(GetLocalImageArgs args, InvokeOptions? opts = null)
public static Output<GetLocalImageResult> Invoke(GetLocalImageInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetLocalImageResult> getLocalImage(GetLocalImageArgs args, InvokeOptions options)
public static Output<GetLocalImageResult> getLocalImage(GetLocalImageArgs args, InvokeOptions options)
fn::invoke:
function: discord:index/getLocalImage:getLocalImage
arguments:
# arguments dictionary
The following arguments are supported:
getLocalImage Result
The following output properties are available:
Package Details
- Repository
- discord lucky3028/terraform-provider-discord
- License
- Notes
- This Pulumi package is based on the
discord
Terraform Provider.