You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
package rg
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"repos.digitalenergy.online/BASIS/decort-golang-sdk/internal/serialization"
|
|
)
|
|
|
|
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
|
//
|
|
// In order to serialize with indent make sure to follow these guidelines:
|
|
// - First argument -> prefix
|
|
// - Second argument -> indent
|
|
func (lrg ListResourceGroups) Serialize(params ...string) (serialization.Serialized, error) {
|
|
if len(lrg) == 0 {
|
|
return []byte{}, nil
|
|
}
|
|
|
|
if len(params) > 1 {
|
|
prefix := params[0]
|
|
indent := params[1]
|
|
|
|
return json.MarshalIndent(lrg, prefix, indent)
|
|
}
|
|
|
|
return json.Marshal(lrg)
|
|
}
|
|
|
|
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
|
//
|
|
// In order to serialize with indent make sure to follow these guidelines:
|
|
// - First argument -> prefix
|
|
// - Second argument -> indent
|
|
func (irg ItemResourceGroup) Serialize(params ...string) (serialization.Serialized, error) {
|
|
if len(params) > 1 {
|
|
prefix := params[0]
|
|
indent := params[1]
|
|
|
|
return json.MarshalIndent(irg, prefix, indent)
|
|
}
|
|
|
|
return json.Marshal(irg)
|
|
}
|