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// CreateImageDetails Either instanceId or imageSourceDetails must be provided in addition to other required parameters.
21type CreateImageDetails struct {
22
23	// The OCID of the compartment you want the image to be created in.
24	CompartmentId *string `mandatory:"true" json:"compartmentId"`
25
26	// Defined tags for this resource. Each key is predefined and scoped to a
27	// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
28	// Example: `{"Operations": {"CostCenter": "42"}}`
29	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
30
31	// A user-friendly name for the image. It does not have to be unique, and it's changeable.
32	// Avoid entering confidential information.
33	// You cannot use an Oracle-provided image name as a custom image name.
34	// Example: `My Oracle Linux image`
35	DisplayName *string `mandatory:"false" json:"displayName"`
36
37	// Free-form tags for this resource. Each tag is a simple key-value pair with no
38	// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
39	// Example: `{"Department": "Finance"}`
40	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
41
42	// Details for creating an image through import
43	ImageSourceDetails ImageSourceDetails `mandatory:"false" json:"imageSourceDetails"`
44
45	// The OCID of the instance you want to use as the basis for the image.
46	InstanceId *string `mandatory:"false" json:"instanceId"`
47
48	// Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
49	// * `NATIVE` - VM instances launch with paravirtualized boot and VFIO devices. The default value for Oracle-provided images.
50	// * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
51	// * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
52	// * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
53	LaunchMode CreateImageDetailsLaunchModeEnum `mandatory:"false" json:"launchMode,omitempty"`
54}
55
56func (m CreateImageDetails) String() string {
57	return common.PointerString(m)
58}
59
60// UnmarshalJSON unmarshals from json
61func (m *CreateImageDetails) UnmarshalJSON(data []byte) (e error) {
62	model := struct {
63		DefinedTags        map[string]map[string]interface{} `json:"definedTags"`
64		DisplayName        *string                           `json:"displayName"`
65		FreeformTags       map[string]string                 `json:"freeformTags"`
66		ImageSourceDetails imagesourcedetails                `json:"imageSourceDetails"`
67		InstanceId         *string                           `json:"instanceId"`
68		LaunchMode         CreateImageDetailsLaunchModeEnum  `json:"launchMode"`
69		CompartmentId      *string                           `json:"compartmentId"`
70	}{}
71
72	e = json.Unmarshal(data, &model)
73	if e != nil {
74		return
75	}
76	m.DefinedTags = model.DefinedTags
77	m.DisplayName = model.DisplayName
78	m.FreeformTags = model.FreeformTags
79	nn, e := model.ImageSourceDetails.UnmarshalPolymorphicJSON(model.ImageSourceDetails.JsonData)
80	if e != nil {
81		return
82	}
83	if nn != nil {
84		m.ImageSourceDetails = nn.(ImageSourceDetails)
85	} else {
86		m.ImageSourceDetails = nil
87	}
88	m.InstanceId = model.InstanceId
89	m.LaunchMode = model.LaunchMode
90	m.CompartmentId = model.CompartmentId
91	return
92}
93
94// CreateImageDetailsLaunchModeEnum Enum with underlying type: string
95type CreateImageDetailsLaunchModeEnum string
96
97// Set of constants representing the allowable values for CreateImageDetailsLaunchModeEnum
98const (
99	CreateImageDetailsLaunchModeNative          CreateImageDetailsLaunchModeEnum = "NATIVE"
100	CreateImageDetailsLaunchModeEmulated        CreateImageDetailsLaunchModeEnum = "EMULATED"
101	CreateImageDetailsLaunchModeParavirtualized CreateImageDetailsLaunchModeEnum = "PARAVIRTUALIZED"
102	CreateImageDetailsLaunchModeCustom          CreateImageDetailsLaunchModeEnum = "CUSTOM"
103)
104
105var mappingCreateImageDetailsLaunchMode = map[string]CreateImageDetailsLaunchModeEnum{
106	"NATIVE":          CreateImageDetailsLaunchModeNative,
107	"EMULATED":        CreateImageDetailsLaunchModeEmulated,
108	"PARAVIRTUALIZED": CreateImageDetailsLaunchModeParavirtualized,
109	"CUSTOM":          CreateImageDetailsLaunchModeCustom,
110}
111
112// GetCreateImageDetailsLaunchModeEnumValues Enumerates the set of values for CreateImageDetailsLaunchModeEnum
113func GetCreateImageDetailsLaunchModeEnumValues() []CreateImageDetailsLaunchModeEnum {
114	values := make([]CreateImageDetailsLaunchModeEnum, 0)
115	for _, v := range mappingCreateImageDetailsLaunchMode {
116		values = append(values, v)
117	}
118	return values
119}
120