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// CreateDhcpDetails The representation of CreateDhcpDetails
21type CreateDhcpDetails struct {
22
23	// The OCID of the compartment to contain the set of DHCP options.
24	CompartmentId *string `mandatory:"true" json:"compartmentId"`
25
26	// A set of DHCP options.
27	Options []DhcpOption `mandatory:"true" json:"options"`
28
29	// The OCID of the VCN the set of DHCP options belongs to.
30	VcnId *string `mandatory:"true" json:"vcnId"`
31
32	// Defined tags for this resource. Each key is predefined and scoped to a
33	// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
34	// Example: `{"Operations": {"CostCenter": "42"}}`
35	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
36
37	// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
38	DisplayName *string `mandatory:"false" json:"displayName"`
39
40	// Free-form tags for this resource. Each tag is a simple key-value pair with no
41	// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
42	// Example: `{"Department": "Finance"}`
43	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
44}
45
46func (m CreateDhcpDetails) String() string {
47	return common.PointerString(m)
48}
49
50// UnmarshalJSON unmarshals from json
51func (m *CreateDhcpDetails) UnmarshalJSON(data []byte) (e error) {
52	model := struct {
53		DefinedTags   map[string]map[string]interface{} `json:"definedTags"`
54		DisplayName   *string                           `json:"displayName"`
55		FreeformTags  map[string]string                 `json:"freeformTags"`
56		CompartmentId *string                           `json:"compartmentId"`
57		Options       []dhcpoption                      `json:"options"`
58		VcnId         *string                           `json:"vcnId"`
59	}{}
60
61	e = json.Unmarshal(data, &model)
62	if e != nil {
63		return
64	}
65	m.DefinedTags = model.DefinedTags
66	m.DisplayName = model.DisplayName
67	m.FreeformTags = model.FreeformTags
68	m.CompartmentId = model.CompartmentId
69	m.Options = make([]DhcpOption, len(model.Options))
70	for i, n := range model.Options {
71		nn, err := n.UnmarshalPolymorphicJSON(n.JsonData)
72		if err != nil {
73			return err
74		}
75		if nn != nil {
76			m.Options[i] = nn.(DhcpOption)
77		} else {
78			m.Options[i] = nil
79		}
80	}
81	m.VcnId = model.VcnId
82	return
83}
84