sigs.k8s.io/external-dns@v0.14.1/provider/tencentcloud/cloudapi/readonlyapi.go (about)

     1  /*
     2  Copyright 2022 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package cloudapi
    18  
    19  import (
    20  	dnspod "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod/v20210323"
    21  	privatedns "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns/v20201028"
    22  )
    23  
    24  type readonlyAPIService struct {
    25  	defaultTencentAPIService
    26  }
    27  
    28  func NewReadOnlyAPIService(region string, rate int, secretId string, secretKey string, internetEndpoint bool) *readonlyAPIService {
    29  	apiService := NewTencentAPIService(region, rate, secretId, secretKey, internetEndpoint)
    30  	tencentAPIService := &readonlyAPIService{
    31  		*apiService,
    32  	}
    33  	return tencentAPIService
    34  }
    35  
    36  ////////////////////////////////////////////////////////////////
    37  // PrivateDns API
    38  ////////////////////////////////////////////////////////////////
    39  
    40  func (api *readonlyAPIService) CreatePrivateZoneRecord(request *privatedns.CreatePrivateZoneRecordRequest) (response *privatedns.CreatePrivateZoneRecordResponse, err error) {
    41  	apiAction := CreatePrivateZoneRecord
    42  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    43  	return response, nil
    44  }
    45  
    46  func (api *readonlyAPIService) DeletePrivateZoneRecord(request *privatedns.DeletePrivateZoneRecordRequest) (response *privatedns.DeletePrivateZoneRecordResponse, err error) {
    47  	apiAction := DeletePrivateZoneRecord
    48  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    49  	return response, nil
    50  }
    51  
    52  func (api *readonlyAPIService) ModifyPrivateZoneRecord(request *privatedns.ModifyPrivateZoneRecordRequest) (response *privatedns.ModifyPrivateZoneRecordResponse, err error) {
    53  	apiAction := ModifyPrivateZoneRecord
    54  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    55  	return response, nil
    56  }
    57  
    58  ////////////////////////////////////////////////////////////////
    59  // DnsPod API
    60  ////////////////////////////////////////////////////////////////
    61  
    62  func (api *readonlyAPIService) CreateRecord(request *dnspod.CreateRecordRequest) (response *dnspod.CreateRecordResponse, err error) {
    63  	apiAction := CreateRecord
    64  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    65  	return response, nil
    66  }
    67  
    68  func (api *readonlyAPIService) DeleteRecord(request *dnspod.DeleteRecordRequest) (response *dnspod.DeleteRecordResponse, err error) {
    69  	apiAction := DeleteRecord
    70  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    71  	return response, nil
    72  }
    73  
    74  func (api *readonlyAPIService) ModifyRecord(request *dnspod.ModifyRecordRequest) (response *dnspod.ModifyRecordResponse, err error) {
    75  	apiAction := ModifyRecord
    76  	APIRecord(apiAction, JsonWrapper(request), "dryRun")
    77  	return response, nil
    78  }