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// CreateComputeImageCapabilitySchemaDetails Create Image Capability Schema for an image.
22type CreateComputeImageCapabilitySchemaDetails struct {
23
24	// The OCID of the compartment that contains the resource.
25	CompartmentId *string `mandatory:"true" json:"compartmentId"`
26
27	// The name of the compute global image capability schema version
28	ComputeGlobalImageCapabilitySchemaVersionName *string `mandatory:"true" json:"computeGlobalImageCapabilitySchemaVersionName"`
29
30	// The ocid of the image
31	ImageId *string `mandatory:"true" json:"imageId"`
32
33	// The map of each capability name to its ImageCapabilitySchemaDescriptor.
34	SchemaData map[string]ImageCapabilitySchemaDescriptor `mandatory:"true" json:"schemaData"`
35
36	// Free-form tags for this resource. Each tag is a simple key-value pair with no
37	// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
38	// Example: `{"Department": "Finance"}`
39	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
40
41	// A user-friendly name for the compute image capability schema
42	DisplayName *string `mandatory:"false" json:"displayName"`
43
44	// Defined tags for this resource. Each key is predefined and scoped to a
45	// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
46	// Example: `{"Operations": {"CostCenter": "42"}}`
47	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
48}
49
50func (m CreateComputeImageCapabilitySchemaDetails) String() string {
51	return common.PointerString(m)
52}
53
54// UnmarshalJSON unmarshals from json
55func (m *CreateComputeImageCapabilitySchemaDetails) UnmarshalJSON(data []byte) (e error) {
56	model := struct {
57		FreeformTags                                  map[string]string                          `json:"freeformTags"`
58		DisplayName                                   *string                                    `json:"displayName"`
59		DefinedTags                                   map[string]map[string]interface{}          `json:"definedTags"`
60		CompartmentId                                 *string                                    `json:"compartmentId"`
61		ComputeGlobalImageCapabilitySchemaVersionName *string                                    `json:"computeGlobalImageCapabilitySchemaVersionName"`
62		ImageId                                       *string                                    `json:"imageId"`
63		SchemaData                                    map[string]imagecapabilityschemadescriptor `json:"schemaData"`
64	}{}
65
66	e = json.Unmarshal(data, &model)
67	if e != nil {
68		return
69	}
70	var nn interface{}
71	m.FreeformTags = model.FreeformTags
72
73	m.DisplayName = model.DisplayName
74
75	m.DefinedTags = model.DefinedTags
76
77	m.CompartmentId = model.CompartmentId
78
79	m.ComputeGlobalImageCapabilitySchemaVersionName = model.ComputeGlobalImageCapabilitySchemaVersionName
80
81	m.ImageId = model.ImageId
82
83	m.SchemaData = make(map[string]ImageCapabilitySchemaDescriptor)
84	for k, v := range model.SchemaData {
85		nn, e = v.UnmarshalPolymorphicJSON(v.JsonData)
86		if e != nil {
87			return e
88		}
89		if nn != nil {
90			m.SchemaData[k] = nn.(ImageCapabilitySchemaDescriptor)
91		} else {
92			m.SchemaData[k] = nil
93		}
94	}
95
96	return
97}
98