yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/apsara/elasticcache_parameter.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 apsara
    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 SElasticcacheParameter struct {
    25  	multicloud.SElasticcacheParameterBase
    26  	ApsaraTags
    27  
    28  	cacheDB *SElasticcache
    29  
    30  	ParameterDescription string `json:"ParameterDescription"`
    31  	ParameterValue       string `json:"ParameterValue"`
    32  	ForceRestart         string `json:"ForceRestart"`
    33  	CheckingCode         string `json:"CheckingCode"`
    34  	ModifiableStatus     string `json:"ModifiableStatus"`
    35  	ParameterName        string `json:"ParameterName"`
    36  }
    37  
    38  func (self *SElasticcacheParameter) GetId() string {
    39  	return fmt.Sprintf("%s/%s", self.cacheDB.InstanceID, self.ParameterName)
    40  }
    41  
    42  func (self *SElasticcacheParameter) GetName() string {
    43  	return self.ParameterName
    44  }
    45  
    46  func (self *SElasticcacheParameter) GetGlobalId() string {
    47  	return self.GetId()
    48  }
    49  
    50  func (self *SElasticcacheParameter) GetStatus() string {
    51  	return api.ELASTIC_CACHE_PARAMETER_STATUS_AVAILABLE
    52  }
    53  
    54  func (self *SElasticcacheParameter) GetParameterKey() string {
    55  	return self.ParameterName
    56  }
    57  
    58  func (self *SElasticcacheParameter) GetParameterValue() string {
    59  	return self.ParameterValue
    60  }
    61  
    62  func (self *SElasticcacheParameter) GetParameterValueRange() string {
    63  	return self.CheckingCode
    64  }
    65  
    66  func (self *SElasticcacheParameter) GetDescription() string {
    67  	return self.ParameterDescription
    68  }
    69  
    70  func (self *SElasticcacheParameter) GetModifiable() bool {
    71  	switch self.ModifiableStatus {
    72  	case "true":
    73  		return true
    74  	default:
    75  		return false
    76  	}
    77  }
    78  
    79  func (self *SElasticcacheParameter) GetForceRestart() bool {
    80  	switch self.ForceRestart {
    81  	case "true":
    82  		return true
    83  	default:
    84  		return false
    85  	}
    86  }