|
| 1 | +// Copyright (c) 2016, 2018, 2024, 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 | +// Big Data Service API |
| 6 | +// |
| 7 | +// REST API for Oracle Big Data Service. Use this API to build, deploy, and manage fully elastic Big Data Service clusters. Build on Hadoop, Spark and Data Science distributions, which can be fully integrated with existing enterprise data in Oracle Database and Oracle applications. |
| 8 | +// |
| 9 | + |
| 10 | +package bds |
| 11 | + |
| 12 | +import ( |
| 13 | + "encoding/json" |
| 14 | + "fmt" |
| 15 | + "github.com/oracle/oci-go-sdk/v65/common" |
| 16 | + "strings" |
| 17 | +) |
| 18 | + |
| 19 | +// PatchingConfigs Detailed configurations for defining the behavior when installing os patches. If not provided, nodes will be patched and rebooted AD/FD by AD/FD. |
| 20 | +type PatchingConfigs interface { |
| 21 | +} |
| 22 | + |
| 23 | +type patchingconfigs struct { |
| 24 | + JsonData []byte |
| 25 | + PatchingConfigStrategy string `json:"patchingConfigStrategy"` |
| 26 | +} |
| 27 | + |
| 28 | +// UnmarshalJSON unmarshals json |
| 29 | +func (m *patchingconfigs) UnmarshalJSON(data []byte) error { |
| 30 | + m.JsonData = data |
| 31 | + type Unmarshalerpatchingconfigs patchingconfigs |
| 32 | + s := struct { |
| 33 | + Model Unmarshalerpatchingconfigs |
| 34 | + }{} |
| 35 | + err := json.Unmarshal(data, &s.Model) |
| 36 | + if err != nil { |
| 37 | + return err |
| 38 | + } |
| 39 | + m.PatchingConfigStrategy = s.Model.PatchingConfigStrategy |
| 40 | + |
| 41 | + return err |
| 42 | +} |
| 43 | + |
| 44 | +// UnmarshalPolymorphicJSON unmarshals polymorphic json |
| 45 | +func (m *patchingconfigs) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { |
| 46 | + |
| 47 | + if data == nil || string(data) == "null" { |
| 48 | + return nil, nil |
| 49 | + } |
| 50 | + |
| 51 | + var err error |
| 52 | + switch m.PatchingConfigStrategy { |
| 53 | + case "BATCHING_BASED": |
| 54 | + mm := BatchingBasedPatchingConfigs{} |
| 55 | + err = json.Unmarshal(data, &mm) |
| 56 | + return mm, err |
| 57 | + case "DOWNTIME_BASED": |
| 58 | + mm := DowntimeBasedPatchingConfigs{} |
| 59 | + err = json.Unmarshal(data, &mm) |
| 60 | + return mm, err |
| 61 | + default: |
| 62 | + common.Logf("Recieved unsupported enum value for PatchingConfigs: %s.", m.PatchingConfigStrategy) |
| 63 | + return *m, nil |
| 64 | + } |
| 65 | +} |
| 66 | + |
| 67 | +func (m patchingconfigs) String() string { |
| 68 | + return common.PointerString(m) |
| 69 | +} |
| 70 | + |
| 71 | +// ValidateEnumValue returns an error when providing an unsupported enum value |
| 72 | +// This function is being called during constructing API request process |
| 73 | +// Not recommended for calling this function directly |
| 74 | +func (m patchingconfigs) ValidateEnumValue() (bool, error) { |
| 75 | + errMessage := []string{} |
| 76 | + |
| 77 | + if len(errMessage) > 0 { |
| 78 | + return true, fmt.Errorf(strings.Join(errMessage, "\n")) |
| 79 | + } |
| 80 | + return false, nil |
| 81 | +} |
| 82 | + |
| 83 | +// PatchingConfigsPatchingConfigStrategyEnum Enum with underlying type: string |
| 84 | +type PatchingConfigsPatchingConfigStrategyEnum string |
| 85 | + |
| 86 | +// Set of constants representing the allowable values for PatchingConfigsPatchingConfigStrategyEnum |
| 87 | +const ( |
| 88 | + PatchingConfigsPatchingConfigStrategyDowntimeBased PatchingConfigsPatchingConfigStrategyEnum = "DOWNTIME_BASED" |
| 89 | + PatchingConfigsPatchingConfigStrategyBatchingBased PatchingConfigsPatchingConfigStrategyEnum = "BATCHING_BASED" |
| 90 | +) |
| 91 | + |
| 92 | +var mappingPatchingConfigsPatchingConfigStrategyEnum = map[string]PatchingConfigsPatchingConfigStrategyEnum{ |
| 93 | + "DOWNTIME_BASED": PatchingConfigsPatchingConfigStrategyDowntimeBased, |
| 94 | + "BATCHING_BASED": PatchingConfigsPatchingConfigStrategyBatchingBased, |
| 95 | +} |
| 96 | + |
| 97 | +var mappingPatchingConfigsPatchingConfigStrategyEnumLowerCase = map[string]PatchingConfigsPatchingConfigStrategyEnum{ |
| 98 | + "downtime_based": PatchingConfigsPatchingConfigStrategyDowntimeBased, |
| 99 | + "batching_based": PatchingConfigsPatchingConfigStrategyBatchingBased, |
| 100 | +} |
| 101 | + |
| 102 | +// GetPatchingConfigsPatchingConfigStrategyEnumValues Enumerates the set of values for PatchingConfigsPatchingConfigStrategyEnum |
| 103 | +func GetPatchingConfigsPatchingConfigStrategyEnumValues() []PatchingConfigsPatchingConfigStrategyEnum { |
| 104 | + values := make([]PatchingConfigsPatchingConfigStrategyEnum, 0) |
| 105 | + for _, v := range mappingPatchingConfigsPatchingConfigStrategyEnum { |
| 106 | + values = append(values, v) |
| 107 | + } |
| 108 | + return values |
| 109 | +} |
| 110 | + |
| 111 | +// GetPatchingConfigsPatchingConfigStrategyEnumStringValues Enumerates the set of values in String for PatchingConfigsPatchingConfigStrategyEnum |
| 112 | +func GetPatchingConfigsPatchingConfigStrategyEnumStringValues() []string { |
| 113 | + return []string{ |
| 114 | + "DOWNTIME_BASED", |
| 115 | + "BATCHING_BASED", |
| 116 | + } |
| 117 | +} |
| 118 | + |
| 119 | +// GetMappingPatchingConfigsPatchingConfigStrategyEnum performs case Insensitive comparison on enum value and return the desired enum |
| 120 | +func GetMappingPatchingConfigsPatchingConfigStrategyEnum(val string) (PatchingConfigsPatchingConfigStrategyEnum, bool) { |
| 121 | + enum, ok := mappingPatchingConfigsPatchingConfigStrategyEnumLowerCase[strings.ToLower(val)] |
| 122 | + return enum, ok |
| 123 | +} |
0 commit comments