[azsystemevents] Updating to the latest commit: fb64eaa0dfc7ee8abc8e10369495729d5b3c1cc5 (#23775)

This commit is contained in:
Richard Park 2024-11-19 11:57:54 -08:00 коммит произвёл GitHub
Родитель 5b99014e13
Коммит 6cfdc3978f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
13 изменённых файлов: 793 добавлений и 1225 удалений

Просмотреть файл

@ -1,14 +1,19 @@
# Release History
## 0.4.4 (Unreleased)
## 0.5.0 (2024-11-19)
### Features Added
- A new system event has been added: `ResourceNotificationsContainerServiceEventResourcesScheduledEventData`
- A new field: `StorageLifecyclePolicyCompletedEventData.PolicyRunSummary`
### Breaking Changes
- Models, that were not system events, have been removed. Any fields from those types are incorporated into their corresponding system event type.
### Bugs Fixed
### Other Changes
- ACSMessageDeliveryStatusUpdatedEventData.Error has been corrected to use an exported type.
## 0.4.3 (2024-10-14)

Просмотреть файл

@ -1181,6 +1181,27 @@ func PossibleStorageBlobAccessTierValues() []StorageBlobAccessTier {
}
}
// StorageLifecycleCompletionStatus - The status for a LCM policy.
type StorageLifecycleCompletionStatus string
const (
// StorageLifecycleCompletionStatusCompleted - Completed
StorageLifecycleCompletionStatusCompleted StorageLifecycleCompletionStatus = "Completed"
// StorageLifecycleCompletionStatusCompletedWithError - CompletedWithError
StorageLifecycleCompletionStatusCompletedWithError StorageLifecycleCompletionStatus = "CompletedWithError"
// StorageLifecycleCompletionStatusIncomplete - Incomplete
StorageLifecycleCompletionStatusIncomplete StorageLifecycleCompletionStatus = "Incomplete"
)
// PossibleStorageLifecycleCompletionStatusValues returns the possible values for the StorageLifecycleCompletionStatus const type.
func PossibleStorageLifecycleCompletionStatusValues() []StorageLifecycleCompletionStatus {
return []StorageLifecycleCompletionStatus{
StorageLifecycleCompletionStatusCompleted,
StorageLifecycleCompletionStatusCompletedWithError,
StorageLifecycleCompletionStatusIncomplete,
}
}
// StorageTaskAssignmentCompletedStatus - The status for a storage task.
type StorageTaskAssignmentCompletedStatus string

Просмотреть файл

@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/azsystemevents
go 1.18
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0
github.com/joho/godotenv v1.5.1
github.com/stretchr/testify v1.9.0
)
@ -12,7 +12,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/text v0.18.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Просмотреть файл

@ -1,5 +1,5 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@ -13,10 +13,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

Просмотреть файл

@ -26,11 +26,6 @@ func main() {
return err
}
// remove extraneous types
if err := doRemove(); err != nil {
return err
}
if err := generateSystemEventEnum(); err != nil {
return err
}
@ -40,7 +35,7 @@ func main() {
}
if err := fn(); err != nil {
fmt.Printf("Failed with error: %s\n", err)
fmt.Printf("./internal/generate: Failed with error: %s\n", err)
os.Exit(1)
}
@ -57,6 +52,19 @@ func swapErrorTypes() error {
return err
}
// NOTE: the renaming of the error type is done in the propertyNameOverrideGo.tsp (AcsMessageChannelEventError)
// NOTE: there appears to be a bug where my type name is automatically being capitalized, even though I marked it as internal.
// Filed as https://github.com/Azure/autorest.go/issues/1467.
if err := gopls.Rename(syms.Get("InternalACSMessageChannelEventError"), "internalACSMessageChannelEventError"); err != nil {
return err
}
if err := gopls.Rename(syms.Get("InternalACSRouterCommunicationError"), "internalACSRouterCommunicationError"); err != nil {
return err
}
// TODO: do I really need to handle these myself? Can I not use TypeSpec to do it?
{
if err := SwapType(syms.Get("AcsMessageReceivedEventData.Error"), "*Error"); err != nil {
return err
@ -67,6 +75,16 @@ func swapErrorTypes() error {
}
}
{
if err := SwapType(syms.Get("ACSMessageDeliveryStatusUpdatedEventData.Error"), "*Error"); err != nil {
return err
}
if err := UseCustomUnpopulate(modelsSerdeGoFile, "ACSMessageDeliveryStatusUpdatedEventData.Error", "unmarshalInternalACSMessageChannelEventError"); err != nil {
return err
}
}
{
if err := SwapType(syms.Get("AcsRouterJobClassificationFailedEventData.Errors"), "[]*Error"); err != nil {
return err
@ -93,7 +111,7 @@ func swapErrorTypes() error {
}
if strings.HasSuffix(sym.Name, "Error") && !strings.HasPrefix(sym.Name, "internal") && sym.Type == "Struct" {
return fmt.Errorf("found redundant unhandled error type %s\n", sym.Name)
return fmt.Errorf("found error type which should have been deleted/renamed %q", sym.Name)
}
}
@ -134,38 +152,3 @@ func deleteUnneededFiles() {
}
}
}
func doRemove() error {
modelsToRemove := []string{
// These types are base objects of some of our system events in the TypeSpec, giving them a simple way to share fields.
// Our generator handles this parent/child relationship by just inlining those properties into the children, so the base struct is just vestigial.
// Note that these have been annotated with @output, which is why they're not just clipped out using our normal "unused/unreferenced" type logic
// in the Go emitter.
"ACSChatEventBaseProperties",
"ACSChatEventInThreadBaseProperties",
"ACSChatMessageEventBaseProperties",
"ACSChatMessageEventInThreadBaseProperties",
"ACSChatThreadEventBaseProperties",
"ACSChatThreadEventInThreadBaseProperties",
"ACSRouterEventData",
"ACSRouterJobEventData",
"ACSRouterWorkerEventData",
"ACSSmsEventBaseProperties",
"AppConfigurationSnapshotEventData",
"AVSClusterEventData",
"AVSPrivateCloudEventData",
"AVSScriptExecutionEventData",
"ContainerServiceClusterSupportEventData",
"ContainerServiceNodePoolRollingEventData",
"ResourceNotificationsResourceDeletedEventData",
"ResourceNotificationsResourceUpdatedEventData",
}
for _, m := range modelsToRemove {
if err := DeleteType(m); err != nil {
return err
}
}
return nil
}

