Event Hub
Single item in List or Get Event Hub operation Uses Azure REST API version 2024-01-01. In version 2.x of the Azure Native provider, it used API version 2022-10-01-preview. Other available API versions: 2018-01-01-preview, 2021-01-01-preview, 2021-06-01-preview, 2021-11-01, 2022-01-01-preview, 2022-10-01-preview, 2023-01-01-preview, 2024-05-01-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native eventhub [ApiVersion]
. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.
Example Usage
EventHubCreate
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var eventHub = new AzureNative.EventHub.EventHub("eventHub", new()
{
CaptureDescription = new AzureNative.EventHub.Inputs.CaptureDescriptionArgs
{
Destination = new AzureNative.EventHub.Inputs.DestinationArgs
{
ArchiveNameFormat = "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}",
BlobContainer = "container",
Identity = new AzureNative.EventHub.Inputs.CaptureIdentityArgs
{
Type = AzureNative.EventHub.CaptureIdentityType.UserAssigned,
UserAssignedIdentity = "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2",
},
Name = "EventHubArchive.AzureBlockBlob",
StorageAccountResourceId = "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage",
},
Enabled = true,
Encoding = AzureNative.EventHub.EncodingCaptureDescription.Avro,
IntervalInSeconds = 120,
SizeLimitInBytes = 10485763,
},
EventHubName = "sdk-EventHub-6547",
MessageRetentionInDays = 4,
NamespaceName = "sdk-Namespace-5357",
PartitionCount = 4,
ResourceGroupName = "Default-NotificationHubs-AustraliaEast",
RetentionDescription = new AzureNative.EventHub.Inputs.RetentionDescriptionArgs
{
CleanupPolicy = AzureNative.EventHub.CleanupPolicyRetentionDescription.Compact,
RetentionTimeInHours = 96,
TombstoneRetentionTimeInHours = 1,
},
Status = AzureNative.EventHub.EntityStatus.Active,
UserMetadata = "key",
});
});
package main
import (
eventhub "github.com/pulumi/pulumi-azure-native-sdk/eventhub/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := eventhub.NewEventHub(ctx, "eventHub", &eventhub.EventHubArgs{
CaptureDescription: &eventhub.CaptureDescriptionArgs{
Destination: &eventhub.DestinationArgs{
ArchiveNameFormat: pulumi.String("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"),
BlobContainer: pulumi.String("container"),
Identity: &eventhub.CaptureIdentityArgs{
Type: eventhub.CaptureIdentityTypeUserAssigned,
UserAssignedIdentity: pulumi.String("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2"),
},
Name: pulumi.String("EventHubArchive.AzureBlockBlob"),
StorageAccountResourceId: pulumi.String("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage"),
},
Enabled: pulumi.Bool(true),
Encoding: eventhub.EncodingCaptureDescriptionAvro,
IntervalInSeconds: pulumi.Int(120),
SizeLimitInBytes: pulumi.Int(10485763),
},
EventHubName: pulumi.String("sdk-EventHub-6547"),
MessageRetentionInDays: pulumi.Float64(4),
NamespaceName: pulumi.String("sdk-Namespace-5357"),
PartitionCount: pulumi.Float64(4),
ResourceGroupName: pulumi.String("Default-NotificationHubs-AustraliaEast"),
RetentionDescription: &eventhub.RetentionDescriptionArgs{
CleanupPolicy: pulumi.String(eventhub.CleanupPolicyRetentionDescriptionCompact),
RetentionTimeInHours: pulumi.Float64(96),
TombstoneRetentionTimeInHours: pulumi.Int(1),
},
Status: eventhub.EntityStatusActive,
UserMetadata: pulumi.String("key"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.eventhub.EventHub;
import com.pulumi.azurenative.eventhub.EventHubArgs;
import com.pulumi.azurenative.eventhub.inputs.CaptureDescriptionArgs;
import com.pulumi.azurenative.eventhub.inputs.DestinationArgs;
import com.pulumi.azurenative.eventhub.inputs.CaptureIdentityArgs;
import com.pulumi.azurenative.eventhub.inputs.RetentionDescriptionArgs;
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 eventHub = new EventHub("eventHub", EventHubArgs.builder()
.captureDescription(CaptureDescriptionArgs.builder()
.destination(DestinationArgs.builder()
.archiveNameFormat("{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}")
.blobContainer("container")
.identity(CaptureIdentityArgs.builder()
.type("UserAssigned")
.userAssignedIdentity("/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2")
.build())
.name("EventHubArchive.AzureBlockBlob")
.storageAccountResourceId("/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage")
.build())
.enabled(true)
.encoding("Avro")
.intervalInSeconds(120)
.sizeLimitInBytes(10485763)
.build())
.eventHubName("sdk-EventHub-6547")
.messageRetentionInDays(4)
.namespaceName("sdk-Namespace-5357")
.partitionCount(4)
.resourceGroupName("Default-NotificationHubs-AustraliaEast")
.retentionDescription(RetentionDescriptionArgs.builder()
.cleanupPolicy("Compact")
.retentionTimeInHours(96)
.tombstoneRetentionTimeInHours(1)
.build())
.status("Active")
.userMetadata("key")
.build());
}
}
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:eventhub:EventHub sdk-EventHub-10 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}
Properties
The Azure API version of the resource.
Properties of capture description
Number of days to retain the events for this Event Hub, value should be 1 to 7 days
Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.
Current number of shards on the Event Hub.
Event Hub retention settings
The system meta data relating to this resource.
Gets and Sets Metadata of User.