All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.mobile.kotlin.NetworkService.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.mobile.kotlin

import com.pulumi.azure.mobile.kotlin.outputs.NetworkServicePccRule
import com.pulumi.azure.mobile.kotlin.outputs.NetworkServiceServiceQosPolicy
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.mobile.kotlin.outputs.NetworkServicePccRule.Companion.toKotlin as networkServicePccRuleToKotlin
import com.pulumi.azure.mobile.kotlin.outputs.NetworkServiceServiceQosPolicy.Companion.toKotlin as networkServiceServiceQosPolicyToKotlin

/**
 * Builder for [NetworkService].
 */
@PulumiTagMarker
public class NetworkServiceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NetworkServiceArgs = NetworkServiceArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend NetworkServiceArgsBuilder.() -> Unit) {
        val builder = NetworkServiceArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): NetworkService {
        val builtJavaResource = com.pulumi.azure.mobile.NetworkService(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return NetworkService(builtJavaResource)
    }
}

/**
 * Manages a Mobile Network Service.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "east us",
 * });
 * const exampleNetwork = new azure.mobile.Network("example", {
 *     name: "example-mn",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     mobileCountryCode: "001",
 *     mobileNetworkCode: "01",
 * });
 * const exampleNetworkService = new azure.mobile.NetworkService("example", {
 *     name: "example-mns",
 *     mobileNetworkId: exampleNetwork.id,
 *     location: example.location,
 *     servicePrecedence: 0,
 *     pccRules: [{
 *         name: "default-rule",
 *         precedence: 1,
 *         trafficControlEnabled: true,
 *         qosPolicy: {
 *             allocationAndRetentionPriorityLevel: 9,
 *             qosIndicator: 9,
 *             preemptionCapability: "NotPreempt",
 *             preemptionVulnerability: "Preemptable",
 *             guaranteedBitRate: {
 *                 downlink: "100 Mbps",
 *                 uplink: "10 Mbps",
 *             },
 *             maximumBitRate: {
 *                 downlink: "1 Gbps",
 *                 uplink: "100 Mbps",
 *             },
 *         },
 *         serviceDataFlowTemplates: [{
 *             direction: "Uplink",
 *             name: "IP-to-server",
 *             ports: [],
 *             protocols: ["ip"],
 *             remoteIpLists: ["10.3.4.0/24"],
 *         }],
 *     }],
 *     serviceQosPolicy: {
 *         allocationAndRetentionPriorityLevel: 9,
 *         qosIndicator: 9,
 *         preemptionCapability: "NotPreempt",
 *         preemptionVulnerability: "Preemptable",
 *         maximumBitRate: {
 *             downlink: "1 Gbps",
 *             uplink: "100 Mbps",
 *         },
 *     },
 *     tags: {
 *         key: "value",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="east us")
 * example_network = azure.mobile.Network("example",
 *     name="example-mn",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     mobile_country_code="001",
 *     mobile_network_code="01")
 * example_network_service = azure.mobile.NetworkService("example",
 *     name="example-mns",
 *     mobile_network_id=example_network.id,
 *     location=example.location,
 *     service_precedence=0,
 *     pcc_rules=[azure.mobile.NetworkServicePccRuleArgs(
 *         name="default-rule",
 *         precedence=1,
 *         traffic_control_enabled=True,
 *         qos_policy=azure.mobile.NetworkServicePccRuleQosPolicyArgs(
 *             allocation_and_retention_priority_level=9,
 *             qos_indicator=9,
 *             preemption_capability="NotPreempt",
 *             preemption_vulnerability="Preemptable",
 *             guaranteed_bit_rate=azure.mobile.NetworkServicePccRuleQosPolicyGuaranteedBitRateArgs(
 *                 downlink="100 Mbps",
 *                 uplink="10 Mbps",
 *             ),
 *             maximum_bit_rate=azure.mobile.NetworkServicePccRuleQosPolicyMaximumBitRateArgs(
 *                 downlink="1 Gbps",
 *                 uplink="100 Mbps",
 *             ),
 *         ),
 *         service_data_flow_templates=[azure.mobile.NetworkServicePccRuleServiceDataFlowTemplateArgs(
 *             direction="Uplink",
 *             name="IP-to-server",
 *             ports=[],
 *             protocols=["ip"],
 *             remote_ip_lists=["10.3.4.0/24"],
 *         )],
 *     )],
 *     service_qos_policy=azure.mobile.NetworkServiceServiceQosPolicyArgs(
 *         allocation_and_retention_priority_level=9,
 *         qos_indicator=9,
 *         preemption_capability="NotPreempt",
 *         preemption_vulnerability="Preemptable",
 *         maximum_bit_rate=azure.mobile.NetworkServiceServiceQosPolicyMaximumBitRateArgs(
 *             downlink="1 Gbps",
 *             uplink="100 Mbps",
 *         ),
 *     ),
 *     tags={
 *         "key": "value",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "east us",
 *     });
 *     var exampleNetwork = new Azure.Mobile.Network("example", new()
 *     {
 *         Name = "example-mn",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         MobileCountryCode = "001",
 *         MobileNetworkCode = "01",
 *     });
 *     var exampleNetworkService = new Azure.Mobile.NetworkService("example", new()
 *     {
 *         Name = "example-mns",
 *         MobileNetworkId = exampleNetwork.Id,
 *         Location = example.Location,
 *         ServicePrecedence = 0,
 *         PccRules = new[]
 *         {
 *             new Azure.Mobile.Inputs.NetworkServicePccRuleArgs
 *             {
 *                 Name = "default-rule",
 *                 Precedence = 1,
 *                 TrafficControlEnabled = true,
 *                 QosPolicy = new Azure.Mobile.Inputs.NetworkServicePccRuleQosPolicyArgs
 *                 {
 *                     AllocationAndRetentionPriorityLevel = 9,
 *                     QosIndicator = 9,
 *                     PreemptionCapability = "NotPreempt",
 *                     PreemptionVulnerability = "Preemptable",
 *                     GuaranteedBitRate = new Azure.Mobile.Inputs.NetworkServicePccRuleQosPolicyGuaranteedBitRateArgs
 *                     {
 *                         Downlink = "100 Mbps",
 *                         Uplink = "10 Mbps",
 *                     },
 *                     MaximumBitRate = new Azure.Mobile.Inputs.NetworkServicePccRuleQosPolicyMaximumBitRateArgs
 *                     {
 *                         Downlink = "1 Gbps",
 *                         Uplink = "100 Mbps",
 *                     },
 *                 },
 *                 ServiceDataFlowTemplates = new[]
 *                 {
 *                     new Azure.Mobile.Inputs.NetworkServicePccRuleServiceDataFlowTemplateArgs
 *                     {
 *                         Direction = "Uplink",
 *                         Name = "IP-to-server",
 *                         Ports = new() { },
 *                         Protocols = new[]
 *                         {
 *                             "ip",
 *                         },
 *                         RemoteIpLists = new[]
 *                         {
 *                             "10.3.4.0/24",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *         ServiceQosPolicy = new Azure.Mobile.Inputs.NetworkServiceServiceQosPolicyArgs
 *         {
 *             AllocationAndRetentionPriorityLevel = 9,
 *             QosIndicator = 9,
 *             PreemptionCapability = "NotPreempt",
 *             PreemptionVulnerability = "Preemptable",
 *             MaximumBitRate = new Azure.Mobile.Inputs.NetworkServiceServiceQosPolicyMaximumBitRateArgs
 *             {
 *                 Downlink = "1 Gbps",
 *                 Uplink = "100 Mbps",
 *             },
 *         },
 *         Tags =
 *         {
 *             { "key", "value" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mobile"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("east us"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNetwork, err := mobile.NewNetwork(ctx, "example", &mobile.NetworkArgs{
 * 			Name:              pulumi.String("example-mn"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			MobileCountryCode: pulumi.String("001"),
 * 			MobileNetworkCode: pulumi.String("01"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mobile.NewNetworkService(ctx, "example", &mobile.NetworkServiceArgs{
 * 			Name:              pulumi.String("example-mns"),
 * 			MobileNetworkId:   exampleNetwork.ID(),
 * 			Location:          example.Location,
 * 			ServicePrecedence: pulumi.Int(0),
 * 			PccRules: mobile.NetworkServicePccRuleArray{
 * 				&mobile.NetworkServicePccRuleArgs{
 * 					Name:                  pulumi.String("default-rule"),
 * 					Precedence:            pulumi.Int(1),
 * 					TrafficControlEnabled: pulumi.Bool(true),
 * 					QosPolicy: &mobile.NetworkServicePccRuleQosPolicyArgs{
 * 						AllocationAndRetentionPriorityLevel: pulumi.Int(9),
 * 						QosIndicator:                        pulumi.Int(9),
 * 						PreemptionCapability:                pulumi.String("NotPreempt"),
 * 						PreemptionVulnerability:             pulumi.String("Preemptable"),
 * 						GuaranteedBitRate: &mobile.NetworkServicePccRuleQosPolicyGuaranteedBitRateArgs{
 * 							Downlink: pulumi.String("100 Mbps"),
 * 							Uplink:   pulumi.String("10 Mbps"),
 * 						},
 * 						MaximumBitRate: &mobile.NetworkServicePccRuleQosPolicyMaximumBitRateArgs{
 * 							Downlink: pulumi.String("1 Gbps"),
 * 							Uplink:   pulumi.String("100 Mbps"),
 * 						},
 * 					},
 * 					ServiceDataFlowTemplates: mobile.NetworkServicePccRuleServiceDataFlowTemplateArray{
 * 						&mobile.NetworkServicePccRuleServiceDataFlowTemplateArgs{
 * 							Direction: pulumi.String("Uplink"),
 * 							Name:      pulumi.String("IP-to-server"),
 * 							Ports:     pulumi.StringArray{},
 * 							Protocols: pulumi.StringArray{
 * 								pulumi.String("ip"),
 * 							},
 * 							RemoteIpLists: pulumi.StringArray{
 * 								pulumi.String("10.3.4.0/24"),
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 			ServiceQosPolicy: &mobile.NetworkServiceServiceQosPolicyArgs{
 * 				AllocationAndRetentionPriorityLevel: pulumi.Int(9),
 * 				QosIndicator:                        pulumi.Int(9),
 * 				PreemptionCapability:                pulumi.String("NotPreempt"),
 * 				PreemptionVulnerability:             pulumi.String("Preemptable"),
 * 				MaximumBitRate: &mobile.NetworkServiceServiceQosPolicyMaximumBitRateArgs{
 * 					Downlink: pulumi.String("1 Gbps"),
 * 					Uplink:   pulumi.String("100 Mbps"),
 * 				},
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"key": pulumi.String("value"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.mobile.Network;
 * import com.pulumi.azure.mobile.NetworkArgs;
 * import com.pulumi.azure.mobile.NetworkService;
 * import com.pulumi.azure.mobile.NetworkServiceArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServicePccRuleArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServicePccRuleQosPolicyArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServicePccRuleQosPolicyGuaranteedBitRateArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServicePccRuleQosPolicyMaximumBitRateArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServiceServiceQosPolicyArgs;
 * import com.pulumi.azure.mobile.inputs.NetworkServiceServiceQosPolicyMaximumBitRateArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("east us")
 *             .build());
 *         var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
 *             .name("example-mn")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .mobileCountryCode("001")
 *             .mobileNetworkCode("01")
 *             .build());
 *         var exampleNetworkService = new NetworkService("exampleNetworkService", NetworkServiceArgs.builder()
 *             .name("example-mns")
 *             .mobileNetworkId(exampleNetwork.id())
 *             .location(example.location())
 *             .servicePrecedence(0)
 *             .pccRules(NetworkServicePccRuleArgs.builder()
 *                 .name("default-rule")
 *                 .precedence(1)
 *                 .trafficControlEnabled(true)
 *                 .qosPolicy(NetworkServicePccRuleQosPolicyArgs.builder()
 *                     .allocationAndRetentionPriorityLevel(9)
 *                     .qosIndicator(9)
 *                     .preemptionCapability("NotPreempt")
 *                     .preemptionVulnerability("Preemptable")
 *                     .guaranteedBitRate(NetworkServicePccRuleQosPolicyGuaranteedBitRateArgs.builder()
 *                         .downlink("100 Mbps")
 *                         .uplink("10 Mbps")
 *                         .build())
 *                     .maximumBitRate(NetworkServicePccRuleQosPolicyMaximumBitRateArgs.builder()
 *                         .downlink("1 Gbps")
 *                         .uplink("100 Mbps")
 *                         .build())
 *                     .build())
 *                 .serviceDataFlowTemplates(NetworkServicePccRuleServiceDataFlowTemplateArgs.builder()
 *                     .direction("Uplink")
 *                     .name("IP-to-server")
 *                     .ports()
 *                     .protocols("ip")
 *                     .remoteIpLists("10.3.4.0/24")
 *                     .build())
 *                 .build())
 *             .serviceQosPolicy(NetworkServiceServiceQosPolicyArgs.builder()
 *                 .allocationAndRetentionPriorityLevel(9)
 *                 .qosIndicator(9)
 *                 .preemptionCapability("NotPreempt")
 *                 .preemptionVulnerability("Preemptable")
 *                 .maximumBitRate(NetworkServiceServiceQosPolicyMaximumBitRateArgs.builder()
 *                     .downlink("1 Gbps")
 *                     .uplink("100 Mbps")
 *                     .build())
 *                 .build())
 *             .tags(Map.of("key", "value"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: east us
 *   exampleNetwork:
 *     type: azure:mobile:Network
 *     name: example
 *     properties:
 *       name: example-mn
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       mobileCountryCode: '001'
 *       mobileNetworkCode: '01'
 *   exampleNetworkService:
 *     type: azure:mobile:NetworkService
 *     name: example
 *     properties:
 *       name: example-mns
 *       mobileNetworkId: ${exampleNetwork.id}
 *       location: ${example.location}
 *       servicePrecedence: 0
 *       pccRules:
 *         - name: default-rule
 *           precedence: 1
 *           trafficControlEnabled: true
 *           qosPolicy:
 *             allocationAndRetentionPriorityLevel: 9
 *             qosIndicator: 9
 *             preemptionCapability: NotPreempt
 *             preemptionVulnerability: Preemptable
 *             guaranteedBitRate:
 *               downlink: 100 Mbps
 *               uplink: 10 Mbps
 *             maximumBitRate:
 *               downlink: 1 Gbps
 *               uplink: 100 Mbps
 *           serviceDataFlowTemplates:
 *             - direction: Uplink
 *               name: IP-to-server
 *               ports: []
 *               protocols:
 *                 - ip
 *               remoteIpLists:
 *                 - 10.3.4.0/24
 *       serviceQosPolicy:
 *         allocationAndRetentionPriorityLevel: 9
 *         qosIndicator: 9
 *         preemptionCapability: NotPreempt
 *         preemptionVulnerability: Preemptable
 *         maximumBitRate:
 *           downlink: 1 Gbps
 *           uplink: 100 Mbps
 *       tags:
 *         key: value
 * ```
 * 
 * ## Import
 * Mobile Network Service can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:mobile/networkService:NetworkService example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.MobileNetwork/mobileNetworks/mobileNetwork1/services/service1
 * ```
 */
