1// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates.  All rights reserved.
2// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
3// Code generated. DO NOT EDIT.
4
5// Core Services API
6//
7// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
8// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
9// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
10// to manage resources such as virtual cloud networks (VCNs), compute instances, and
11// block storage volumes.
12//
13
14package core
15
16import (
17	"encoding/json"
18	"github.com/oracle/oci-go-sdk/common"
19)
20
21// UpdateComputeImageCapabilitySchemaDetails Create Image Capability Schema for an image.
22type UpdateComputeImageCapabilitySchemaDetails struct {
23
24	// A user-friendly name for the compute image capability schema
25	DisplayName *string `mandatory:"false" json:"displayName"`
26
27	// Free-form tags for this resource. Each tag is a simple key-value pair with no
28	// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
29	// Example: `{"Department": "Finance"}`
30	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
31
32	// The map of each capability name to its ImageCapabilitySchemaDescriptor.
33	SchemaData map[string]ImageCapabilitySchemaDescriptor `mandatory:"false" json:"schemaData"`
34
35	// Defined tags for this resource. Each key is predefined and scoped to a
36	// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
37	// Example: `{"Operations": {"CostCenter": "42"}}`
38	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
39}
40
41func (m UpdateComputeImageCapabilitySchemaDetails) String() string {
42	return common.PointerString(m)
43}
44
45// UnmarshalJSON unmarshals from json
46func (m *UpdateComputeImageCapabilitySchemaDetails) UnmarshalJSON(data []byte) (e error) {
47	model := struct {
48		DisplayName  *string                                    `json:"displayName"`
49		FreeformTags map[string]string                          `json:"freeformTags"`
50		SchemaData   map[string]imagecapabilityschemadescriptor `json:"schemaData"`
51		DefinedTags  map[string]map[string]interface{}          `json:"definedTags"`
52	}{}
53
54	e = json.Unmarshal(data, &model)
55	if e != nil {
56		return
57	}
58	var nn interface{}
59	m.DisplayName = model.DisplayName
60
61	m.FreeformTags = model.FreeformTags
62
63	m.SchemaData = make(map[string]ImageCapabilitySchemaDescriptor)
64	for k, v := range model.SchemaData {
65		nn, e = v.UnmarshalPolymorphicJSON(v.JsonData)
66		if e != nil {
67			return e
68		}
69		if nn != nil {
70			m.SchemaData[k] = nn.(ImageCapabilitySchemaDescriptor)
71		} else {
72			m.SchemaData[k] = nil
73		}
74	}
75
76	m.DefinedTags = model.DefinedTags
77
78	return
79}
80