-
Notifications
You must be signed in to change notification settings - Fork 11
Add schema site contract model #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add schema site contract model #112
Conversation
"contractRef": contractRef, | ||
} | ||
|
||
return &SiteContract{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We moved to a generic version of PatchPayload in the latest code so if you can use this going forward.
return &SiteContract{ | |
return & PatchPayload{ |
type SiteContract struct { | ||
Ops string `json:",omitempty"` | ||
Path string `json:",omitempty"` | ||
Value map[string]interface{} `json:",omitempty"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type SiteContract struct { | |
Ops string `json:",omitempty"` | |
Path string `json:",omitempty"` | |
Value map[string]interface{} `json:",omitempty"` | |
} |
func (contractAttributes *SiteContract) ToMap() (map[string]interface{}, error) { | ||
contractAttributesMap := make(map[string]interface{}) | ||
A(contractAttributesMap, "op", contractAttributes.Ops) | ||
A(contractAttributesMap, "path", contractAttributes.Path) | ||
if contractAttributes.Value != nil { | ||
A(contractAttributesMap, "value", contractAttributes.Value) | ||
} | ||
|
||
return contractAttributesMap, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (contractAttributes *SiteContract) ToMap() (map[string]interface{}, error) { | |
contractAttributesMap := make(map[string]interface{}) | |
A(contractAttributesMap, "op", contractAttributes.Ops) | |
A(contractAttributesMap, "path", contractAttributes.Path) | |
if contractAttributes.Value != nil { | |
A(contractAttributesMap, "value", contractAttributes.Value) | |
} | |
return contractAttributesMap, nil | |
} |
Prerequisite for: CiscoDevNet/terraform-provider-mso#190