public class NetworkService internal constructor(
    override val javaResource: com.pulumi.azure.mobile.NetworkService,
) : KotlinCustomResource(javaResource, NetworkServiceMapper) {
    /**
     * Specifies the Azure Region where the Mobile Network Service should exist. Changing this forces a new Mobile Network Service to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the ID of the Mobile Network Service. Changing this forces a new Mobile Network Service to be created.
     */
    public val mobileNetworkId: Output
        get() = javaResource.mobileNetworkId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name which should be used for this Mobile Network Service. Changing this forces a new Mobile Network Service to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A `pcc_rule` block as defined below. The set of PCC Rules that make up this service.
     */
    public val pccRules: Output>
        get() = javaResource.pccRules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    networkServicePccRuleToKotlin(args0)
                })
            })
        })

    /**
     * A precedence value that is used to decide between services when identifying the QoS values to use for a particular SIM. A lower value means a higher priority. This value should be unique among all services configured in the mobile network. Must be between `0` and `255`.
     */
    public val servicePrecedence: Output
        get() = javaResource.servicePrecedence().applyValue({ args0 -> args0 })

    /**
     * A `service_qos_policy` block as defined below. The QoS policy to use for packets matching this service. This can be overridden for particular flows using the ruleQosPolicy field in a `pcc_rule`. If this field is not specified then the `sim_policy` of User Equipment (UE) will define the QoS settings.
     */
    public val serviceQosPolicy: Output?
        get() = javaResource.serviceQosPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> networkServiceServiceQosPolicyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A mapping of tags which should be assigned to the Mobile Network Service.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object NetworkServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mobile.NetworkService::class == javaResource::class

    override fun map(javaResource: Resource): NetworkService = NetworkService(
        javaResource as
            com.pulumi.azure.mobile.NetworkService,
    )
}

/**
 * @see [NetworkService].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NetworkService].
 */
public suspend fun networkService(
    name: String,
    block: suspend NetworkServiceResourceBuilder.() -> Unit,
): NetworkService {
    val builder = NetworkServiceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NetworkService].
 * @param name The _unique_ name of the resulting resource.
 */
public fun networkService(name: String): NetworkService {
    val builder = NetworkServiceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy