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// Autoscaling API 6// 7// APIs for dynamically scaling Compute resources to meet application requirements. For more information about 8// autoscaling, see Autoscaling (https://docs.cloud.oracle.com/Content/Compute/Tasks/autoscalinginstancepools.htm). For information about the 9// Compute service, see Overview of the Compute Service (https://docs.cloud.oracle.com/Content/Compute/Concepts/computeoverview.htm). 10// **Note:** Autoscaling is not available in US Government Cloud tenancies. For more information, see 11// Oracle Cloud Infrastructure US Government Cloud (https://docs.cloud.oracle.com/Content/General/Concepts/govoverview.htm). 12// 13 14package autoscaling 15 16import ( 17 "encoding/json" 18 "github.com/oracle/oci-go-sdk/common" 19) 20 21// UpdateAutoScalingPolicyDetails The representation of UpdateAutoScalingPolicyDetails 22type UpdateAutoScalingPolicyDetails interface { 23 24 // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. 25 GetDisplayName() *string 26 27 // The capacity requirements of the autoscaling policy. 28 GetCapacity() *Capacity 29 30 // Boolean field indicating whether this policy is enabled or not. 31 GetIsEnabled() *bool 32} 33 34type updateautoscalingpolicydetails struct { 35 JsonData []byte 36 DisplayName *string `mandatory:"false" json:"displayName"` 37 Capacity *Capacity `mandatory:"false" json:"capacity"` 38 IsEnabled *bool `mandatory:"false" json:"isEnabled"` 39 PolicyType string `json:"policyType"` 40} 41 42// UnmarshalJSON unmarshals json 43func (m *updateautoscalingpolicydetails) UnmarshalJSON(data []byte) error { 44 m.JsonData = data 45 type Unmarshalerupdateautoscalingpolicydetails updateautoscalingpolicydetails 46 s := struct { 47 Model Unmarshalerupdateautoscalingpolicydetails 48 }{} 49 err := json.Unmarshal(data, &s.Model) 50 if err != nil { 51 return err 52 } 53 m.DisplayName = s.Model.DisplayName 54 m.Capacity = s.Model.Capacity 55 m.IsEnabled = s.Model.IsEnabled 56 m.PolicyType = s.Model.PolicyType 57 58 return err 59} 60 61// UnmarshalPolymorphicJSON unmarshals polymorphic json 62func (m *updateautoscalingpolicydetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { 63 64 if data == nil || string(data) == "null" { 65 return nil, nil 66 } 67 68 var err error 69 switch m.PolicyType { 70 case "threshold": 71 mm := UpdateThresholdPolicyDetails{} 72 err = json.Unmarshal(data, &mm) 73 return mm, err 74 case "scheduled": 75 mm := UpdateScheduledPolicyDetails{} 76 err = json.Unmarshal(data, &mm) 77 return mm, err 78 default: 79 return *m, nil 80 } 81} 82 83//GetDisplayName returns DisplayName 84func (m updateautoscalingpolicydetails) GetDisplayName() *string { 85 return m.DisplayName 86} 87 88//GetCapacity returns Capacity 89func (m updateautoscalingpolicydetails) GetCapacity() *Capacity { 90 return m.Capacity 91} 92 93//GetIsEnabled returns IsEnabled 94func (m updateautoscalingpolicydetails) GetIsEnabled() *bool { 95 return m.IsEnabled 96} 97 98func (m updateautoscalingpolicydetails) String() string { 99 return common.PointerString(m) 100} 101