yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/aws/dbinstance_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 aws
    16  
    17  import "yunion.io/x/pkg/errors"
    18  
    19  type SDBInstanceParameter struct {
    20  	instance *SDBInstance
    21  
    22  	AllowedValues  string `xml:"AllowedValues"`
    23  	ApplyType      string `xml:"ApplyType"`
    24  	DataType       string `xml:"DataType"`
    25  	Description    string `xml:"Description"`
    26  	ApplyMethod    string `xml:"ApplyMethod"`
    27  	ParameterName  string `xml:"ParameterName"`
    28  	Source         string `xml:"Source"`
    29  	IsModifiable   bool   `xml:"IsModifiable"`
    30  	ParameterValue string `xml:"ParameterValue"`
    31  }
    32  
    33  type SDBInstanceParameters struct {
    34  	Parameters []SDBInstanceParameter `xml:"Parameters>Parameter"`
    35  }
    36  
    37  func (param *SDBInstanceParameter) GetGlobalId() string {
    38  	return param.ParameterName
    39  }
    40  
    41  func (param *SDBInstanceParameter) GetKey() string {
    42  	return param.ParameterName
    43  }
    44  
    45  func (param *SDBInstanceParameter) GetValue() string {
    46  	return param.ParameterValue
    47  }
    48  
    49  func (param *SDBInstanceParameter) GetDescription() string {
    50  	return param.Description
    51  }
    52  
    53  func (region *SRegion) GetDBInstanceParameters(name string) ([]SDBInstanceParameter, error) {
    54  	param := map[string]string{"DBParameterGroupName": name}
    55  	parameters := SDBInstanceParameters{}
    56  	err := region.rdsRequest("DescribeDBParameters", param, &parameters)
    57  	if err != nil {
    58  		return nil, errors.Wrap(err, "DescribeDBParameters")
    59  	}
    60  	return parameters.Parameters, nil
    61  }