Skip to content

Commit

Permalink
Regenerate client from commit 57d26221 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Apr 4, 2023
1 parent a736245 commit 440daeb
Show file tree
Hide file tree
Showing 8 changed files with 696 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-04-04 17:50:47.601802",
"spec_repo_commit": "9a7b22d0"
"regenerated": "2023-04-04 18:43:42.400064",
"spec_repo_commit": "57d26221"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-04-04 17:50:47.618329",
"spec_repo_commit": "9a7b22d0"
"regenerated": "2023-04-04 18:43:42.417633",
"spec_repo_commit": "57d26221"
}
}
}
52 changes: 52 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12425,6 +12425,7 @@ components:
oneOf:
- $ref: '#/components/schemas/ServiceDefinitionV2Email'
- $ref: '#/components/schemas/ServiceDefinitionV2Slack'
- $ref: '#/components/schemas/ServiceDefinitionV2MSTeams'
ServiceDefinitionV2Doc:
description: Service documents.
properties:
Expand Down Expand Up @@ -12511,6 +12512,7 @@ components:
oneOf:
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1Email'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1Slack'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1MSTeams'
ServiceDefinitionV2Dot1Email:
description: Service owner's email.
properties:
Expand Down Expand Up @@ -12583,6 +12585,31 @@ components:
- RUNBOOK
- DASHBOARD
- OTHER
ServiceDefinitionV2Dot1MSTeams:
description: Service owner's Microsoft Teams.
properties:
contact:
description: Contact value.
example: https://teams.microsoft.com/myteam
type: string
name:
description: Contact Microsoft Teams.
example: My team channel
type: string
type:
$ref: '#/components/schemas/ServiceDefinitionV2Dot1MSTeamsType'
required:
- type
- contact
type: object
ServiceDefinitionV2Dot1MSTeamsType:
description: Contact type.
enum:
- microsoft-teams
example: microsoft-teams
type: string
x-enum-varnames:
- MICROSOFT_TEAMS
ServiceDefinitionV2Dot1Opsgenie:
description: Opsgenie integration for the service.
properties:
Expand Down Expand Up @@ -12723,6 +12750,31 @@ components:
- ONCALL
- CODE
- LINK
ServiceDefinitionV2MSTeams:
description: Service owner's Microsoft Teams.
properties:
contact:
description: Contact value.
example: https://teams.microsoft.com/myteam
type: string
name:
description: Contact Microsoft Teams.
example: My team channel
type: string
type:
$ref: '#/components/schemas/ServiceDefinitionV2MSTeamsType'
required:
- type
- contact
type: object
ServiceDefinitionV2MSTeamsType:
description: Contact type.
enum:
- microsoft-teams
example: microsoft-teams
type: string
x-enum-varnames:
- MICROSOFT_TEAMS
ServiceDefinitionV2Opsgenie:
description: Opsgenie integration for the service.
properties:
Expand Down
36 changes: 34 additions & 2 deletions api/datadogV2/model_service_definition_v2_contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (

// ServiceDefinitionV2Contact - Service owner's contacts information.
type ServiceDefinitionV2Contact struct {
ServiceDefinitionV2Email *ServiceDefinitionV2Email
ServiceDefinitionV2Slack *ServiceDefinitionV2Slack
ServiceDefinitionV2Email *ServiceDefinitionV2Email
ServiceDefinitionV2Slack *ServiceDefinitionV2Slack
ServiceDefinitionV2MSTeams *ServiceDefinitionV2MSTeams

// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
Expand All @@ -27,6 +28,11 @@ func ServiceDefinitionV2SlackAsServiceDefinitionV2Contact(v *ServiceDefinitionV2
return ServiceDefinitionV2Contact{ServiceDefinitionV2Slack: v}
}

// ServiceDefinitionV2MSTeamsAsServiceDefinitionV2Contact is a convenience function that returns ServiceDefinitionV2MSTeams wrapped in ServiceDefinitionV2Contact.
func ServiceDefinitionV2MSTeamsAsServiceDefinitionV2Contact(v *ServiceDefinitionV2MSTeams) ServiceDefinitionV2Contact {
return ServiceDefinitionV2Contact{ServiceDefinitionV2MSTeams: v}
}

// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *ServiceDefinitionV2Contact) UnmarshalJSON(data []byte) error {
var err error
Expand Down Expand Up @@ -65,10 +71,28 @@ func (obj *ServiceDefinitionV2Contact) UnmarshalJSON(data []byte) error {
obj.ServiceDefinitionV2Slack = nil
}

// try to unmarshal data into ServiceDefinitionV2MSTeams
err = json.Unmarshal(data, &obj.ServiceDefinitionV2MSTeams)
if err == nil {
if obj.ServiceDefinitionV2MSTeams != nil && obj.ServiceDefinitionV2MSTeams.UnparsedObject == nil {
jsonServiceDefinitionV2MSTeams, _ := json.Marshal(obj.ServiceDefinitionV2MSTeams)
if string(jsonServiceDefinitionV2MSTeams) == "{}" { // empty struct
obj.ServiceDefinitionV2MSTeams = nil
} else {
match++
}
} else {
obj.ServiceDefinitionV2MSTeams = nil
}
} else {
obj.ServiceDefinitionV2MSTeams = nil
}

if match != 1 { // more than 1 match
// reset to nil
obj.ServiceDefinitionV2Email = nil
obj.ServiceDefinitionV2Slack = nil
obj.ServiceDefinitionV2MSTeams = nil
return json.Unmarshal(data, &obj.UnparsedObject)
}
return nil // exactly one match
Expand All @@ -84,6 +108,10 @@ func (obj ServiceDefinitionV2Contact) MarshalJSON() ([]byte, error) {
return json.Marshal(&obj.ServiceDefinitionV2Slack)
}

if obj.ServiceDefinitionV2MSTeams != nil {
return json.Marshal(&obj.ServiceDefinitionV2MSTeams)
}

if obj.UnparsedObject != nil {
return json.Marshal(obj.UnparsedObject)
}
Expand All @@ -100,6 +128,10 @@ func (obj *ServiceDefinitionV2Contact) GetActualInstance() interface{} {
return obj.ServiceDefinitionV2Slack
}

if obj.ServiceDefinitionV2MSTeams != nil {
return obj.ServiceDefinitionV2MSTeams
}

// all schemas are nil
return nil
}
Expand Down
36 changes: 34 additions & 2 deletions api/datadogV2/model_service_definition_v2_dot1_contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (

// ServiceDefinitionV2Dot1Contact - Service owner's contacts information.
type ServiceDefinitionV2Dot1Contact struct {
ServiceDefinitionV2Dot1Email *ServiceDefinitionV2Dot1Email
ServiceDefinitionV2Dot1Slack *ServiceDefinitionV2Dot1Slack
ServiceDefinitionV2Dot1Email *ServiceDefinitionV2Dot1Email
ServiceDefinitionV2Dot1Slack *ServiceDefinitionV2Dot1Slack
ServiceDefinitionV2Dot1MSTeams *ServiceDefinitionV2Dot1MSTeams

// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
Expand All @@ -27,6 +28,11 @@ func ServiceDefinitionV2Dot1SlackAsServiceDefinitionV2Dot1Contact(v *ServiceDefi
return ServiceDefinitionV2Dot1Contact{ServiceDefinitionV2Dot1Slack: v}
}

// ServiceDefinitionV2Dot1MSTeamsAsServiceDefinitionV2Dot1Contact is a convenience function that returns ServiceDefinitionV2Dot1MSTeams wrapped in ServiceDefinitionV2Dot1Contact.
func ServiceDefinitionV2Dot1MSTeamsAsServiceDefinitionV2Dot1Contact(v *ServiceDefinitionV2Dot1MSTeams) ServiceDefinitionV2Dot1Contact {
return ServiceDefinitionV2Dot1Contact{ServiceDefinitionV2Dot1MSTeams: v}
}

// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *ServiceDefinitionV2Dot1Contact) UnmarshalJSON(data []byte) error {
var err error
Expand Down Expand Up @@ -65,10 +71,28 @@ func (obj *ServiceDefinitionV2Dot1Contact) UnmarshalJSON(data []byte) error {
obj.ServiceDefinitionV2Dot1Slack = nil
}

// try to unmarshal data into ServiceDefinitionV2Dot1MSTeams
err = json.Unmarshal(data, &obj.ServiceDefinitionV2Dot1MSTeams)
if err == nil {
if obj.ServiceDefinitionV2Dot1MSTeams != nil && obj.ServiceDefinitionV2Dot1MSTeams.UnparsedObject == nil {
jsonServiceDefinitionV2Dot1MSTeams, _ := json.Marshal(obj.ServiceDefinitionV2Dot1MSTeams)
if string(jsonServiceDefinitionV2Dot1MSTeams) == "{}" { // empty struct
obj.ServiceDefinitionV2Dot1MSTeams = nil
} else {
match++
}
} else {
obj.ServiceDefinitionV2Dot1MSTeams = nil
}
} else {
obj.ServiceDefinitionV2Dot1MSTeams = nil
}

if match != 1 { // more than 1 match
// reset to nil
obj.ServiceDefinitionV2Dot1Email = nil
obj.ServiceDefinitionV2Dot1Slack = nil
obj.ServiceDefinitionV2Dot1MSTeams = nil
return json.Unmarshal(data, &obj.UnparsedObject)
}
return nil // exactly one match
Expand All @@ -84,6 +108,10 @@ func (obj ServiceDefinitionV2Dot1Contact) MarshalJSON() ([]byte, error) {
return json.Marshal(&obj.ServiceDefinitionV2Dot1Slack)
}

if obj.ServiceDefinitionV2Dot1MSTeams != nil {
return json.Marshal(&obj.ServiceDefinitionV2Dot1MSTeams)
}

if obj.UnparsedObject != nil {
return json.Marshal(obj.UnparsedObject)
}
Expand All @@ -100,6 +128,10 @@ func (obj *ServiceDefinitionV2Dot1Contact) GetActualInstance() interface{} {
return obj.ServiceDefinitionV2Dot1Slack
}

if obj.ServiceDefinitionV2Dot1MSTeams != nil {
return obj.ServiceDefinitionV2Dot1MSTeams
}

// all schemas are nil
return nil
}
Expand Down
Loading

0 comments on commit 440daeb

Please sign in to comment.