Skip to content

Commit

Permalink
Merge pull request #34 from vngcloud/iam-vserver
Browse files Browse the repository at this point in the history
auto upgrade config
  • Loading branch information
manhtu1997 authored Jan 13, 2025
2 parents 28f60ad + f731134 commit 5a14ee1
Show file tree
Hide file tree
Showing 8 changed files with 584 additions and 137 deletions.
179 changes: 179 additions & 0 deletions client/vks/api_v1_cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,182 @@ func (a *V1ClusterControllerApiService) V1ClustersPost(ctx context.Context, loca

return localVarReturnValue, localVarHttpResponse, nil
}

type V1ClusterControllerApiV1ClustersClusterIdPutAutoUpgradeConfigOpts struct {
Body optional.Interface
PortalUserId optional.Int64
}

func (a *V1ClusterControllerApiService) V1ClustersClusterIdPutAutoUpgradeConfig(ctx context.Context, clusterId string, localVarOptionals *V1ClusterControllerApiV1ClustersClusterIdPutAutoUpgradeConfigOpts) (ClusterDto, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ClusterDto
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v1/clusters/{clusterId}/auto-upgrade-config"
localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", fmt.Sprintf("%v", clusterId), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}

// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}

// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.PortalUserId.IsSet() {
localVarHeaderParams["portal-user-id"] = parameterToString(localVarOptionals.PortalUserId.Value(), "")
}
// body params
if localVarOptionals != nil && localVarOptionals.Body.IsSet() {

localVarOptionalBody := localVarOptionals.Body.Value()
localVarPostBody = &localVarOptionalBody
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}

localVarBody, _ := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}

if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}

if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v ClusterDto
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}

return localVarReturnValue, localVarHttpResponse, nil
}

type V1ClusterControllerApiV1ClustersClusterIdDeleteAutoUpgradeConfigOpts struct {
PortalUserId optional.Int64
}

func (a *V1ClusterControllerApiService) V1ClustersClusterIdDeleteAutoUpgradeConfig(ctx context.Context, clusterId string, localVarOptionals *V1ClusterControllerApiV1ClustersClusterIdDeleteAutoUpgradeConfigOpts) (ClusterDto, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ClusterDto
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v1/clusters/{clusterId}/auto-upgrade-config"
localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", fmt.Sprintf("%v", clusterId), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

// to determine the Content-Type header
localVarHttpContentTypes := []string{}

// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}

// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.PortalUserId.IsSet() {
localVarHeaderParams["portal-user-id"] = parameterToString(localVarOptionals.PortalUserId.Value(), "")
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}

localVarBody, _ := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}

if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}

if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v ClusterDto
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}

return localVarReturnValue, localVarHttpResponse, nil
}
6 changes: 6 additions & 0 deletions client/vks/model_auto_upgrade_config_dto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package vks

type AutoUpgradeConfigDto struct {
Weekdays string `json:"weekdays"`
Time string `json:"time"`
}
39 changes: 20 additions & 19 deletions client/vks/model_cluster_detail_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@
package vks

type ClusterDetailDto struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Status string `json:"status,omitempty"`
Version string `json:"version,omitempty"`
NumNodes int64 `json:"numNodes,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
EnablePrivateCluster bool `json:"enablePrivateCluster,omitempty"`
EnableServiceEndpoint bool `json:"enabledServiceEndpoint"`
NetworkType string `json:"networkType,omitempty"`
VpcId string `json:"vpcId,omitempty"`
SubnetId string `json:"subnetId,omitempty"`
Cidr string `json:"cidr,omitempty"`
EnabledLoadBalancerPlugin bool `json:"enabledLoadBalancerPlugin,omitempty"`
EnabledBlockStoreCsiPlugin bool `json:"enabledBlockStoreCsiPlugin,omitempty"`
WhitelistNodeCIDRs []string `json:"whitelistNodeCIDRs,omitempty"`
SecondarySubnets []string `json:"secondarySubnets,omitempty"`
NodeNetmaskSize int32 `json:"nodeNetmaskSize"`
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Status string `json:"status,omitempty"`
Version string `json:"version,omitempty"`
NumNodes int64 `json:"numNodes,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
EnablePrivateCluster bool `json:"enablePrivateCluster,omitempty"`
EnableServiceEndpoint bool `json:"enabledServiceEndpoint"`
NetworkType string `json:"networkType,omitempty"`
VpcId string `json:"vpcId,omitempty"`
SubnetId string `json:"subnetId,omitempty"`
Cidr string `json:"cidr,omitempty"`
EnabledLoadBalancerPlugin bool `json:"enabledLoadBalancerPlugin,omitempty"`
EnabledBlockStoreCsiPlugin bool `json:"enabledBlockStoreCsiPlugin,omitempty"`
WhitelistNodeCIDRs []string `json:"whitelistNodeCIDRs,omitempty"`
SecondarySubnets []string `json:"secondarySubnets,omitempty"`
NodeNetmaskSize int32 `json:"nodeNetmaskSize"`
AutoUpgradeConfig *AutoUpgradeConfigDto `json:"autoUpgradeConfig"`
}
29 changes: 15 additions & 14 deletions client/vks/model_create_cluster_combo_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@
package vks

type CreateClusterComboDto struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Version string `json:"version"`
EnablePrivateCluster bool `json:"enablePrivateCluster"`
EnabledServiceEndpoint bool `json:"enabledServiceEndpoint"`
NetworkType string `json:"networkType"`
VpcId string `json:"vpcId"`
SubnetId string `json:"subnetId"`
Cidr string `json:"cidr"`
EnabledLoadBalancerPlugin bool `json:"enabledLoadBalancerPlugin"`
EnabledBlockStoreCsiPlugin bool `json:"enabledBlockStoreCsiPlugin"`
NodeGroups []CreateNodeGroupDto `json:"nodeGroups"`
SecondarySubnets []string `json:"secondarySubnets"`
NodeNetmaskSize int32 `json:"nodeNetmaskSize"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Version string `json:"version"`
EnablePrivateCluster bool `json:"enablePrivateCluster"`
EnabledServiceEndpoint bool `json:"enabledServiceEndpoint"`
NetworkType string `json:"networkType"`
VpcId string `json:"vpcId"`
SubnetId string `json:"subnetId"`
Cidr string `json:"cidr"`
EnabledLoadBalancerPlugin bool `json:"enabledLoadBalancerPlugin"`
EnabledBlockStoreCsiPlugin bool `json:"enabledBlockStoreCsiPlugin"`
NodeGroups []CreateNodeGroupDto `json:"nodeGroups"`
SecondarySubnets []string `json:"secondarySubnets"`
NodeNetmaskSize int32 `json:"nodeNetmaskSize"`
AutoUpgradeConfig *AutoUpgradeConfigDto `json:"autoUpgradeConfig"`
}
6 changes: 4 additions & 2 deletions client/vks/model_update_cluster_dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
package vks

type UpdateClusterDto struct {
Version string `json:"version"`
WhitelistNodeCIDRs []string `json:"whitelistNodeCIDRs"`
Version string `json:"version"`
WhitelistNodeCIDRs []string `json:"whitelistNodeCIDRs"`
EnabledLoadBalancerPlugin bool `json:"enabledLoadBalancerPlugin"`
EnabledBlockStoreCsiPlugin bool `json:"enabledBlockStoreCsiPlugin"`
}
Loading

0 comments on commit 5a14ee1

Please sign in to comment.