yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/qcloud/elasticcache_parameters.go (about)

     1  // Copyright 2019 Yunion
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package qcloud
    16  
    17  import (
    18  	"fmt"
    19  
    20  	api "yunion.io/x/cloudmux/pkg/apis/compute"
    21  	"yunion.io/x/cloudmux/pkg/multicloud"
    22  )
    23  
    24  type SElasticcacheParameters struct {
    25  	multicloud.SElasticcacheParameterBase
    26  	QcloudTags
    27  
    28  	cacheDB *SElasticcache
    29  
    30  	InstanceEnumParam    []SElasticcacheParameter `json:"InstanceEnumParam"`
    31  	InstanceIntegerParam []SElasticcacheParameter `json:"InstanceIntegerParam"`
    32  	InstanceTextParam    []SElasticcacheParameter `json:"InstanceTextParam"`
    33  	RequestID            string                   `json:"RequestId"`
    34  	TotalCount           int64                    `json:"TotalCount"`
    35  }
    36  
    37  type SElasticcacheParameter struct {
    38  	multicloud.SElasticcacheParameterBase
    39  	QcloudTags
    40  
    41  	cacheDB *SElasticcache
    42  
    43  	CurrentValue string   `json:"CurrentValue"`
    44  	DefaultValue string   `json:"DefaultValue"`
    45  	EnumValue    []string `json:"EnumValue,omitempty"`
    46  	NeedRestart  string   `json:"NeedRestart"`
    47  	ParamName    string   `json:"ParamName"`
    48  	Tips         string   `json:"Tips"`
    49  	ValueType    string   `json:"ValueType"`
    50  	Max          *string  `json:"Max,omitempty"`
    51  	Min          *string  `json:"Min,omitempty"`
    52  	TextValue    []string `json:"TextValue,omitempty"`
    53  }
    54  
    55  func (self *SElasticcacheParameter) GetId() string {
    56  	return fmt.Sprintf("%s/%s", self.cacheDB.InstanceID, self.ParamName)
    57  }
    58  
    59  func (self *SElasticcacheParameter) GetName() string {
    60  	return self.ParamName
    61  }
    62  
    63  func (self *SElasticcacheParameter) GetGlobalId() string {
    64  	return self.GetId()
    65  }
    66  
    67  func (self *SElasticcacheParameter) GetStatus() string {
    68  	return api.ELASTIC_CACHE_PARAMETER_STATUS_AVAILABLE
    69  }
    70  
    71  func (self *SElasticcacheParameter) GetParameterKey() string {
    72  	return self.ParamName
    73  }
    74  
    75  func (self *SElasticcacheParameter) GetParameterValue() string {
    76  	return self.CurrentValue
    77  }
    78  
    79  func (self *SElasticcacheParameter) GetParameterValueRange() string {
    80  	return fmt.Sprintf("%s", self.EnumValue)
    81  }
    82  
    83  func (self *SElasticcacheParameter) GetDescription() string {
    84  	return self.Tips
    85  }
    86  
    87  func (self *SElasticcacheParameter) GetModifiable() bool {
    88  	return true
    89  }
    90  
    91  func (self *SElasticcacheParameter) GetForceRestart() bool {
    92  	return self.NeedRestart == "true"
    93  }