New Relic v5.36.1 published on Tuesday, Nov 12, 2024 by Pulumi
newrelic.synthetics.getPrivateLocation
Explore with Pulumi AI
Use this data source to get information about a specific Synthetics monitor private location in New Relic that already exists.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const example = newrelic.synthetics.getPrivateLocation({
accountId: "123456",
name: "My private location",
});
const foo = new newrelic.synthetics.Monitor("foo", {locationsPrivates: [example.then(example => example.id)]});
import pulumi
import pulumi_newrelic as newrelic
example = newrelic.synthetics.get_private_location(account_id="123456",
name="My private location")
foo = newrelic.synthetics.Monitor("foo", locations_privates=[example.id])
package main
import (
"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic/synthetics"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := synthetics.LookupPrivateLocation(ctx, &synthetics.LookupPrivateLocationArgs{
AccountId: pulumi.StringRef("123456"),
Name: "My private location",
}, nil)
if err != nil {
return err
}
_, err = synthetics.NewMonitor(ctx, "foo", &synthetics.MonitorArgs{
LocationsPrivates: pulumi.StringArray{
pulumi.String(example.Id),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var example = NewRelic.Synthetics.GetPrivateLocation.Invoke(new()
{
AccountId = "123456",
Name = "My private location",
});
var foo = new NewRelic.Synthetics.Monitor("foo", new()
{
LocationsPrivates = new[]
{
example.Apply(getPrivateLocationResult => getPrivateLocationResult.Id),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.synthetics.SyntheticsFunctions;
import com.pulumi.newrelic.synthetics.inputs.GetPrivateLocationArgs;
import com.pulumi.newrelic.synthetics.Monitor;
import com.pulumi.newrelic.synthetics.MonitorArgs;
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 example = SyntheticsFunctions.getPrivateLocation(GetPrivateLocationArgs.builder()
.accountId(123456)
.name("My private location")
.build());
var foo = new Monitor("foo", MonitorArgs.builder()
.locationsPrivates(example.applyValue(getPrivateLocationResult -> getPrivateLocationResult.id()))
.build());
}
}
resources:
foo:
type: newrelic:synthetics:Monitor
properties:
locationsPrivates:
- ${example.id}
variables:
example:
fn::invoke:
Function: newrelic:synthetics:getPrivateLocation
Arguments:
accountId: 123456
name: My private location
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const example = newrelic.synthetics.getPrivateLocation({
accountId: "123456",
name: "My private location",
});
const foo = new newrelic.synthetics.StepMonitor("foo", {locationPrivates: [{
guid: example.then(example => example.id),
}]});
import pulumi
import pulumi_newrelic as newrelic
example = newrelic.synthetics.get_private_location(account_id="123456",
name="My private location")
foo = newrelic.synthetics.StepMonitor("foo", location_privates=[{
"guid": example.id,
}])
package main
import (
"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic/synthetics"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := synthetics.LookupPrivateLocation(ctx, &synthetics.LookupPrivateLocationArgs{
AccountId: pulumi.StringRef("123456"),
Name: "My private location",
}, nil)
if err != nil {
return err
}
_, err = synthetics.NewStepMonitor(ctx, "foo", &synthetics.StepMonitorArgs{
LocationPrivates: synthetics.StepMonitorLocationPrivateArray{
&synthetics.StepMonitorLocationPrivateArgs{
Guid: pulumi.String(example.Id),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
var example = NewRelic.Synthetics.GetPrivateLocation.Invoke(new()
{
AccountId = "123456",
Name = "My private location",
});
var foo = new NewRelic.Synthetics.StepMonitor("foo", new()
{
LocationPrivates = new[]
{
new NewRelic.Synthetics.Inputs.StepMonitorLocationPrivateArgs
{
Guid = example.Apply(getPrivateLocationResult => getPrivateLocationResult.Id),
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.synthetics.SyntheticsFunctions;
import com.pulumi.newrelic.synthetics.inputs.GetPrivateLocationArgs;
import com.pulumi.newrelic.synthetics.StepMonitor;
import com.pulumi.newrelic.synthetics.StepMonitorArgs;
import com.pulumi.newrelic.synthetics.inputs.StepMonitorLocationPrivateArgs;
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 example = SyntheticsFunctions.getPrivateLocation(GetPrivateLocationArgs.builder()
.accountId(123456)
.name("My private location")
.build());
var foo = new StepMonitor("foo", StepMonitorArgs.builder()
.locationPrivates(StepMonitorLocationPrivateArgs.builder()
.guid(example.applyValue(getPrivateLocationResult -> getPrivateLocationResult.id()))
.build())
.build());
}
}
resources:
foo:
type: newrelic:synthetics:StepMonitor
properties:
locationPrivates:
- guid: ${example.id}
variables:
example:
fn::invoke:
Function: newrelic:synthetics:getPrivateLocation
Arguments:
accountId: 123456
name: My private location
Using getPrivateLocation
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 getPrivateLocation(args: GetPrivateLocationArgs, opts?: InvokeOptions): Promise<GetPrivateLocationResult>
function getPrivateLocationOutput(args: GetPrivateLocationOutputArgs, opts?: InvokeOptions): Output<GetPrivateLocationResult>
def get_private_location(account_id: Optional[str] = None,
keys: Optional[Sequence[str]] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPrivateLocationResult
def get_private_location_output(account_id: Optional[pulumi.Input[str]] = None,
keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPrivateLocationResult]
func LookupPrivateLocation(ctx *Context, args *LookupPrivateLocationArgs, opts ...InvokeOption) (*LookupPrivateLocationResult, error)
func LookupPrivateLocationOutput(ctx *Context, args *LookupPrivateLocationOutputArgs, opts ...InvokeOption) LookupPrivateLocationResultOutput
> Note: This function is named LookupPrivateLocation
in the Go SDK.
public static class GetPrivateLocation
{
public static Task<GetPrivateLocationResult> InvokeAsync(GetPrivateLocationArgs args, InvokeOptions? opts = null)
public static Output<GetPrivateLocationResult> Invoke(GetPrivateLocationInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPrivateLocationResult> getPrivateLocation(GetPrivateLocationArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: newrelic:synthetics/getPrivateLocation:getPrivateLocation
arguments:
# arguments dictionary
The following arguments are supported:
- name str
- The name of the Synthetics monitor private location.
- account_
id str - The New Relic account ID of the associated private location. If left empty will default to account ID specified in provider level configuration.
- keys Sequence[str]
- The key of the private location.
getPrivateLocation Result
The following output properties are available:
- id str
- The provider-assigned unique ID for this managed resource.
- keys Sequence[str]
- The key of the private location.
- name str
- account_
id str
Package Details
- Repository
- New Relic pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelic
Terraform Provider.