1. Packages
  2. Pagerduty Provider
  3. API Docs
  4. getServiceCustomFieldValue
PagerDuty v4.25.1 published on Saturday, Jun 14, 2025 by Pulumi

pagerduty.getServiceCustomFieldValue

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.25.1 published on Saturday, Jun 14, 2025 by Pulumi

    Use this data source to get information about service custom field values in PagerDuty.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    // Create a service
    const exampleService = new pagerduty.Service("example", {
        name: "Example Service",
        autoResolveTimeout: "14400",
        acknowledgementTimeout: "600",
        escalationPolicy: examplePagerdutyEscalationPolicy.id,
    });
    const example = pagerduty.getServiceCustomFieldValueOutput({
        serviceId: exampleService.id,
    });
    export const environmentValue = example.apply(example => .filter(field => field.name == "environment").map(field => (field.value))[0]);
    // Set custom field values on the service
    const exampleServiceCustomFieldValue = new pagerduty.ServiceCustomFieldValue("example", {
        serviceId: exampleService.id,
        customFields: [
            {
                name: "environment",
                value: JSON.stringify("production"),
            },
            {
                name: "region",
                value: JSON.stringify("us-east-1"),
            },
        ],
    });
    
    import pulumi
    import json
    import pulumi_pagerduty as pagerduty
    
    # Create a service
    example_service = pagerduty.Service("example",
        name="Example Service",
        auto_resolve_timeout="14400",
        acknowledgement_timeout="600",
        escalation_policy=example_pagerduty_escalation_policy["id"])
    example = pagerduty.get_service_custom_field_value_output(service_id=example_service.id)
    pulumi.export("environmentValue", example.apply(lambda example: [field.value for field in example.custom_fields if field.name == "environment"][0]))
    # Set custom field values on the service
    example_service_custom_field_value = pagerduty.ServiceCustomFieldValue("example",
        service_id=example_service.id,
        custom_fields=[
            {
                "name": "environment",
                "value": json.dumps("production"),
            },
            {
                "name": "region",
                "value": json.dumps("us-east-1"),
            },
        ])
    
    Coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Pagerduty = Pulumi.Pagerduty;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a service
        var exampleService = new Pagerduty.Service("example", new()
        {
            Name = "Example Service",
            AutoResolveTimeout = "14400",
            AcknowledgementTimeout = "600",
            EscalationPolicy = examplePagerdutyEscalationPolicy.Id,
        });
    
        var example = Pagerduty.GetServiceCustomFieldValue.Invoke(new()
        {
            ServiceId = exampleService.Id,
        });
    
        // Set custom field values on the service
        var exampleServiceCustomFieldValue = new Pagerduty.ServiceCustomFieldValue("example", new()
        {
            ServiceId = exampleService.Id,
            CustomFields = new[]
            {
                new Pagerduty.Inputs.ServiceCustomFieldValueCustomFieldArgs
                {
                    Name = "environment",
                    Value = JsonSerializer.Serialize("production"),
                },
                new Pagerduty.Inputs.ServiceCustomFieldValueCustomFieldArgs
                {
                    Name = "region",
                    Value = JsonSerializer.Serialize("us-east-1"),
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["environmentValue"] = .Where(field => field.Name == "environment").Select(field => 
            {
                return field.Value;
            }).ToList()[0],
        };
    });
    
    Coming soon!
    
    Coming soon!
    

    Using getServiceCustomFieldValue

    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 getServiceCustomFieldValue(args: GetServiceCustomFieldValueArgs, opts?: InvokeOptions): Promise<GetServiceCustomFieldValueResult>
    function getServiceCustomFieldValueOutput(args: GetServiceCustomFieldValueOutputArgs, opts?: InvokeOptions): Output<GetServiceCustomFieldValueResult>
    def get_service_custom_field_value(service_id: Optional[str] = None,
                                       opts: Optional[InvokeOptions] = None) -> GetServiceCustomFieldValueResult
    def get_service_custom_field_value_output(service_id: Optional[pulumi.Input[str]] = None,
                                       opts: Optional[InvokeOptions] = None) -> Output[GetServiceCustomFieldValueResult]
    func LookupServiceCustomFieldValue(ctx *Context, args *LookupServiceCustomFieldValueArgs, opts ...InvokeOption) (*LookupServiceCustomFieldValueResult, error)
    func LookupServiceCustomFieldValueOutput(ctx *Context, args *LookupServiceCustomFieldValueOutputArgs, opts ...InvokeOption) LookupServiceCustomFieldValueResultOutput

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

    public static class GetServiceCustomFieldValue 
    {
        public static Task<GetServiceCustomFieldValueResult> InvokeAsync(GetServiceCustomFieldValueArgs args, InvokeOptions? opts = null)
        public static Output<GetServiceCustomFieldValueResult> Invoke(GetServiceCustomFieldValueInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServiceCustomFieldValueResult> getServiceCustomFieldValue(GetServiceCustomFieldValueArgs args, InvokeOptions options)
    public static Output<GetServiceCustomFieldValueResult> getServiceCustomFieldValue(GetServiceCustomFieldValueArgs args, InvokeOptions options)
    
    fn::invoke:
      function: pagerduty:index/getServiceCustomFieldValue:getServiceCustomFieldValue
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ServiceId string
    The ID of the service to get custom field values for.
    ServiceId string
    The ID of the service to get custom field values for.
    serviceId String
    The ID of the service to get custom field values for.
    serviceId string
    The ID of the service to get custom field values for.
    service_id str
    The ID of the service to get custom field values for.
    serviceId String
    The ID of the service to get custom field values for.

    getServiceCustomFieldValue Result

    The following output properties are available:

    CustomFields List<GetServiceCustomFieldValueCustomField>
    A list of custom field values associated with the service. Each element contains:
    Id string
    The ID of the custom field.
    ServiceId string
    CustomFields []GetServiceCustomFieldValueCustomField
    A list of custom field values associated with the service. Each element contains:
    Id string
    The ID of the custom field.
    ServiceId string
    customFields List<GetServiceCustomFieldValueCustomField>
    A list of custom field values associated with the service. Each element contains:
    id String
    The ID of the custom field.
    serviceId String
    customFields GetServiceCustomFieldValueCustomField[]
    A list of custom field values associated with the service. Each element contains:
    id string
    The ID of the custom field.
    serviceId string
    custom_fields Sequence[GetServiceCustomFieldValueCustomField]
    A list of custom field values associated with the service. Each element contains:
    id str
    The ID of the custom field.
    service_id str
    customFields List<Property Map>
    A list of custom field values associated with the service. Each element contains:
    id String
    The ID of the custom field.
    serviceId String

    Supporting Types

    GetServiceCustomFieldValueCustomField

    DataType string
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    Description string
    A description of the data this field contains.
    DisplayName string
    The human-readable name of the custom field.
    FieldType string
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    Id string
    The ID of the custom field.
    Name string
    The name of the custom field.
    Type string
    The type of the reference, typically "field_value".
    Value string
    The value of the custom field. This is a JSON-encoded string matching the field's data type.
    DataType string
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    Description string
    A description of the data this field contains.
    DisplayName string
    The human-readable name of the custom field.
    FieldType string
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    Id string
    The ID of the custom field.
    Name string
    The name of the custom field.
    Type string
    The type of the reference, typically "field_value".
    Value string
    The value of the custom field. This is a JSON-encoded string matching the field's data type.
    dataType String
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    description String
    A description of the data this field contains.
    displayName String
    The human-readable name of the custom field.
    fieldType String
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    id String
    The ID of the custom field.
    name String
    The name of the custom field.
    type String
    The type of the reference, typically "field_value".
    value String
    The value of the custom field. This is a JSON-encoded string matching the field's data type.
    dataType string
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    description string
    A description of the data this field contains.
    displayName string
    The human-readable name of the custom field.
    fieldType string
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    id string
    The ID of the custom field.
    name string
    The name of the custom field.
    type string
    The type of the reference, typically "field_value".
    value string
    The value of the custom field. This is a JSON-encoded string matching the field's data type.
    data_type str
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    description str
    A description of the data this field contains.
    display_name str
    The human-readable name of the custom field.
    field_type str
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    id str
    The ID of the custom field.
    name str
    The name of the custom field.
    type str
    The type of the reference, typically "field_value".
    value str
    The value of the custom field. This is a JSON-encoded string matching the field's data type.
    dataType String
    The kind of data the custom field is allowed to contain. Can be one of: string, integer, float, boolean, datetime, or url.
    description String
    A description of the data this field contains.
    displayName String
    The human-readable name of the custom field.
    fieldType String
    The type of field. Can be one of: single_value, single_value_fixed, multi_value, or multi_value_fixed.
    id String
    The ID of the custom field.
    name String
    The name of the custom field.
    type String
    The type of the reference, typically "field_value".
    value String
    The value of the custom field. This is a JSON-encoded string matching the field's data type.

    Package Details

    Repository
    PagerDuty pulumi/pulumi-pagerduty
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pagerduty Terraform Provider.
    pagerduty logo
    PagerDuty v4.25.1 published on Saturday, Jun 14, 2025 by Pulumi