Skip to content

Commit

Permalink
Fix MFKE updating
Browse files Browse the repository at this point in the history
  • Loading branch information
ducvm29 committed Sep 9, 2024
1 parent 7edd991 commit 5952bfe
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 68 deletions.
4 changes: 0 additions & 4 deletions fptcloud/dfke/resource_dfke.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ func (r *resourceDedicatedKubernetesEngine) ImportState(ctx context.Context, req
if response.Diagnostics.HasError() {
return
}

// lack of ability to import without VPC ID
//response.Diagnostics.Append(diag2.NewErrorDiagnostic("Unimplemented", "Importing DFKE clusters isn't currently supported"))
//return
}

func NewResourceDedicatedKubernetesEngine() resource.Resource {
Expand Down
13 changes: 13 additions & 0 deletions fptcloud/mfke/mfke_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ func (m *MfkeApiClient) sendPost(requestURL string, params interface{}) ([]byte,
return m.sendRequestWithHeader(req)
}

func (m *MfkeApiClient) sendPatch(requestURL string, params interface{}) ([]byte, error) {
u := m.Client.PrepareClientURL(requestURL)

// we create a new buffer and encode everything to json to send it in the request
jsonValue, _ := json.Marshal(params)

req, err := http.NewRequest("PATCH", u.String(), bytes.NewBuffer(jsonValue))
if err != nil {
return nil, err
}
return m.sendRequestWithHeader(req)
}

func (m *MfkeApiClient) sendRequestWithHeader(request *http.Request) ([]byte, error) {
request.Header.Set("fpt-region", m.Client.Region)
request.Header.Set("infra-type", "VMW")
Expand Down
Loading

0 comments on commit 5952bfe

Please sign in to comment.