1. Packages
  2. Dynatrace
  3. API Docs
  4. getCredentials
Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse

dynatrace.getCredentials

Explore with Pulumi AI

dynatrace logo
Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse

    The dynatrace.Credentials data source queries for Credentials stored within the Credentials Vault using the properties name, scope and type. At least one of name, scope or type needs to be specified as a non empty value. Combinations of the three properties are also possible.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumi/dynatrace";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const creds = dynatrace.getCredentials({
        name: "Office365 Access Token",
    });
    const _name_ = new dynatrace.HttpMonitor("#name#", {
        enabled: true,
        frequency: 60,
        locations: ["SYNTHETIC_LOCATION-781752216580B1BC"],
        anomalyDetections: [{
            loadingTimeThresholds: [{
                enabled: true,
            }],
            outageHandlings: [{
                globalOutage: true,
                localOutage: false,
                retryOnError: false,
            }],
        }],
        script: {
            requests: [{
                description: "google.com",
                method: "GET",
                url: "https://www.google.com",
                authentication: {
                    type: "BASIC_AUTHENTICATION",
                    credentials: creds.then(creds => creds.id),
                },
                configuration: {
                    acceptAnyCertificate: true,
                    followRedirects: true,
                },
                validation: {
                    rules: [{
                        type: "httpStatusesList",
                        passIfFound: false,
                        value: ">=400",
                    }],
                },
            }],
        },
    });
    
    import pulumi
    import pulumi_dynatrace as dynatrace
    import pulumiverse_dynatrace as dynatrace
    
    creds = dynatrace.get_credentials(name="Office365 Access Token")
    _name_ = dynatrace.HttpMonitor("#name#",
        enabled=True,
        frequency=60,
        locations=["SYNTHETIC_LOCATION-781752216580B1BC"],
        anomaly_detections=[dynatrace.HttpMonitorAnomalyDetectionArgs(
            loading_time_thresholds=[dynatrace.HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs(
                enabled=True,
            )],
            outage_handlings=[dynatrace.HttpMonitorAnomalyDetectionOutageHandlingArgs(
                global_outage=True,
                local_outage=False,
                retry_on_error=False,
            )],
        )],
        script=dynatrace.HttpMonitorScriptArgs(
            requests=[dynatrace.HttpMonitorScriptRequestArgs(
                description="google.com",
                method="GET",
                url="https://www.google.com",
                authentication=dynatrace.HttpMonitorScriptRequestAuthenticationArgs(
                    type="BASIC_AUTHENTICATION",
                    credentials=creds.id,
                ),
                configuration=dynatrace.HttpMonitorScriptRequestConfigurationArgs(
                    accept_any_certificate=True,
                    follow_redirects=True,
                ),
                validation=dynatrace.HttpMonitorScriptRequestValidationArgs(
                    rules=[dynatrace.HttpMonitorScriptRequestValidationRuleArgs(
                        type="httpStatusesList",
                        pass_if_found=False,
                        value=">=400",
                    )],
                ),
            )],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		creds, err := dynatrace.LookupCredentials(ctx, &dynatrace.LookupCredentialsArgs{
    			Name: pulumi.StringRef("Office365 Access Token"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = dynatrace.NewHttpMonitor(ctx, "#name#", &dynatrace.HttpMonitorArgs{
    			Enabled:   pulumi.Bool(true),
    			Frequency: pulumi.Int(60),
    			Locations: pulumi.StringArray{
    				pulumi.String("SYNTHETIC_LOCATION-781752216580B1BC"),
    			},
    			AnomalyDetections: dynatrace.HttpMonitorAnomalyDetectionArray{
    				&dynatrace.HttpMonitorAnomalyDetectionArgs{
    					LoadingTimeThresholds: dynatrace.HttpMonitorAnomalyDetectionLoadingTimeThresholdArray{
    						&dynatrace.HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs{
    							Enabled: pulumi.Bool(true),
    						},
    					},
    					OutageHandlings: dynatrace.HttpMonitorAnomalyDetectionOutageHandlingArray{
    						&dynatrace.HttpMonitorAnomalyDetectionOutageHandlingArgs{
    							GlobalOutage: pulumi.Bool(true),
    							LocalOutage:  pulumi.Bool(false),
    							RetryOnError: pulumi.Bool(false),
    						},
    					},
    				},
    			},
    			Script: &dynatrace.HttpMonitorScriptTypeArgs{
    				Requests: dynatrace.HttpMonitorScriptRequestArray{
    					&dynatrace.HttpMonitorScriptRequestArgs{
    						Description: pulumi.String("google.com"),
    						Method:      pulumi.String("GET"),
    						Url:         pulumi.String("https://www.google.com"),
    						Authentication: &dynatrace.HttpMonitorScriptRequestAuthenticationArgs{
    							Type:        pulumi.String("BASIC_AUTHENTICATION"),
    							Credentials: pulumi.String(creds.Id),
    						},
    						Configuration: &dynatrace.HttpMonitorScriptRequestConfigurationArgs{
    							AcceptAnyCertificate: pulumi.Bool(true),
    							FollowRedirects:      pulumi.Bool(true),
    						},
    						Validation: &dynatrace.HttpMonitorScriptRequestValidationArgs{
    							Rules: dynatrace.HttpMonitorScriptRequestValidationRuleArray{
    								&dynatrace.HttpMonitorScriptRequestValidationRuleArgs{
    									Type:        pulumi.String("httpStatusesList"),
    									PassIfFound: pulumi.Bool(false),
    									Value:       pulumi.String(">=400"),
    								},
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Dynatrace = Pulumi.Dynatrace;
    using Dynatrace = Pulumiverse.Dynatrace;
    
    return await Deployment.RunAsync(() => 
    {
        var creds = Dynatrace.GetCredentials.Invoke(new()
        {
            Name = "Office365 Access Token",
        });
    
        var _name_ = new Dynatrace.HttpMonitor("#name#", new()
        {
            Enabled = true,
            Frequency = 60,
            Locations = new[]
            {
                "SYNTHETIC_LOCATION-781752216580B1BC",
            },
            AnomalyDetections = new[]
            {
                new Dynatrace.Inputs.HttpMonitorAnomalyDetectionArgs
                {
                    LoadingTimeThresholds = new[]
                    {
                        new Dynatrace.Inputs.HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs
                        {
                            Enabled = true,
                        },
                    },
                    OutageHandlings = new[]
                    {
                        new Dynatrace.Inputs.HttpMonitorAnomalyDetectionOutageHandlingArgs
                        {
                            GlobalOutage = true,
                            LocalOutage = false,
                            RetryOnError = false,
                        },
                    },
                },
            },
            Script = new Dynatrace.Inputs.HttpMonitorScriptArgs
            {
                Requests = new[]
                {
                    new Dynatrace.Inputs.HttpMonitorScriptRequestArgs
                    {
                        Description = "google.com",
                        Method = "GET",
                        Url = "https://www.google.com",
                        Authentication = new Dynatrace.Inputs.HttpMonitorScriptRequestAuthenticationArgs
                        {
                            Type = "BASIC_AUTHENTICATION",
                            Credentials = creds.Apply(getCredentialsResult => getCredentialsResult.Id),
                        },
                        Configuration = new Dynatrace.Inputs.HttpMonitorScriptRequestConfigurationArgs
                        {
                            AcceptAnyCertificate = true,
                            FollowRedirects = true,
                        },
                        Validation = new Dynatrace.Inputs.HttpMonitorScriptRequestValidationArgs
                        {
                            Rules = new[]
                            {
                                new Dynatrace.Inputs.HttpMonitorScriptRequestValidationRuleArgs
                                {
                                    Type = "httpStatusesList",
                                    PassIfFound = false,
                                    Value = ">=400",
                                },
                            },
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dynatrace.DynatraceFunctions;
    import com.pulumi.dynatrace.inputs.GetCredentialsArgs;
    import com.pulumi.dynatrace.HttpMonitor;
    import com.pulumi.dynatrace.HttpMonitorArgs;
    import com.pulumi.dynatrace.inputs.HttpMonitorAnomalyDetectionArgs;
    import com.pulumi.dynatrace.inputs.HttpMonitorScriptArgs;
    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 creds = DynatraceFunctions.getCredentials(GetCredentialsArgs.builder()
                .name("Office365 Access Token")
                .build());
    
            var _name_ = new HttpMonitor("#name#", HttpMonitorArgs.builder()
                .enabled(true)
                .frequency(60)
                .locations("SYNTHETIC_LOCATION-781752216580B1BC")
                .anomalyDetections(HttpMonitorAnomalyDetectionArgs.builder()
                    .loadingTimeThresholds(HttpMonitorAnomalyDetectionLoadingTimeThresholdArgs.builder()
                        .enabled(true)
                        .build())
                    .outageHandlings(HttpMonitorAnomalyDetectionOutageHandlingArgs.builder()
                        .globalOutage(true)
                        .localOutage(false)
                        .retryOnError(false)
                        .build())
                    .build())
                .script(HttpMonitorScriptArgs.builder()
                    .requests(HttpMonitorScriptRequestArgs.builder()
                        .description("google.com")
                        .method("GET")
                        .url("https://www.google.com")
                        .authentication(HttpMonitorScriptRequestAuthenticationArgs.builder()
                            .type("BASIC_AUTHENTICATION")
                            .credentials(creds.applyValue(getCredentialsResult -> getCredentialsResult.id()))
                            .build())
                        .configuration(HttpMonitorScriptRequestConfigurationArgs.builder()
                            .acceptAnyCertificate(true)
                            .followRedirects(true)
                            .build())
                        .validation(HttpMonitorScriptRequestValidationArgs.builder()
                            .rules(HttpMonitorScriptRequestValidationRuleArgs.builder()
                                .type("httpStatusesList")
                                .passIfFound(false)
                                .value(">=400")
                                .build())
                            .build())
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      '#name#':
        type: dynatrace:HttpMonitor
        properties:
          enabled: true
          frequency: 60
          locations:
            - SYNTHETIC_LOCATION-781752216580B1BC
          anomalyDetections:
            - loadingTimeThresholds:
                - enabled: true
              outageHandlings:
                - globalOutage: true
                  localOutage: false
                  retryOnError: false
          script:
            requests:
              - description: google.com
                method: GET
                url: https://www.google.com
                authentication:
                  type: BASIC_AUTHENTICATION
                  credentials: ${creds.id}
                configuration:
                  acceptAnyCertificate: true
                  followRedirects: true
                validation:
                  rules:
                    - type: httpStatusesList
                      passIfFound: false
                      value: '>=400'
    variables:
      creds:
        fn::invoke:
          Function: dynatrace:getCredentials
          Arguments:
            name: Office365 Access Token
    

    Using getCredentials

    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 getCredentials(args: GetCredentialsArgs, opts?: InvokeOptions): Promise<GetCredentialsResult>
    function getCredentialsOutput(args: GetCredentialsOutputArgs, opts?: InvokeOptions): Output<GetCredentialsResult>
    def get_credentials(name: Optional[str] = None,
                        scope: Optional[str] = None,
                        type: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetCredentialsResult
    def get_credentials_output(name: Optional[pulumi.Input[str]] = None,
                        scope: Optional[pulumi.Input[str]] = None,
                        type: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetCredentialsResult]
    func LookupCredentials(ctx *Context, args *LookupCredentialsArgs, opts ...InvokeOption) (*LookupCredentialsResult, error)
    func LookupCredentialsOutput(ctx *Context, args *LookupCredentialsOutputArgs, opts ...InvokeOption) LookupCredentialsResultOutput

    > Note: This function is named LookupCredentials in the Go SDK.

    public static class GetCredentials 
    {
        public static Task<GetCredentialsResult> InvokeAsync(GetCredentialsArgs args, InvokeOptions? opts = null)
        public static Output<GetCredentialsResult> Invoke(GetCredentialsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCredentialsResult> getCredentials(GetCredentialsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: dynatrace:index/getCredentials:getCredentials
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    Scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    Type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    Name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    Scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    Type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    name String
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope String
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type String
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    name str
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope str
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type str
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    name String
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope String
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type String
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match

    getCredentials Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    Scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    Type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    Scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    Type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope String
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type String
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope string
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type string
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope str
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type str
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the credential as shown within the Dynatrace WebUI. If not specified all names will match
    scope String
    The scope of the credential. Possible values are ALL, EXTENSION and SYNTHETIC. If not specified all scopes will match.
    type String
    The type of the credential. Possible values are CERTIFICATE, PUBLIC_CERTIFICATE, TOKEN, USERNAME_PASSWORD and UNKNOWN. If not specified all credential types will match

    Package Details

    Repository
    dynatrace pulumiverse/pulumi-dynatrace
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dynatrace Terraform Provider.
    dynatrace logo
    Dynatrace v0.10.0 published on Friday, Jun 7, 2024 by Pulumiverse