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// Application Migration Service API
6//
7// API for the Application Migration service. Use this API to migrate applications from Oracle Cloud Infrastructure - Classic to Oracle Cloud Infrastructure.
8//
9
10package applicationmigration
11
12import (
13	"encoding/json"
14	"github.com/oracle/oci-go-sdk/common"
15)
16
17// CreateMigrationDetails An application being migrated from a source environment to OCI.
18type CreateMigrationDetails struct {
19
20	// Unique idenfifier (OCID) for the compartment where the Source is located.
21	CompartmentId *string `mandatory:"true" json:"compartmentId"`
22
23	// Unique identifier (OCID) of the application source.
24	SourceId *string `mandatory:"true" json:"sourceId"`
25
26	// Name of the application being migrated from the source.
27	ApplicationName *string `mandatory:"true" json:"applicationName"`
28
29	DiscoveryDetails DiscoveryDetails `mandatory:"true" json:"discoveryDetails"`
30
31	// Human-readable name of the application.
32	DisplayName *string `mandatory:"false" json:"displayName"`
33
34	// Description of the application.
35	Description *string `mandatory:"false" json:"description"`
36
37	// Configuration required to migrate the application. In addition to the key and value, additional fields are provided to describe type type and purpose of each field. Only the value for each key is required when passing configuration to the CreateMigration operation.
38	ServiceConfig map[string]ConfigurationField `mandatory:"false" json:"serviceConfig"`
39
40	// Configuration required to migrate the application. In addition to the key and value, additional fields are provided to describe type type and purpose of each field. Only the value for each key is required when passing configuration to the CreateMigration operation.
41	ApplicationConfig map[string]ConfigurationField `mandatory:"false" json:"applicationConfig"`
42
43	// Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only.
44	// Example: `{"bar-key": "value"}`
45	FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
46
47	// Defined tags for this resource. Each key is predefined and scoped to a namespace.
48	// Example: `{"foo-namespace": {"bar-key": "value"}}`
49	DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
50}
51
52func (m CreateMigrationDetails) String() string {
53	return common.PointerString(m)
54}
55
56// UnmarshalJSON unmarshals from json
57func (m *CreateMigrationDetails) UnmarshalJSON(data []byte) (e error) {
58	model := struct {
59		DisplayName       *string                           `json:"displayName"`
60		Description       *string                           `json:"description"`
61		ServiceConfig     map[string]ConfigurationField     `json:"serviceConfig"`
62		ApplicationConfig map[string]ConfigurationField     `json:"applicationConfig"`
63		FreeformTags      map[string]string                 `json:"freeformTags"`
64		DefinedTags       map[string]map[string]interface{} `json:"definedTags"`
65		CompartmentId     *string                           `json:"compartmentId"`
66		SourceId          *string                           `json:"sourceId"`
67		ApplicationName   *string                           `json:"applicationName"`
68		DiscoveryDetails  discoverydetails                  `json:"discoveryDetails"`
69	}{}
70
71	e = json.Unmarshal(data, &model)
72	if e != nil {
73		return
74	}
75	var nn interface{}
76	m.DisplayName = model.DisplayName
77
78	m.Description = model.Description
79
80	m.ServiceConfig = model.ServiceConfig
81
82	m.ApplicationConfig = model.ApplicationConfig
83
84	m.FreeformTags = model.FreeformTags
85
86	m.DefinedTags = model.DefinedTags
87
88	m.CompartmentId = model.CompartmentId
89
90	m.SourceId = model.SourceId
91
92	m.ApplicationName = model.ApplicationName
93
94	nn, e = model.DiscoveryDetails.UnmarshalPolymorphicJSON(model.DiscoveryDetails.JsonData)
95	if e != nil {
96		return
97	}
98	if nn != nil {
99		m.DiscoveryDetails = nn.(DiscoveryDetails)
100	} else {
101		m.DiscoveryDetails = nil
102	}
103
104	return
105}
106