Просмотреть файл

@ -9,5 +9,5 @@ const (
ModuleName = "azsystemevents"
// ModuleVersion is the semantic version (see http://semver.org) of this module.
ModuleVersion = "v0.4.4"
ModuleVersion = "v0.5.0"
)

Просмотреть файл

@ -611,7 +611,7 @@ type ACSMessageDeliveryStatusUpdatedEventData struct {
ChannelKind *ACSMessageChannelKind
// REQUIRED; The channel event error
Error *internalACSMessageChannelEventError
Error *Error
// REQUIRED; The time message was received
ReceivedTimestamp *time.Time
@ -629,21 +629,6 @@ type ACSMessageDeliveryStatusUpdatedEventData struct {
To *string
}
// ACSMessageEventData - Schema of common properties of all chat thread events
type ACSMessageEventData struct {
// REQUIRED; The channel event error
Error *internalACSMessageChannelEventError
// REQUIRED; The time message was received
ReceivedTimestamp *time.Time
// The message sender
From *string
// The message recipient
To *string
}
// ACSMessageInteractiveButtonReplyContent - Message Interactive button reply content for a user to business message
type ACSMessageInteractiveButtonReplyContent struct {
// The ID of the button
@ -2015,27 +2000,6 @@ type CommunicationUserIdentifierModel struct {
ID *string
}
// ContainerRegistryArtifactEventData - The content of the event request message.
type ContainerRegistryArtifactEventData struct {
// REQUIRED; The connected registry information if the event is generated by a connected registry.
ConnectedRegistry *ContainerRegistryEventConnectedRegistry
// REQUIRED; The target of the event.
Target *ContainerRegistryArtifactEventTarget
// REQUIRED; The time at which the event occurred.
Timestamp *time.Time
// The action that encompasses the provided event.
Action *string
// The event ID.
ID *string
// The location of the event.
Location *string
}
// ContainerRegistryArtifactEventTarget - The target of the event.
type ContainerRegistryArtifactEventTarget struct {
// The digest of the artifact.
@ -2117,38 +2081,6 @@ type ContainerRegistryEventConnectedRegistry struct {
Name *string
}
// ContainerRegistryEventData - The content of the event request message.
type ContainerRegistryEventData struct {
// REQUIRED; The agent that initiated the event. For most situations, this could be from the authorization context of the
// request.
Actor *ContainerRegistryEventActor
// REQUIRED; The connected registry information if the event is generated by a connected registry.
ConnectedRegistry *ContainerRegistryEventConnectedRegistry
// REQUIRED; The request that generated the event.
Request *ContainerRegistryEventRequest
// REQUIRED; The registry node that generated the event. Put differently, while the actor initiates the event, the source
// generates it.
Source *ContainerRegistryEventSource
// REQUIRED; The target of the event.
Target *ContainerRegistryEventTarget
// REQUIRED; The time at which the event occurred.
Timestamp *time.Time
// The action that encompasses the provided event.
Action *string
// The event ID.
ID *string
// The location of the event.
Location *string
}
// ContainerRegistryEventRequest - The request that generated the event.
type ContainerRegistryEventRequest struct {
// The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the
@ -2367,50 +2299,6 @@ type DeviceConnectionStateEventInfo struct {
SequenceNumber *string
}
// DeviceConnectionStateEventProperties - Schema of the Data property of an EventGridEvent for a device connection state event
// (DeviceConnected, DeviceDisconnected).
type DeviceConnectionStateEventProperties struct {
// REQUIRED; Information about the device connection state event.
DeviceConnectionStateEventInfo *DeviceConnectionStateEventInfo
// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit
// alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '.
DeviceID *string
// Name of the IoT Hub where the device was created or deleted.
HubName *string
// The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit
// alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '.
ModuleID *string
}
// DeviceLifeCycleEventProperties - Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated,
// DeviceDeleted).
type DeviceLifeCycleEventProperties struct {
// REQUIRED; Information about the device twin, which is the cloud representation of application device metadata.
Twin *DeviceTwinInfo
// The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit
// alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '.
DeviceID *string
// Name of the IoT Hub where the device was created or deleted.
HubName *string
}
// DeviceTelemetryEventProperties - Schema of the Data property of an EventGridEvent for a device telemetry event (DeviceTelemetry).
type DeviceTelemetryEventProperties struct {
// REQUIRED; The content of the message from the device.
Body map[string]any
// REQUIRED; Application properties are user-defined strings that can be added to the message. These fields are optional.
Properties map[string]*string
// REQUIRED; System properties help identify contents and source of the messages.
SystemProperties map[string]*string
}
// DeviceTwinInfo - Information about the device twin, which is the cloud representation of application device metadata.
type DeviceTwinInfo struct {
// REQUIRED; Properties JSON element.
@ -2527,20 +2415,6 @@ type EventGridMQTTClientDeletedEventData struct {
NamespaceName *string
}
// EventGridMQTTClientEventData - Schema of the Data property of an EventGridEvent for MQTT Client state changes.
type EventGridMQTTClientEventData struct {
// Unique identifier for the MQTT client that the client presents to the service
// for authentication. This case-sensitive string can be up to 128 characters
// long, and supports UTF-8 characters.
ClientAuthenticationName *string
// Name of the client resource in the Event Grid namespace.
ClientName *string
// Name of the Event Grid namespace where the MQTT client was created or updated.
NamespaceName *string
}
// EventGridMQTTClientSessionConnectedEventData - Event data for Microsoft.EventGrid.MQTTClientSessionConnected event.
type EventGridMQTTClientSessionConnectedEventData struct {
// Unique identifier for the MQTT client that the client presents to the service
@ -2811,6 +2685,33 @@ type IOTHubDeviceTelemetryEventData struct {
SystemProperties map[string]*string
}
// internalACSMessageChannelEventError - Message Channel Event Error
type internalACSMessageChannelEventError struct {
// The channel error code
ChannelCode *string
// The channel error message
ChannelMessage *string
}
// internalACSRouterCommunicationError - Router Communication Error
type internalACSRouterCommunicationError struct {
// REQUIRED; List of Router Communication Errors
Details []internalACSRouterCommunicationError
// REQUIRED; Router Communication Inner Error
Innererror *internalACSRouterCommunicationError
// Router Communication Error Code
Code *string
// Router Communication Error Message
Message *string
// Router Communication Error Target
Target *string
}
// KeyVaultAccessPolicyChangedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.VaultAccessPolicyChanged
// event.
type KeyVaultAccessPolicyChangedEventData struct {
@ -3187,24 +3088,6 @@ type MapsGeofenceEnteredEventData struct {
IsEventPublished *bool
}
// MapsGeofenceEventProperties - Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, GeofenceExited,
// GeofenceResult).
type MapsGeofenceEventProperties struct {
// REQUIRED; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer
// around the fence.
Geometries []MapsGeofenceGeometry
// Lists of the geometry ID of the geofence which is expired relative to the user time in the request.
ExpiredGeofenceGeometryID []string
// Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request.
InvalidPeriodGeofenceGeometryID []string
// True if at least one event is published to the Azure Maps event subscriber, false if no event is published to the Azure
// Maps event subscriber.
IsEventPublished *bool
}
// MapsGeofenceExitedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event.
type MapsGeofenceExitedEventData struct {
// REQUIRED; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer
@ -3498,19 +3381,6 @@ type MediaJobOutputScheduledEventData struct {
PreviousState *MediaJobState
}
// MediaJobOutputStateChangeEventData - Schema of the Data property of an EventGridEvent for a
// Microsoft.Media.JobOutputStateChange event.
type MediaJobOutputStateChangeEventData struct {
// REQUIRED; Gets the Job correlation data.
JobCorrelationData map[string]*string
// REQUIRED; Gets the output.
Output MediaJobOutputClassification
// REQUIRED; The previous state of the Job.
PreviousState *MediaJobState
}
// MediaJobProcessingEventData - Job processing event data. Schema of the data property of an EventGridEvent for
// a Microsoft.Media.JobProcessing event.
type MediaJobProcessingEventData struct {
@ -3537,19 +3407,6 @@ type MediaJobScheduledEventData struct {
State *MediaJobState
}
// MediaJobStateChangeEventData - Schema of the Data property of an EventGridEvent for a
// Microsoft.Media.JobStateChange event.
type MediaJobStateChangeEventData struct {
// REQUIRED; Gets the Job correlation data.
CorrelationData map[string]*string
// REQUIRED; The previous state of the Job.
PreviousState *MediaJobState
// REQUIRED; The new state of the Job.
State *MediaJobState
}
// MediaLiveEventChannelArchiveHeartbeatEventData - Channel Archive heartbeat event data. Schema of the data property of an
// EventGridEvent for a Microsoft.Media.LiveEventChannelArchiveHeartbeat event.
type MediaLiveEventChannelArchiveHeartbeatEventData struct {
@ -4191,6 +4048,19 @@ type ResourceHTTPRequest struct {
URL *string
}
// ResourceNotificationsContainerServiceEventResourcesScheduledEventData - Schema of the Data property of an event grid event
// for a Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted preview event.
type ResourceNotificationsContainerServiceEventResourcesScheduledEventData struct {
// REQUIRED; details about operational info
OperationalDetails *ResourceNotificationsOperationalDetails
// REQUIRED; resourceInfo details for update event
ResourceDetails *ResourceNotificationsResourceUpdatedDetails
// api version of the resource properties bag
APIVersion *string
}
// ResourceNotificationsHealthResourcesAnnotatedEventData - Schema of the Data property of an EventGridEvent for a
// Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated event.
type ResourceNotificationsHealthResourcesAnnotatedEventData struct {
@ -4838,6 +4708,9 @@ type StorageLifecyclePolicyCompletedEventData struct {
// REQUIRED; Execution statistics of a specific policy action in a Blob Management cycle.
DeleteSummary *StorageLifecyclePolicyActionSummaryDetail
// REQUIRED; Policy execution summary which shows the completion status of a LCM run"
PolicyRunSummary *StorageLifecyclePolicyRunSummary
// REQUIRED; Execution statistics of a specific policy action in a Blob Management cycle.
TierToArchiveSummary *StorageLifecyclePolicyActionSummaryDetail
@ -4851,6 +4724,12 @@ type StorageLifecyclePolicyCompletedEventData struct {
ScheduleTime *string
}
// StorageLifecyclePolicyRunSummary - Policy run status of an account in a Blob Management cycle.
type StorageLifecyclePolicyRunSummary struct {
// REQUIRED; Policy status can be Completed/CompletedWithError/Incomplete.
CompletionStatus *StorageLifecycleCompletionStatus
}
// StorageTaskAssignmentCompletedEventData - Schema of the Data property of an EventGridEvent for an Microsoft.Storage.StorageTaskAssignmentCompleted
// event.
type StorageTaskAssignmentCompletedEventData struct {
@ -5283,30 +5162,3 @@ type WebSlotSwapWithPreviewStartedEventData struct {
// HTTP verb of this operation.
Verb *string
}
// internalACSMessageChannelEventError - Message Channel Event Error
type internalACSMessageChannelEventError struct {
// The channel error code
ChannelCode *string
// The channel error message
ChannelMessage *string
}
// internalACSRouterCommunicationError - Router Communication Error
type internalACSRouterCommunicationError struct {
// REQUIRED; List of Router Communication Errors
Details []internalACSRouterCommunicationError
// REQUIRED; Router Communication Inner Error
Innererror *internalACSRouterCommunicationError
// Router Communication Error Code
Code *string
// Router Communication Error Message
Message *string
// Router Communication Error Target
Target *string
}

Просмотреть файл

@ -1266,7 +1266,7 @@ func (a *ACSMessageDeliveryStatusUpdatedEventData) UnmarshalJSON(data []byte) er
err = unpopulate(val, "ChannelKind", &a.ChannelKind)
delete(rawMsg, key)
case "error":
err = unpopulate(val, "Error", &a.Error)
err = unmarshalInternalACSMessageChannelEventError(val, "Error", &a.Error)
delete(rawMsg, key)
case "from":
err = unpopulate(val, "From", &a.From)
@ -1291,45 +1291,6 @@ func (a *ACSMessageDeliveryStatusUpdatedEventData) UnmarshalJSON(data []byte) er
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ACSMessageEventData.
func (a ACSMessageEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "error", a.Error)
populate(objectMap, "from", a.From)
populateDateTimeRFC3339(objectMap, "receivedTimeStamp", a.ReceivedTimestamp)
populate(objectMap, "to", a.To)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ACSMessageEventData.
func (a *ACSMessageEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", a, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "error":
err = unpopulate(val, "Error", &a.Error)
delete(rawMsg, key)
case "from":
err = unpopulate(val, "From", &a.From)
delete(rawMsg, key)
case "receivedTimeStamp":
err = unpopulateDateTimeRFC3339(val, "ReceivedTimestamp", &a.ReceivedTimestamp)
delete(rawMsg, key)
case "to":
err = unpopulate(val, "To", &a.To)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", a, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ACSMessageInteractiveButtonReplyContent.
func (a ACSMessageInteractiveButtonReplyContent) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -4668,53 +4629,6 @@ func (c *CommunicationUserIdentifierModel) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryArtifactEventData.
func (c ContainerRegistryArtifactEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "action", c.Action)
populate(objectMap, "connectedRegistry", c.ConnectedRegistry)
populate(objectMap, "id", c.ID)
populate(objectMap, "location", c.Location)
populate(objectMap, "target", c.Target)
populateDateTimeRFC3339(objectMap, "timestamp", c.Timestamp)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryArtifactEventData.
func (c *ContainerRegistryArtifactEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "action":
err = unpopulate(val, "Action", &c.Action)
delete(rawMsg, key)
case "connectedRegistry":
err = unpopulate(val, "ConnectedRegistry", &c.ConnectedRegistry)
delete(rawMsg, key)
case "id":
err = unpopulate(val, "ID", &c.ID)
delete(rawMsg, key)
case "location":
err = unpopulate(val, "Location", &c.Location)
delete(rawMsg, key)
case "target":
err = unpopulate(val, "Target", &c.Target)
delete(rawMsg, key)
case "timestamp":
err = unpopulateDateTimeRFC3339(val, "Timestamp", &c.Timestamp)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryArtifactEventTarget.
func (c ContainerRegistryArtifactEventTarget) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -4914,65 +4828,6 @@ func (c *ContainerRegistryEventConnectedRegistry) UnmarshalJSON(data []byte) err
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryEventData.
func (c ContainerRegistryEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "action", c.Action)
populate(objectMap, "actor", c.Actor)
populate(objectMap, "connectedRegistry", c.ConnectedRegistry)
populate(objectMap, "id", c.ID)
populate(objectMap, "location", c.Location)
populate(objectMap, "request", c.Request)
populate(objectMap, "source", c.Source)
populate(objectMap, "target", c.Target)
populateDateTimeRFC3339(objectMap, "timestamp", c.Timestamp)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryEventData.
func (c *ContainerRegistryEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "action":
err = unpopulate(val, "Action", &c.Action)
delete(rawMsg, key)
case "actor":
err = unpopulate(val, "Actor", &c.Actor)
delete(rawMsg, key)
case "connectedRegistry":
err = unpopulate(val, "ConnectedRegistry", &c.ConnectedRegistry)
delete(rawMsg, key)
case "id":
err = unpopulate(val, "ID", &c.ID)
delete(rawMsg, key)
case "location":
err = unpopulate(val, "Location", &c.Location)
delete(rawMsg, key)
case "request":
err = unpopulate(val, "Request", &c.Request)
delete(rawMsg, key)
case "source":
err = unpopulate(val, "Source", &c.Source)
delete(rawMsg, key)
case "target":
err = unpopulate(val, "Target", &c.Target)
delete(rawMsg, key)
case "timestamp":
err = unpopulateDateTimeRFC3339(val, "Timestamp", &c.Timestamp)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryEventRequest.
func (c ContainerRegistryEventRequest) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -5522,115 +5377,6 @@ func (d *DeviceConnectionStateEventInfo) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeviceConnectionStateEventProperties.
func (d DeviceConnectionStateEventProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "deviceConnectionStateEventInfo", d.DeviceConnectionStateEventInfo)
populate(objectMap, "deviceId", d.DeviceID)
populate(objectMap, "hubName", d.HubName)
populate(objectMap, "moduleId", d.ModuleID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceConnectionStateEventProperties.
func (d *DeviceConnectionStateEventProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "deviceConnectionStateEventInfo":
err = unpopulate(val, "DeviceConnectionStateEventInfo", &d.DeviceConnectionStateEventInfo)
delete(rawMsg, key)
case "deviceId":
err = unpopulate(val, "DeviceID", &d.DeviceID)
delete(rawMsg, key)
case "hubName":
err = unpopulate(val, "HubName", &d.HubName)
delete(rawMsg, key)
case "moduleId":
err = unpopulate(val, "ModuleID", &d.ModuleID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeviceLifeCycleEventProperties.
func (d DeviceLifeCycleEventProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "deviceId", d.DeviceID)
populate(objectMap, "hubName", d.HubName)
populate(objectMap, "twin", d.Twin)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceLifeCycleEventProperties.
func (d *DeviceLifeCycleEventProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "deviceId":
err = unpopulate(val, "DeviceID", &d.DeviceID)
delete(rawMsg, key)
case "hubName":
err = unpopulate(val, "HubName", &d.HubName)
delete(rawMsg, key)
case "twin":
err = unpopulate(val, "Twin", &d.Twin)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeviceTelemetryEventProperties.
func (d DeviceTelemetryEventProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "body", d.Body)
populate(objectMap, "properties", d.Properties)
populate(objectMap, "systemProperties", d.SystemProperties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceTelemetryEventProperties.
func (d *DeviceTelemetryEventProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "body":
err = unpopulate(val, "Body", &d.Body)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &d.Properties)
delete(rawMsg, key)
case "systemProperties":
err = unpopulate(val, "SystemProperties", &d.SystemProperties)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", d, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeviceTwinInfo.
func (d DeviceTwinInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -5904,41 +5650,6 @@ func (e *EventGridMQTTClientDeletedEventData) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type EventGridMQTTClientEventData.
func (e EventGridMQTTClientEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "clientAuthenticationName", e.ClientAuthenticationName)
populate(objectMap, "clientName", e.ClientName)
populate(objectMap, "namespaceName", e.NamespaceName)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridMQTTClientEventData.
func (e *EventGridMQTTClientEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", e, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "clientAuthenticationName":
err = unpopulate(val, "ClientAuthenticationName", &e.ClientAuthenticationName)
delete(rawMsg, key)
case "clientName":
err = unpopulate(val, "ClientName", &e.ClientName)
delete(rawMsg, key)
case "namespaceName":
err = unpopulate(val, "NamespaceName", &e.NamespaceName)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", e, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type EventGridMQTTClientSessionConnectedEventData.
func (e EventGridMQTTClientSessionConnectedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -6529,6 +6240,80 @@ func (i *IOTHubDeviceTelemetryEventData) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type InternalACSMessageChannelEventError.
func (i internalACSMessageChannelEventError) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "channelCode", i.ChannelCode)
populate(objectMap, "channelMessage", i.ChannelMessage)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type InternalACSMessageChannelEventError.
func (i *internalACSMessageChannelEventError) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "channelCode":
err = unpopulate(val, "ChannelCode", &i.ChannelCode)
delete(rawMsg, key)
case "channelMessage":
err = unpopulate(val, "ChannelMessage", &i.ChannelMessage)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type InternalACSRouterCommunicationError.
func (i internalACSRouterCommunicationError) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "code", i.Code)
populate(objectMap, "details", i.Details)
populate(objectMap, "innererror", i.Innererror)
populate(objectMap, "message", i.Message)
populate(objectMap, "target", i.Target)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type InternalACSRouterCommunicationError.
func (i *internalACSRouterCommunicationError) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "code":
err = unpopulate(val, "Code", &i.Code)
delete(rawMsg, key)
case "details":
err = unpopulate(val, "Details", &i.Details)
delete(rawMsg, key)
case "innererror":
err = unpopulate(val, "Innererror", &i.Innererror)
delete(rawMsg, key)
case "message":
err = unpopulate(val, "Message", &i.Message)
delete(rawMsg, key)
case "target":
err = unpopulate(val, "Target", &i.Target)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type KeyVaultAccessPolicyChangedEventData.
func (k KeyVaultAccessPolicyChangedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -7313,45 +7098,6 @@ func (m *MapsGeofenceEnteredEventData) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MapsGeofenceEventProperties.
func (m MapsGeofenceEventProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "expiredGeofenceGeometryId", m.ExpiredGeofenceGeometryID)
populate(objectMap, "geometries", m.Geometries)
populate(objectMap, "invalidPeriodGeofenceGeometryId", m.InvalidPeriodGeofenceGeometryID)
populate(objectMap, "isEventPublished", m.IsEventPublished)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MapsGeofenceEventProperties.
func (m *MapsGeofenceEventProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "expiredGeofenceGeometryId":
err = unpopulate(val, "ExpiredGeofenceGeometryID", &m.ExpiredGeofenceGeometryID)
delete(rawMsg, key)
case "geometries":
err = unpopulate(val, "Geometries", &m.Geometries)
delete(rawMsg, key)
case "invalidPeriodGeofenceGeometryId":
err = unpopulate(val, "InvalidPeriodGeofenceGeometryID", &m.InvalidPeriodGeofenceGeometryID)
delete(rawMsg, key)
case "isEventPublished":
err = unpopulate(val, "IsEventPublished", &m.IsEventPublished)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MapsGeofenceExitedEventData.
func (m MapsGeofenceExitedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -8038,41 +7784,6 @@ func (m *MediaJobOutputScheduledEventData) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MediaJobOutputStateChangeEventData.
func (m MediaJobOutputStateChangeEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "jobCorrelationData", m.JobCorrelationData)
populate(objectMap, "output", m.Output)
populate(objectMap, "previousState", m.PreviousState)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MediaJobOutputStateChangeEventData.
func (m *MediaJobOutputStateChangeEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "jobCorrelationData":
err = unpopulate(val, "JobCorrelationData", &m.JobCorrelationData)
delete(rawMsg, key)
case "output":
m.Output, err = unmarshalMediaJobOutputClassification(val)
delete(rawMsg, key)
case "previousState":
err = unpopulate(val, "PreviousState", &m.PreviousState)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MediaJobProcessingEventData.
func (m MediaJobProcessingEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -8143,41 +7854,6 @@ func (m *MediaJobScheduledEventData) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MediaJobStateChangeEventData.
func (m MediaJobStateChangeEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "correlationData", m.CorrelationData)
populate(objectMap, "previousState", m.PreviousState)
populate(objectMap, "state", m.State)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MediaJobStateChangeEventData.
func (m *MediaJobStateChangeEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "correlationData":
err = unpopulate(val, "CorrelationData", &m.CorrelationData)
delete(rawMsg, key)
case "previousState":
err = unpopulate(val, "PreviousState", &m.PreviousState)
delete(rawMsg, key)
case "state":
err = unpopulate(val, "State", &m.State)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MediaLiveEventChannelArchiveHeartbeatEventData.
func (m MediaLiveEventChannelArchiveHeartbeatEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -9530,6 +9206,41 @@ func (r *ResourceHTTPRequest) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ResourceNotificationsContainerServiceEventResourcesScheduledEventData.
func (r ResourceNotificationsContainerServiceEventResourcesScheduledEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "apiVersion", r.APIVersion)
populate(objectMap, "operationalInfo", r.OperationalDetails)
populate(objectMap, "resourceInfo", r.ResourceDetails)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNotificationsContainerServiceEventResourcesScheduledEventData.
func (r *ResourceNotificationsContainerServiceEventResourcesScheduledEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", r, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "apiVersion":
err = unpopulate(val, "APIVersion", &r.APIVersion)
delete(rawMsg, key)
case "operationalInfo":
err = unpopulate(val, "OperationalDetails", &r.OperationalDetails)
delete(rawMsg, key)
case "resourceInfo":
err = unpopulate(val, "ResourceDetails", &r.ResourceDetails)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", r, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ResourceNotificationsHealthResourcesAnnotatedEventData.
func (r ResourceNotificationsHealthResourcesAnnotatedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -10824,6 +10535,7 @@ func (s *StorageLifecyclePolicyActionSummaryDetail) UnmarshalJSON(data []byte) e
func (s StorageLifecyclePolicyCompletedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "deleteSummary", s.DeleteSummary)
populate(objectMap, "policyRunSummary", s.PolicyRunSummary)
populate(objectMap, "scheduleTime", s.ScheduleTime)
populate(objectMap, "tierToArchiveSummary", s.TierToArchiveSummary)
populate(objectMap, "tierToColdSummary", s.TierToColdSummary)
@ -10843,6 +10555,9 @@ func (s *StorageLifecyclePolicyCompletedEventData) UnmarshalJSON(data []byte) er
case "deleteSummary":
err = unpopulate(val, "DeleteSummary", &s.DeleteSummary)
delete(rawMsg, key)
case "policyRunSummary":
err = unpopulate(val, "PolicyRunSummary", &s.PolicyRunSummary)
delete(rawMsg, key)
case "scheduleTime":
err = unpopulate(val, "ScheduleTime", &s.ScheduleTime)
delete(rawMsg, key)
@ -10863,6 +10578,33 @@ func (s *StorageLifecyclePolicyCompletedEventData) UnmarshalJSON(data []byte) er
return nil
}
// MarshalJSON implements the json.Marshaller interface for type StorageLifecyclePolicyRunSummary.
func (s StorageLifecyclePolicyRunSummary) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "completionStatus", s.CompletionStatus)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type StorageLifecyclePolicyRunSummary.
func (s *StorageLifecyclePolicyRunSummary) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", s, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "completionStatus":
err = unpopulate(val, "CompletionStatus", &s.CompletionStatus)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", s, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type StorageTaskAssignmentCompletedEventData.
func (s StorageTaskAssignmentCompletedEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -11806,80 +11548,6 @@ func (w *WebSlotSwapWithPreviewStartedEventData) UnmarshalJSON(data []byte) erro
return nil
}
// MarshalJSON implements the json.Marshaller interface for type internalACSMessageChannelEventError.
func (i internalACSMessageChannelEventError) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "channelCode", i.ChannelCode)
populate(objectMap, "channelMessage", i.ChannelMessage)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type internalACSMessageChannelEventError.
func (i *internalACSMessageChannelEventError) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "channelCode":
err = unpopulate(val, "ChannelCode", &i.ChannelCode)
delete(rawMsg, key)
case "channelMessage":
err = unpopulate(val, "ChannelMessage", &i.ChannelMessage)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type internalACSRouterCommunicationError.
func (i internalACSRouterCommunicationError) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "code", i.Code)
populate(objectMap, "details", i.Details)
populate(objectMap, "innererror", i.Innererror)
populate(objectMap, "message", i.Message)
populate(objectMap, "target", i.Target)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type internalACSRouterCommunicationError.
func (i *internalACSRouterCommunicationError) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "code":
err = unpopulate(val, "Code", &i.Code)
delete(rawMsg, key)
case "details":
err = unpopulate(val, "Details", &i.Details)
delete(rawMsg, key)
case "innererror":
err = unpopulate(val, "Innererror", &i.Innererror)
delete(rawMsg, key)
case "message":
err = unpopulate(val, "Message", &i.Message)
delete(rawMsg, key)
case "target":
err = unpopulate(val, "Target", &i.Target)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", i, err)
}
}
return nil
}
func populate(m map[string]any, k string, v any) {
if v == nil {
return

Просмотреть файл

@ -162,10 +162,8 @@ const (
TypeMediaJobOutputProcessing = "Microsoft.Media.JobOutputProcessing" // maps to MediaJobOutputProcessingEventData
TypeMediaJobOutputProgress = "Microsoft.Media.JobOutputProgress" // maps to MediaJobOutputProgressEventData
TypeMediaJobOutputScheduled = "Microsoft.Media.JobOutputScheduled" // maps to MediaJobOutputScheduledEventData
TypeMediaJobOutputStateChange = "Microsoft.Media.JobOutputStateChange" // maps to MediaJobOutputStateChangeEventData
TypeMediaJobProcessing = "Microsoft.Media.JobProcessing" // maps to MediaJobProcessingEventData
TypeMediaJobScheduled = "Microsoft.Media.JobScheduled" // maps to MediaJobScheduledEventData
TypeMediaJobStateChange = "Microsoft.Media.JobStateChange" // maps to MediaJobStateChangeEventData
TypeMediaLiveEventChannelArchiveHeartbeat = "Microsoft.Media.LiveEventChannelArchiveHeartbeat" // maps to MediaLiveEventChannelArchiveHeartbeatEventData
TypeMediaLiveEventConnectionRejected = "Microsoft.Media.LiveEventConnectionRejected" // maps to MediaLiveEventConnectionRejectedEventData
TypeMediaLiveEventEncoderConnected = "Microsoft.Media.LiveEventEncoderConnected" // maps to MediaLiveEventEncoderConnectedEventData
@ -179,6 +177,7 @@ const (
TypePolicyInsightsPolicyStateChanged = "Microsoft.PolicyInsights.PolicyStateChanged" // maps to PolicyInsightsPolicyStateChangedEventData
TypePolicyInsightsPolicyStateCreated = "Microsoft.PolicyInsights.PolicyStateCreated" // maps to PolicyInsightsPolicyStateCreatedEventData
TypePolicyInsightsPolicyStateDeleted = "Microsoft.PolicyInsights.PolicyStateDeleted" // maps to PolicyInsightsPolicyStateDeletedEventData
TypeResourceNotificationsContainerServiceEventResourcesScheduled = "Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted" // maps to ResourceNotificationsContainerServiceEventResourcesScheduledEventData
TypeResourceNotificationsHealthResourcesAvailabilityStatusChanged = "Microsoft.ResourceNotifications.HealthResources.AvailabilityStatusChanged" // maps to ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData
TypeResourceNotificationsHealthResourcesAnnotated = "Microsoft.ResourceNotifications.HealthResources.ResourceAnnotated" // maps to ResourceNotificationsHealthResourcesAnnotatedEventData
TypeResourceNotificationsResourceManagementCreatedOrUpdated = "Microsoft.ResourceNotifications.Resources.CreatedOrUpdated" // maps to ResourceNotificationsResourceManagementCreatedOrUpdatedEventData

Просмотреть файл

@ -0,0 +1,117 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
package azsystemevents
import (
"encoding/json"
"fmt"
)
// NOTE: there appears to be a bug where, when a type is used as a base class in TypeSpec, we automatically trim it _but_ there are some
// cases, like these events, where they're not just vestigial, they are legitimate models that should be generated.
// Filed as https://github.com/Azure/autorest.go/issues/1466. Once this is fixed, we can delete these temporarily copied models.
const (
TypeMediaJobOutputStateChange = "Microsoft.Media.JobOutputStateChange" // maps to MediaJobOutputStateChangeEventData
TypeMediaJobStateChange = "Microsoft.Media.JobStateChange" // maps to MediaJobStateChangeEventData
)
// MediaJobOutputStateChangeEventData - Schema of the Data property of an EventGridEvent for a
// Microsoft.Media.JobOutputStateChange event.
type MediaJobOutputStateChangeEventData struct {
// REQUIRED; Gets the Job correlation data.
JobCorrelationData map[string]*string
// REQUIRED; Gets the output.
Output MediaJobOutputClassification
// REQUIRED; The previous state of the Job.
PreviousState *MediaJobState
}
// MediaJobStateChangeEventData - Schema of the Data property of an EventGridEvent for a
// Microsoft.Media.JobStateChange event.
type MediaJobStateChangeEventData struct {
// REQUIRED; Gets the Job correlation data.
CorrelationData map[string]*string
// REQUIRED; The previous state of the Job.
PreviousState *MediaJobState
// REQUIRED; The new state of the Job.
State *MediaJobState
}
// MarshalJSON implements the json.Marshaller interface for type MediaJobOutputStateChangeEventData.
func (m MediaJobOutputStateChangeEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "jobCorrelationData", m.JobCorrelationData)
populate(objectMap, "output", m.Output)
populate(objectMap, "previousState", m.PreviousState)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MediaJobOutputStateChangeEventData.
func (m *MediaJobOutputStateChangeEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "jobCorrelationData":
err = unpopulate(val, "JobCorrelationData", &m.JobCorrelationData)
delete(rawMsg, key)
case "output":
m.Output, err = unmarshalMediaJobOutputClassification(val)
delete(rawMsg, key)
case "previousState":
err = unpopulate(val, "PreviousState", &m.PreviousState)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type MediaJobStateChangeEventData.
func (m MediaJobStateChangeEventData) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "correlationData", m.CorrelationData)
populate(objectMap, "previousState", m.PreviousState)
populate(objectMap, "state", m.State)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type MediaJobStateChangeEventData.
func (m *MediaJobStateChangeEventData) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "correlationData":
err = unpopulate(val, "CorrelationData", &m.CorrelationData)
delete(rawMsg, key)
case "previousState":
err = unpopulate(val, "PreviousState", &m.PreviousState)
delete(rawMsg, key)
case "state":
err = unpopulate(val, "State", &m.State)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
}
}
return nil
}

475
sdk/messaging/eventgrid/azsystemevents/testdata/package-lock.json сгенерированный поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -7,11 +7,11 @@
"build": "tsp compile ./TempTypeSpecFiles/Azure.Messaging.EventGrid.SystemEvents/client.tsp"
},
"dependencies": {
"@azure-tools/typespec-azure-core": "^0.45.0",
"@azure-tools/typespec-client-generator-core": "^0.45.2",
"@azure-tools/typespec-go": "^0.3.1",
"@typespec/compiler": "^0.59.1",
"@typespec/versioning": "^0.59.0",
"@azure-tools/typespec-azure-core": "0.48.0",
"@azure-tools/typespec-client-generator-core": "0.48.1",
"@typespec/compiler": "0.62.0",
"@typespec/versioning": "0.62.0",
"@azure-tools/typespec-go": "^0.3.2",
"testdata": "^0.1.4"
},
"overrides": {

Просмотреть файл

@ -1,3 +1,3 @@
directory: specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents
commit: 012021c786c360e0c34faf7af888c7fd7dbe2df5
commit: fb64eaa0dfc7ee8abc8e10369495729d5b3c1cc5
repo: Azure/azure-rest-api-specs