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