aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
236 stars 78 forks source link

How to use Write-EVBEvent cmdlet? #110

Closed lamw closed 4 years ago

lamw commented 4 years ago

Expected Behavior

I'm attempting to publish a custom event into the new EventBridge service using the Write-EVBEvent cmdlet. However, there's are no examples in the documentation on how this cmdlet is supposed to work and when attempting to publish an event, the results is a FailedEntryCount. There's no details on what exactly failed ...

Current Behavior

$details = [pscustomobject] @{
    VM = "Bar"
    Details = "User Foo powered on Bar"
}

$json = ($details | convertTo-Json).toString()

$payload = New-Object Amazon.EventBridge.Model.PutEventsRequestEntry
$payload.EventBusName = "William"
$payload.Source = "vcenter.producer"
$payload.Detail = $details
$payload.DetailType = "PoweredOnEvent"

Write-EVBEvent -Entry @($payload)

Results:

Entries FailedEntryCount
------- ----------------
{}      1

Possible Solution

Provide a more detailed example in the Get-Help, right now it just repeats the description of what the cmdlt does but not provide any details. It would also be nice to see better output when the operation fails and what actionable task a user can take to debug further

Steps to Reproduce (for bugs)

Run the above snippet with an account to EventBridge and event bus named "William"

Context

Attempting to exercise the new EventBridge feature and publish a custom event from my application to EventBridge

Your Environment

Include as many relevant details about the environment where the bug was discovered.

dreams-and-thoughts commented 2 years ago

As of today still looks to be no working example in the docs.

https://docs.aws.amazon.com/powershell/latest/reference/items/Write-EVBEvent.html