com.pulumi.azure.monitoring.ActionGroup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.monitoring;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.inputs.ActionGroupState;
import com.pulumi.azure.monitoring.outputs.ActionGroupArmRoleReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupAutomationRunbookReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupAzureAppPushReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupAzureFunctionReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupEmailReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupEventHubReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupItsmReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupLogicAppReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupSmsReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupVoiceReceiver;
import com.pulumi.azure.monitoring.outputs.ActionGroupWebhookReceiver;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages an Action Group within Azure Monitor.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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.core.CoreFunctions;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
* import com.pulumi.azure.monitoring.ActionGroup;
* import com.pulumi.azure.monitoring.ActionGroupArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupArmRoleReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupAutomationRunbookReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupAzureAppPushReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupAzureFunctionReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupEmailReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupEventHubReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupItsmReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupLogicAppReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupSmsReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupVoiceReceiverArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
* 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 }{{@code
* public static void main(String[] args) }{{@code
* Pulumi.run(App::stack);
* }}{@code
*
* public static void stack(Context ctx) }{{@code
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("monitoring-resources")
* .location("West Europe")
* .build());
*
* final var current = CoreFunctions.getClientConfig();
*
* var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
* .name("workspace-01")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
*
* var exampleActionGroup = new ActionGroup("exampleActionGroup", ActionGroupArgs.builder()
* .name("CriticalAlertsAction")
* .resourceGroupName(example.name())
* .shortName("p0action")
* .armRoleReceivers(ActionGroupArmRoleReceiverArgs.builder()
* .name("armroleaction")
* .roleId("de139f84-1756-47ae-9be6-808fbbe84772")
* .useCommonAlertSchema(true)
* .build())
* .automationRunbookReceivers(ActionGroupAutomationRunbookReceiverArgs.builder()
* .name("action_name_1")
* .automationAccountId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-runbooks/providers/Microsoft.Automation/automationAccounts/aaa001")
* .runbookName("my runbook")
* .webhookResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-runbooks/providers/Microsoft.Automation/automationAccounts/aaa001/webHooks/webhook_alert")
* .isGlobalRunbook(true)
* .serviceUri("https://s13events.azure-automation.net/webhooks?token=randomtoken")
* .useCommonAlertSchema(true)
* .build())
* .azureAppPushReceivers(ActionGroupAzureAppPushReceiverArgs.builder()
* .name("pushtoadmin")
* .emailAddress("admin}{@literal @}{@code contoso.com")
* .build())
* .azureFunctionReceivers(ActionGroupAzureFunctionReceiverArgs.builder()
* .name("funcaction")
* .functionAppResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-funcapp/providers/Microsoft.Web/sites/funcapp")
* .functionName("myfunc")
* .httpTriggerUrl("https://example.com/trigger")
* .useCommonAlertSchema(true)
* .build())
* .emailReceivers(
* ActionGroupEmailReceiverArgs.builder()
* .name("sendtoadmin")
* .emailAddress("admin}{@literal @}{@code contoso.com")
* .build(),
* ActionGroupEmailReceiverArgs.builder()
* .name("sendtodevops")
* .emailAddress("devops}{@literal @}{@code contoso.com")
* .useCommonAlertSchema(true)
* .build())
* .eventHubReceivers(ActionGroupEventHubReceiverArgs.builder()
* .name("sendtoeventhub")
* .eventHubNamespace("eventhubnamespace")
* .eventHubName("eventhub1")
* .subscriptionId("00000000-0000-0000-0000-000000000000")
* .useCommonAlertSchema(false)
* .build())
* .itsmReceivers(ActionGroupItsmReceiverArgs.builder()
* .name("createorupdateticket")
* .workspaceId(exampleAnalyticsWorkspace.workspaceId().applyValue(workspaceId -> String.format("%s|%s", current.applyValue(getClientConfigResult -> getClientConfigResult.subscriptionId()),workspaceId)))
* .connectionId("53de6956-42b4-41ba-be3c-b154cdf17b13")
* .ticketConfiguration("}{{@code \"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"}{}{@code \",\"CreateOneWIPerCI\":false}}{@code ")
* .region("southcentralus")
* .build())
* .logicAppReceivers(ActionGroupLogicAppReceiverArgs.builder()
* .name("logicappaction")
* .resourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-logicapp/providers/Microsoft.Logic/workflows/logicapp")
* .callbackUrl("https://logicapptriggerurl/...")
* .useCommonAlertSchema(true)
* .build())
* .smsReceivers(ActionGroupSmsReceiverArgs.builder()
* .name("oncallmsg")
* .countryCode("1")
* .phoneNumber("1231231234")
* .build())
* .voiceReceivers(ActionGroupVoiceReceiverArgs.builder()
* .name("remotesupport")
* .countryCode("86")
* .phoneNumber("13888888888")
* .build())
* .webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
* .name("callmyapiaswell")
* .serviceUri("http://example.com/alert")
* .useCommonAlertSchema(true)
* .build())
* .build());
*
* }}{@code
* }}{@code
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Action Groups can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:monitoring/actionGroup:ActionGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/actionGroups/myagname
* ```
*
*/
@ResourceType(type="azure:monitoring/actionGroup:ActionGroup")
public class ActionGroup extends com.pulumi.resources.CustomResource {
/**
* One or more `arm_role_receiver` blocks as defined below.
*
*/
@Export(name="armRoleReceivers", refs={List.class,ActionGroupArmRoleReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> armRoleReceivers;
/**
* @return One or more `arm_role_receiver` blocks as defined below.
*
*/
public Output>> armRoleReceivers() {
return Codegen.optional(this.armRoleReceivers);
}
/**
* One or more `automation_runbook_receiver` blocks as defined below.
*
*/
@Export(name="automationRunbookReceivers", refs={List.class,ActionGroupAutomationRunbookReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> automationRunbookReceivers;
/**
* @return One or more `automation_runbook_receiver` blocks as defined below.
*
*/
public Output>> automationRunbookReceivers() {
return Codegen.optional(this.automationRunbookReceivers);
}
/**
* One or more `azure_app_push_receiver` blocks as defined below.
*
*/
@Export(name="azureAppPushReceivers", refs={List.class,ActionGroupAzureAppPushReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> azureAppPushReceivers;
/**
* @return One or more `azure_app_push_receiver` blocks as defined below.
*
*/
public Output>> azureAppPushReceivers() {
return Codegen.optional(this.azureAppPushReceivers);
}
/**
* One or more `azure_function_receiver` blocks as defined below.
*
*/
@Export(name="azureFunctionReceivers", refs={List.class,ActionGroupAzureFunctionReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> azureFunctionReceivers;
/**
* @return One or more `azure_function_receiver` blocks as defined below.
*
*/
public Output>> azureFunctionReceivers() {
return Codegen.optional(this.azureFunctionReceivers);
}
/**
* One or more `email_receiver` blocks as defined below.
*
*/
@Export(name="emailReceivers", refs={List.class,ActionGroupEmailReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> emailReceivers;
/**
* @return One or more `email_receiver` blocks as defined below.
*
*/
public Output>> emailReceivers() {
return Codegen.optional(this.emailReceivers);
}
/**
* Whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. Defaults to `true`.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return Whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. Defaults to `true`.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* One or more `event_hub_receiver` blocks as defined below.
*
*/
@Export(name="eventHubReceivers", refs={List.class,ActionGroupEventHubReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> eventHubReceivers;
/**
* @return One or more `event_hub_receiver` blocks as defined below.
*
*/
public Output>> eventHubReceivers() {
return Codegen.optional(this.eventHubReceivers);
}
/**
* One or more `itsm_receiver` blocks as defined below.
*
*/
@Export(name="itsmReceivers", refs={List.class,ActionGroupItsmReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> itsmReceivers;
/**
* @return One or more `itsm_receiver` blocks as defined below.
*
*/
public Output>> itsmReceivers() {
return Codegen.optional(this.itsmReceivers);
}
/**
* The Azure Region where the Action Group should exist. Changing this forces a new Action Group to be created. Defaults to `global`.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return The Azure Region where the Action Group should exist. Changing this forces a new Action Group to be created. Defaults to `global`.
*
*/
public Output location() {
return this.location;
}
/**
* One or more `logic_app_receiver` blocks as defined below.
*
*/
@Export(name="logicAppReceivers", refs={List.class,ActionGroupLogicAppReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> logicAppReceivers;
/**
* @return One or more `logic_app_receiver` blocks as defined below.
*
*/
public Output>> logicAppReceivers() {
return Codegen.optional(this.logicAppReceivers);
}
/**
* The name of the Action Group. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the Action Group. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The name of the resource group in which to create the Action Group instance. Changing this forces a new resource to be created.
*
*/
@Export(name="resourceGroupName", refs={String.class}, tree="[0]")
private Output resourceGroupName;
/**
* @return The name of the resource group in which to create the Action Group instance. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* The short name of the action group. This will be used in SMS messages.
*
*/
@Export(name="shortName", refs={String.class}, tree="[0]")
private Output shortName;
/**
* @return The short name of the action group. This will be used in SMS messages.
*
*/
public Output shortName() {
return this.shortName;
}
/**
* One or more `sms_receiver` blocks as defined below.
*
*/
@Export(name="smsReceivers", refs={List.class,ActionGroupSmsReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> smsReceivers;
/**
* @return One or more `sms_receiver` blocks as defined below.
*
*/
public Output>> smsReceivers() {
return Codegen.optional(this.smsReceivers);
}
/**
* A mapping of tags to assign to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags to assign to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* One or more `voice_receiver` blocks as defined below.
*
*/
@Export(name="voiceReceivers", refs={List.class,ActionGroupVoiceReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> voiceReceivers;
/**
* @return One or more `voice_receiver` blocks as defined below.
*
*/
public Output>> voiceReceivers() {
return Codegen.optional(this.voiceReceivers);
}
/**
* One or more `webhook_receiver` blocks as defined below.
*
*/
@Export(name="webhookReceivers", refs={List.class,ActionGroupWebhookReceiver.class}, tree="[0,1]")
private Output* @Nullable */ List> webhookReceivers;
/**
* @return One or more `webhook_receiver` blocks as defined below.
*
*/
public Output>> webhookReceivers() {
return Codegen.optional(this.webhookReceivers);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ActionGroup(java.lang.String name) {
this(name, ActionGroupArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ActionGroup(java.lang.String name, ActionGroupArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public ActionGroup(java.lang.String name, ActionGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/actionGroup:ActionGroup", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ActionGroup(java.lang.String name, Output id, @Nullable ActionGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/actionGroup:ActionGroup", name, state, makeResourceOptions(options, id), false);
}
private static ActionGroupArgs makeArgs(ActionGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ActionGroupArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static ActionGroup get(java.lang.String name, Output id, @Nullable ActionGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ActionGroup(name, id, state, options);
}
}