1// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2// Code generated. DO NOT EDIT.
3
4// Resource Manager API
5//
6// API for the Resource Manager service. Use this API to install, configure, and manage resources via the "infrastructure-as-code" model. For more information, see Overview of Resource Manager (https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm).
7//
8
9package resourcemanager
10
11import (
12	"encoding/json"
13	"github.com/oracle/oci-go-sdk/common"
14)
15
16// UpdateConfigSourceDetails Updates the property details for the configuration source.
17type UpdateConfigSourceDetails interface {
18
19	// The path of the directory from which to run terraform. If not specified, the the root will be used.
20	GetWorkingDirectory() *string
21}
22
23type updateconfigsourcedetails struct {
24	JsonData         []byte
25	WorkingDirectory *string `mandatory:"false" json:"workingDirectory"`
26	ConfigSourceType string  `json:"configSourceType"`
27}
28
29// UnmarshalJSON unmarshals json
30func (m *updateconfigsourcedetails) UnmarshalJSON(data []byte) error {
31	m.JsonData = data
32	type Unmarshalerupdateconfigsourcedetails updateconfigsourcedetails
33	s := struct {
34		Model Unmarshalerupdateconfigsourcedetails
35	}{}
36	err := json.Unmarshal(data, &s.Model)
37	if err != nil {
38		return err
39	}
40	m.WorkingDirectory = s.Model.WorkingDirectory
41	m.ConfigSourceType = s.Model.ConfigSourceType
42
43	return err
44}
45
46// UnmarshalPolymorphicJSON unmarshals polymorphic json
47func (m *updateconfigsourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
48
49	if data == nil || string(data) == "null" {
50		return nil, nil
51	}
52
53	var err error
54	switch m.ConfigSourceType {
55	case "ZIP_UPLOAD":
56		mm := UpdateZipUploadConfigSourceDetails{}
57		err = json.Unmarshal(data, &mm)
58		return mm, err
59	default:
60		return *m, nil
61	}
62}
63
64//GetWorkingDirectory returns WorkingDirectory
65func (m updateconfigsourcedetails) GetWorkingDirectory() *string {
66	return m.WorkingDirectory
67}
68
69func (m updateconfigsourcedetails) String() string {
70	return common.PointerString(m)
71}
72