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// InstanceConfigurationCreateVolumeDetails Creates a new block volume. Please see CreateVolumeDetails
21type InstanceConfigurationCreateVolumeDetails struct {
22
23	// The availability domain of the volume.
24	// Example: `Uocm:PHX-AD-1`
25	AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"`
26
27	// If provided, specifies the ID of the volume backup policy to assign to the newly
28	// created volume. If omitted, no policy will be assigned.
29	BackupPolicyId *string `mandatory:"false" json:"backupPolicyId"`
30
31	// The OCID of the compartment that contains the volume.
32	CompartmentId *string `mandatory:"false" json:"compartmentId"`
33
34	// Defined tags for this resource. Each key is predefined and scoped to a
35	// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
36	// Example: `{"Operations": {"CostCenter": "42"}}`
37	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
38
39	// A user-friendly name. Does not have to be unique, and it's changeable.
40	// Avoid entering confidential information.
41	DisplayName *string `mandatory:"false" json:"displayName"`
42
43	// Free-form tags for this resource. Each tag is a simple key-value pair with no
44	// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
45	// Example: `{"Department": "Finance"}`
46	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
47
48	// The size of the volume in GBs.
49	SizeInGBs *int64 `mandatory:"false" json:"sizeInGBs"`
50
51	// Specifies the volume source details for a new Block volume. The volume source is either another Block volume in the same availability domain or a Block volume backup.
52	// This is an optional field. If not specified or set to null, the new Block volume will be empty.
53	// When specified, the new Block volume will contain data from the source volume or backup.
54	SourceDetails InstanceConfigurationVolumeSourceDetails `mandatory:"false" json:"sourceDetails"`
55}
56
57func (m InstanceConfigurationCreateVolumeDetails) String() string {
58	return common.PointerString(m)
59}
60
61// UnmarshalJSON unmarshals from json
62func (m *InstanceConfigurationCreateVolumeDetails) UnmarshalJSON(data []byte) (e error) {
63	model := struct {
64		AvailabilityDomain *string                                  `json:"availabilityDomain"`
65		BackupPolicyId     *string                                  `json:"backupPolicyId"`
66		CompartmentId      *string                                  `json:"compartmentId"`
67		DefinedTags        map[string]map[string]interface{}        `json:"definedTags"`
68		DisplayName        *string                                  `json:"displayName"`
69		FreeformTags       map[string]string                        `json:"freeformTags"`
70		SizeInGBs          *int64                                   `json:"sizeInGBs"`
71		SourceDetails      instanceconfigurationvolumesourcedetails `json:"sourceDetails"`
72	}{}
73
74	e = json.Unmarshal(data, &model)
75	if e != nil {
76		return
77	}
78	m.AvailabilityDomain = model.AvailabilityDomain
79	m.BackupPolicyId = model.BackupPolicyId
80	m.CompartmentId = model.CompartmentId
81	m.DefinedTags = model.DefinedTags
82	m.DisplayName = model.DisplayName
83	m.FreeformTags = model.FreeformTags
84	m.SizeInGBs = model.SizeInGBs
85	nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData)
86	if e != nil {
87		return
88	}
89	if nn != nil {
90		m.SourceDetails = nn.(InstanceConfigurationVolumeSourceDetails)
91	} else {
92		m.SourceDetails = nil
93	}
94	return
95}
96