1// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. 2// Code generated. DO NOT EDIT. 3 4// Core Services API 5// 6// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm), 7// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and 8// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API 9// to manage resources such as virtual cloud networks (VCNs), compute instances, and 10// block storage volumes. 11// 12 13package core 14 15import ( 16 "encoding/json" 17 "github.com/oracle/oci-go-sdk/common" 18) 19 20// VolumeSourceDetails The representation of VolumeSourceDetails 21type VolumeSourceDetails interface { 22} 23 24type volumesourcedetails struct { 25 JsonData []byte 26 Type string `json:"type"` 27} 28 29// UnmarshalJSON unmarshals json 30func (m *volumesourcedetails) UnmarshalJSON(data []byte) error { 31 m.JsonData = data 32 type Unmarshalervolumesourcedetails volumesourcedetails 33 s := struct { 34 Model Unmarshalervolumesourcedetails 35 }{} 36 err := json.Unmarshal(data, &s.Model) 37 if err != nil { 38 return err 39 } 40 m.Type = s.Model.Type 41 42 return err 43} 44 45// UnmarshalPolymorphicJSON unmarshals polymorphic json 46func (m *volumesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { 47 48 if data == nil || string(data) == "null" { 49 return nil, nil 50 } 51 52 var err error 53 switch m.Type { 54 case "volume": 55 mm := VolumeSourceFromVolumeDetails{} 56 err = json.Unmarshal(data, &mm) 57 return mm, err 58 case "volumeBackup": 59 mm := VolumeSourceFromVolumeBackupDetails{} 60 err = json.Unmarshal(data, &mm) 61 return mm, err 62 default: 63 return *m, nil 64 } 65} 66 67func (m volumesourcedetails) String() string { 68 return common.PointerString(m) 69} 70