github.com/aiven/aiven-go-client@v1.36.0/flink_application_deployment.go (about) 1 package aiven 2 3 type ( 4 // FlinkApplicationDeploymentHandler aiven go-client handler for Flink Application Deployments 5 FlinkApplicationDeploymentHandler struct { 6 client *Client 7 } 8 9 // CreateFlinkApplicationDeploymentRequest Aiven API request 10 // POST https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment 11 CreateFlinkApplicationDeploymentRequest struct { 12 Parallelism int `json:"parallelism,omitempty"` 13 RestartEnabled bool `json:"restart_enabled,omitempty"` 14 StartingSavepoint string `json:"starting_savepoint,omitempty"` 15 VersionID string `json:"version_id"` 16 } 17 18 // CreateFlinkApplicationDeploymentResponse Aiven API response 19 // POST https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment 20 CreateFlinkApplicationDeploymentResponse struct { 21 APIResponse 22 FlinkApplicationDeployment 23 } 24 25 // GetFlinkApplicationDeploymentResponse Aiven API response 26 // GET https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment/<deployment_id> 27 GetFlinkApplicationDeploymentResponse struct { 28 APIResponse 29 30 FlinkApplicationDeployment 31 } 32 33 // DeleteFlinkApplicationDeploymentResponse Aiven API response 34 // DELETE https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment/<deployment_id> 35 DeleteFlinkApplicationDeploymentResponse struct { 36 APIResponse 37 38 FlinkApplicationDeployment 39 } 40 41 // ListFlinkApplicationDeploymentResponse Aiven API response 42 // GET https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment 43 ListFlinkApplicationDeploymentResponse struct { 44 APIResponse 45 Deployments []FlinkApplicationDeployment `json:"deployments"` 46 } 47 48 // shared fields by some responses 49 FlinkApplicationDeployment struct { 50 CreatedAt string `json:"created_at"` 51 CreatedBy string `json:"created_by"` 52 ID string `json:"id"` 53 JobID string `json:"job_id"` 54 LastSavepoint string `json:"last_savepoint"` 55 Parallelism int `json:"parallelism"` 56 RestartEnabled bool `json:"restart_enabled"` 57 StartingSavepoint string `json:"starting_savepoint"` 58 Status string `json:"status"` 59 VersionID string `json:"version_id"` 60 } 61 62 // CancelFlinkApplicationDeploymentResponse Aiven API response 63 // POST https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment/<deployment_id>/cancel 64 CancelFlinkApplicationDeploymentResponse struct { 65 APIResponse 66 67 FlinkApplicationDeployment 68 } 69 70 // StopFlinkApplicationDeploymentResponse Aiven API response 71 // POST https://api.aiven.io/v1/project/<project>/service/<service_name>/flink/application/<application_id>/deployment/<deployment_id>/stop 72 StopFlinkApplicationDeploymentResponse struct { 73 APIResponse 74 75 FlinkApplicationDeployment 76 } 77 ) 78 79 // Create creates a Flink deployment 80 func (h *FlinkApplicationDeploymentHandler) Create(project, service, applicationId string, req CreateFlinkApplicationDeploymentRequest) (*CreateFlinkApplicationDeploymentResponse, error) { 81 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment") 82 bts, err := h.client.doPostRequest(path, req) 83 if err != nil { 84 return nil, err 85 } 86 87 var r CreateFlinkApplicationDeploymentResponse 88 return &r, checkAPIResponse(bts, &r) 89 } 90 91 // Get gets a Flink deployment 92 func (h *FlinkApplicationDeploymentHandler) Get(project, service, applicationId, deploymentId string) (*GetFlinkApplicationDeploymentResponse, error) { 93 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment", deploymentId) 94 bts, err := h.client.doGetRequest(path, nil) 95 if err != nil { 96 return nil, err 97 } 98 99 var r GetFlinkApplicationDeploymentResponse 100 return &r, checkAPIResponse(bts, &r) 101 } 102 103 // Delete deletes a Flink deployment 104 func (h *FlinkApplicationDeploymentHandler) Delete(project, service, applicationId, deploymentId string) (*DeleteFlinkApplicationDeploymentResponse, error) { 105 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment", deploymentId) 106 bts, err := h.client.doDeleteRequest(path, nil) 107 if err != nil { 108 return nil, err 109 } 110 111 var r DeleteFlinkApplicationDeploymentResponse 112 return &r, checkAPIResponse(bts, &r) 113 } 114 115 // List lists all Flink deployments 116 func (h *FlinkApplicationDeploymentHandler) List(project, service, applicationId string) (*ListFlinkApplicationDeploymentResponse, error) { 117 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment") 118 bts, err := h.client.doGetRequest(path, nil) 119 if err != nil { 120 return nil, err 121 } 122 123 var r ListFlinkApplicationDeploymentResponse 124 return &r, checkAPIResponse(bts, &r) 125 } 126 127 // Cancel cancel the Flink of a Flink deployment 128 func (h *FlinkApplicationDeploymentHandler) Cancel(project, service, applicationId, deploymentId string) (*CancelFlinkApplicationDeploymentResponse, error) { 129 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment", deploymentId, "cancel") 130 bts, err := h.client.doPostRequest(path, nil) 131 if err != nil { 132 return nil, err 133 } 134 135 var r CancelFlinkApplicationDeploymentResponse 136 return &r, checkAPIResponse(bts, &r) 137 } 138 139 // Stop cancel the Flink of a Flink deployment 140 func (h *FlinkApplicationDeploymentHandler) Stop(project, service, applicationId, deploymentId string) (*StopFlinkApplicationDeploymentResponse, error) { 141 path := buildPath("project", project, "service", service, "flink", "application", applicationId, "deployment", deploymentId, "stop") 142 bts, err := h.client.doPostRequest(path, nil) 143 if err != nil { 144 return nil, err 145 } 146 147 var r StopFlinkApplicationDeploymentResponse 148 return &r, checkAPIResponse(bts, &r) 149 }