|
| 1 | +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | +// Code generated. DO NOT EDIT. |
| 3 | + |
| 4 | +// Auto Scaling API |
| 5 | +// |
| 6 | +// Auto Scaling API spec |
| 7 | +// |
| 8 | + |
| 9 | +package autoscaling |
| 10 | + |
| 11 | +import ( |
| 12 | + "encoding/json" |
| 13 | + "github.com/oracle/oci-go-sdk/common" |
| 14 | +) |
| 15 | + |
| 16 | +// AutoScalingConfiguration The representation of AutoScalingConfiguration |
| 17 | +type AutoScalingConfiguration struct { |
| 18 | + |
| 19 | + // The OCID of the compartment containing the AutoScalingConfiguration. |
| 20 | + CompartmentId *string `mandatory:"true" json:"compartmentId"` |
| 21 | + |
| 22 | + // The OCID of the AutoScalingConfiguration |
| 23 | + Id *string `mandatory:"true" json:"id"` |
| 24 | + |
| 25 | + Resource Resource `mandatory:"true" json:"resource"` |
| 26 | + |
| 27 | + // AutoScalingConfiguration policy definitions |
| 28 | + Policies []AutoScalingPolicy `mandatory:"true" json:"policies"` |
| 29 | + |
| 30 | + // The date and time the AutoScalingConfiguration was created, in the format defined by RFC3339. |
| 31 | + // Example: `2016-08-25T21:10:29.600Z` |
| 32 | + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` |
| 33 | + |
| 34 | + // Defined tags for this resource. Each key is predefined and scoped to a |
| 35 | + // namespace. For more information, see Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). |
| 36 | + // Example: `{"Operations": {"CostCenter": "42"}}` |
| 37 | + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` |
| 38 | + |
| 39 | + // A user-friendly name for the AutoScalingConfiguration. Does not have to be unique, and it's changeable. |
| 40 | + // Avoid entering confidential information. |
| 41 | + DisplayName *string `mandatory:"false" json:"displayName"` |
| 42 | + |
| 43 | + // Free-form tags for this resource. Each tag is a simple key-value pair with no |
| 44 | + // predefined name, type, or namespace. For more information, see Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). |
| 45 | + // Example: `{"Department": "Finance"}` |
| 46 | + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` |
| 47 | + |
| 48 | + // The minimum period of time between scaling actions. The default is 300 seconds. |
| 49 | + CoolDownInSeconds *int `mandatory:"false" json:"coolDownInSeconds"` |
| 50 | + |
| 51 | + // If the AutoScalingConfiguration is enabled |
| 52 | + IsEnabled *bool `mandatory:"false" json:"isEnabled"` |
| 53 | +} |
| 54 | + |
| 55 | +func (m AutoScalingConfiguration) String() string { |
| 56 | + return common.PointerString(m) |
| 57 | +} |
| 58 | + |
| 59 | +// UnmarshalJSON unmarshals from json |
| 60 | +func (m *AutoScalingConfiguration) UnmarshalJSON(data []byte) (e error) { |
| 61 | + model := struct { |
| 62 | + DefinedTags map[string]map[string]interface{} `json:"definedTags"` |
| 63 | + DisplayName *string `json:"displayName"` |
| 64 | + FreeformTags map[string]string `json:"freeformTags"` |
| 65 | + CoolDownInSeconds *int `json:"coolDownInSeconds"` |
| 66 | + IsEnabled *bool `json:"isEnabled"` |
| 67 | + CompartmentId *string `json:"compartmentId"` |
| 68 | + Id *string `json:"id"` |
| 69 | + Resource resource `json:"resource"` |
| 70 | + Policies []autoscalingpolicy `json:"policies"` |
| 71 | + TimeCreated *common.SDKTime `json:"timeCreated"` |
| 72 | + }{} |
| 73 | + |
| 74 | + e = json.Unmarshal(data, &model) |
| 75 | + if e != nil { |
| 76 | + return |
| 77 | + } |
| 78 | + m.DefinedTags = model.DefinedTags |
| 79 | + m.DisplayName = model.DisplayName |
| 80 | + m.FreeformTags = model.FreeformTags |
| 81 | + m.CoolDownInSeconds = model.CoolDownInSeconds |
| 82 | + m.IsEnabled = model.IsEnabled |
| 83 | + m.CompartmentId = model.CompartmentId |
| 84 | + m.Id = model.Id |
| 85 | + nn, e := model.Resource.UnmarshalPolymorphicJSON(model.Resource.JsonData) |
| 86 | + if e != nil { |
| 87 | + return |
| 88 | + } |
| 89 | + if nn != nil { |
| 90 | + m.Resource = nn.(Resource) |
| 91 | + } else { |
| 92 | + m.Resource = nil |
| 93 | + } |
| 94 | + m.Policies = make([]AutoScalingPolicy, len(model.Policies)) |
| 95 | + for i, n := range model.Policies { |
| 96 | + nn, err := n.UnmarshalPolymorphicJSON(n.JsonData) |
| 97 | + if err != nil { |
| 98 | + return err |
| 99 | + } |
| 100 | + if nn != nil { |
| 101 | + m.Policies[i] = nn.(AutoScalingPolicy) |
| 102 | + } else { |
| 103 | + m.Policies[i] = nil |
| 104 | + } |
| 105 | + } |
| 106 | + m.TimeCreated = model.TimeCreated |
| 107 | + return |
| 108 | +} |
0 commit comments