diff --git a/client_generated.go b/client_generated.go index 6ee2612..380c8ce 100644 --- a/client_generated.go +++ b/client_generated.go @@ -19,6 +19,9 @@ import ( flinkapplication "github.com/aiven/go-client-codegen/handler/flinkapplication" flinkapplicationdeployment "github.com/aiven/go-client-codegen/handler/flinkapplicationdeployment" flinkapplicationversion "github.com/aiven/go-client-codegen/handler/flinkapplicationversion" + flinkjarapplication "github.com/aiven/go-client-codegen/handler/flinkjarapplication" + flinkjarapplicationdeployment "github.com/aiven/go-client-codegen/handler/flinkjarapplicationdeployment" + flinkjarapplicationversion "github.com/aiven/go-client-codegen/handler/flinkjarapplicationversion" flinkjob "github.com/aiven/go-client-codegen/handler/flinkjob" kafka "github.com/aiven/go-client-codegen/handler/kafka" kafkaconnect "github.com/aiven/go-client-codegen/handler/kafkaconnect" @@ -48,40 +51,43 @@ type doer interface { func newClient(doer doer) Client { return &client{ - AccountAuthenticationHandler: accountauthentication.NewHandler(doer), - AccountHandler: account.NewHandler(doer), - AccountTeamHandler: accountteam.NewHandler(doer), - AccountTeamMemberHandler: accountteammember.NewHandler(doer), - AlloyDBOmniHandler: alloydbomni.NewHandler(doer), - ApplicationUserHandler: applicationuser.NewHandler(doer), - BillingGroupHandler: billinggroup.NewHandler(doer), - ClickHouseHandler: clickhouse.NewHandler(doer), - CloudHandler: cloud.NewHandler(doer), - DomainHandler: domain.NewHandler(doer), - FlinkApplicationDeploymentHandler: flinkapplicationdeployment.NewHandler(doer), - FlinkApplicationHandler: flinkapplication.NewHandler(doer), - FlinkApplicationVersionHandler: flinkapplicationversion.NewHandler(doer), - FlinkHandler: flink.NewHandler(doer), - FlinkJobHandler: flinkjob.NewHandler(doer), - KafkaConnectHandler: kafkaconnect.NewHandler(doer), - KafkaHandler: kafka.NewHandler(doer), - KafkaMirrorMakerHandler: kafkamirrormaker.NewHandler(doer), - KafkaSchemaRegistryHandler: kafkaschemaregistry.NewHandler(doer), - KafkaTopicHandler: kafkatopic.NewHandler(doer), - MySQLHandler: mysql.NewHandler(doer), - OpenSearchHandler: opensearch.NewHandler(doer), - OrganizationHandler: organization.NewHandler(doer), - OrganizationUserHandler: organizationuser.NewHandler(doer), - PostgreSQLHandler: postgresql.NewHandler(doer), - PrivatelinkHandler: privatelink.NewHandler(doer), - ProjectBillingHandler: projectbilling.NewHandler(doer), - ProjectHandler: project.NewHandler(doer), - ServiceHandler: service.NewHandler(doer), - StaticIPHandler: staticip.NewHandler(doer), - ThanosHandler: thanos.NewHandler(doer), - UserGroupHandler: usergroup.NewHandler(doer), - UserHandler: user.NewHandler(doer), - VpcHandler: vpc.NewHandler(doer), + AccountAuthenticationHandler: accountauthentication.NewHandler(doer), + AccountHandler: account.NewHandler(doer), + AccountTeamHandler: accountteam.NewHandler(doer), + AccountTeamMemberHandler: accountteammember.NewHandler(doer), + AlloyDBOmniHandler: alloydbomni.NewHandler(doer), + ApplicationUserHandler: applicationuser.NewHandler(doer), + BillingGroupHandler: billinggroup.NewHandler(doer), + ClickHouseHandler: clickhouse.NewHandler(doer), + CloudHandler: cloud.NewHandler(doer), + DomainHandler: domain.NewHandler(doer), + FlinkApplicationDeploymentHandler: flinkapplicationdeployment.NewHandler(doer), + FlinkApplicationHandler: flinkapplication.NewHandler(doer), + FlinkApplicationVersionHandler: flinkapplicationversion.NewHandler(doer), + FlinkHandler: flink.NewHandler(doer), + FlinkJarApplicationDeploymentHandler: flinkjarapplicationdeployment.NewHandler(doer), + FlinkJarApplicationHandler: flinkjarapplication.NewHandler(doer), + FlinkJarApplicationVersionHandler: flinkjarapplicationversion.NewHandler(doer), + FlinkJobHandler: flinkjob.NewHandler(doer), + KafkaConnectHandler: kafkaconnect.NewHandler(doer), + KafkaHandler: kafka.NewHandler(doer), + KafkaMirrorMakerHandler: kafkamirrormaker.NewHandler(doer), + KafkaSchemaRegistryHandler: kafkaschemaregistry.NewHandler(doer), + KafkaTopicHandler: kafkatopic.NewHandler(doer), + MySQLHandler: mysql.NewHandler(doer), + OpenSearchHandler: opensearch.NewHandler(doer), + OrganizationHandler: organization.NewHandler(doer), + OrganizationUserHandler: organizationuser.NewHandler(doer), + PostgreSQLHandler: postgresql.NewHandler(doer), + PrivatelinkHandler: privatelink.NewHandler(doer), + ProjectBillingHandler: projectbilling.NewHandler(doer), + ProjectHandler: project.NewHandler(doer), + ServiceHandler: service.NewHandler(doer), + StaticIPHandler: staticip.NewHandler(doer), + ThanosHandler: thanos.NewHandler(doer), + UserGroupHandler: usergroup.NewHandler(doer), + UserHandler: user.NewHandler(doer), + VpcHandler: vpc.NewHandler(doer), } } @@ -100,6 +106,9 @@ type client struct { flinkapplication.FlinkApplicationHandler flinkapplicationdeployment.FlinkApplicationDeploymentHandler flinkapplicationversion.FlinkApplicationVersionHandler + flinkjarapplication.FlinkJarApplicationHandler + flinkjarapplicationdeployment.FlinkJarApplicationDeploymentHandler + flinkjarapplicationversion.FlinkJarApplicationVersionHandler flinkjob.FlinkJobHandler kafka.KafkaHandler kafkaconnect.KafkaConnectHandler @@ -136,6 +145,9 @@ type Client interface { flinkapplication.Handler flinkapplicationdeployment.Handler flinkapplicationversion.Handler + flinkjarapplication.Handler + flinkjarapplicationdeployment.Handler + flinkjarapplicationversion.Handler flinkjob.Handler kafka.Handler kafkaconnect.Handler diff --git a/config.yaml b/config.yaml index ab030d0..17705b7 100644 --- a/config.yaml +++ b/config.yaml @@ -104,6 +104,23 @@ FlinkApplicationVersion: - ServiceFlinkDeleteApplicationVersion - ServiceFlinkGetApplicationVersion - ServiceFlinkValidateApplicationVersion +FlinkJarApplication: + - ServiceFlinkCreateJarApplication + - ServiceFlinkDeleteJarApplication + - ServiceFlinkGetJarApplication + - ServiceFlinkListJarApplications + - ServiceFlinkUpdateJarApplication +FlinkJarApplicationDeployment: + - ServiceFlinkCancelJarApplicationDeployment + - ServiceFlinkCreateJarApplicationDeployment + - ServiceFlinkDeleteJarApplicationDeployment + - ServiceFlinkGetJarApplicationDeployment + - ServiceFlinkListJarApplicationDeployments + - ServiceFlinkStopJarApplicationDeployment +FlinkJarApplicationVersion: + - ServiceFlinkCreateJarApplicationVersion + - ServiceFlinkDeleteJarApplicationVersion + - ServiceFlinkGetJarApplicationVersion FlinkJob: - ServiceFlinkJobDetails - ServiceFlinkJobsList diff --git a/generator/main.go b/generator/main.go index ef5c388..162583a 100644 --- a/generator/main.go +++ b/generator/main.go @@ -12,6 +12,7 @@ import ( "path/filepath" "regexp" "sort" + "strconv" "strings" "time" @@ -475,7 +476,7 @@ func exec() error { // reMakesSense sometimes there are invalid enums, for instance, just a comma "," var reMakesSense = regexp.MustCompile(`\w`) -//nolint:funlen // It's a generator, it's supposed to be long, and we won't expand it. +//nolint:funlen,nestif // It's a generator, it's supposed to be long, and we won't expand it. func writeStruct(f *jen.File, s *Schema) error { if s.isAnonymous() { return nil @@ -488,7 +489,6 @@ func writeStruct(f *jen.File, s *Schema) error { enums := make([]jen.Code, 0) values := make([]jen.Code, 0) - for _, e := range s.Enum { literal := fmt.Sprint(e) if !reMakesSense.MatchString(literal) { @@ -507,8 +507,18 @@ func writeStruct(f *jen.File, s *Schema) error { constant += "Asterisk" } - enums = append(enums, jen.Id(constant).Op(s.CamelName).Op("=").Lit(literal)) - values = append(values, jen.Lit(literal)) + // Turns integer literals into integers + var v any = literal + if s.Type == SchemaTypeInteger { + i, err := strconv.Atoi(literal) + if err != nil { + return err + } + v = i + } + + enums = append(enums, jen.Id(constant).Op(s.CamelName).Op("=").Lit(v)) + values = append(values, jen.Lit(v)) } if len(enums) == 0 { diff --git a/handler/flinkjarapplication/flinkjarapplication.go b/handler/flinkjarapplication/flinkjarapplication.go new file mode 100644 index 0000000..8722c7c --- /dev/null +++ b/handler/flinkjarapplication/flinkjarapplication.go @@ -0,0 +1,269 @@ +// Code generated by Aiven. DO NOT EDIT. + +package flinkjarapplication + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "time" +) + +type Handler interface { + // ServiceFlinkCreateJarApplication [EXPERIMENTAL] Create a Flink JarApplication + // POST /v1/project/{project}/service/{service_name}/flink/jar_application + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkCreateJarApplication + ServiceFlinkCreateJarApplication(ctx context.Context, project string, serviceName string, in *ServiceFlinkCreateJarApplicationIn) (*ServiceFlinkCreateJarApplicationOut, error) + + // ServiceFlinkDeleteJarApplication [EXPERIMENTAL] Delete a Flink JarApplication + // DELETE /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkDeleteJarApplication + ServiceFlinkDeleteJarApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkDeleteJarApplicationOut, error) + + // ServiceFlinkGetJarApplication [EXPERIMENTAL] Get a Flink JarApplication + // GET /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkGetJarApplication + ServiceFlinkGetJarApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkGetJarApplicationOut, error) + + // ServiceFlinkListJarApplications [EXPERIMENTAL] Get all Flink JarApplications + // GET /v1/project/{project}/service/{service_name}/flink/jar_application + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkListJarApplications + ServiceFlinkListJarApplications(ctx context.Context, project string, serviceName string) ([]ApplicationOut, error) + + // ServiceFlinkUpdateJarApplication [EXPERIMENTAL] Update a Flink JarApplication + // PUT /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkUpdateJarApplication + ServiceFlinkUpdateJarApplication(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkUpdateJarApplicationIn) (*ServiceFlinkUpdateJarApplicationOut, error) +} + +// doer http client +type doer interface { + Do(ctx context.Context, operationID, method, path string, in any, query ...[2]string) ([]byte, error) +} + +func NewHandler(doer doer) FlinkJarApplicationHandler { + return FlinkJarApplicationHandler{doer} +} + +type FlinkJarApplicationHandler struct { + doer doer +} + +func (h *FlinkJarApplicationHandler) ServiceFlinkCreateJarApplication(ctx context.Context, project string, serviceName string, in *ServiceFlinkCreateJarApplicationIn) (*ServiceFlinkCreateJarApplicationOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application", url.PathEscape(project), url.PathEscape(serviceName)) + b, err := h.doer.Do(ctx, "ServiceFlinkCreateJarApplication", "POST", path, in) + if err != nil { + return nil, err + } + out := new(ServiceFlinkCreateJarApplicationOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationHandler) ServiceFlinkDeleteJarApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkDeleteJarApplicationOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkDeleteJarApplication", "DELETE", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkDeleteJarApplicationOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationHandler) ServiceFlinkGetJarApplication(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkGetJarApplicationOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkGetJarApplication", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkGetJarApplicationOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationHandler) ServiceFlinkListJarApplications(ctx context.Context, project string, serviceName string) ([]ApplicationOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application", url.PathEscape(project), url.PathEscape(serviceName)) + b, err := h.doer.Do(ctx, "ServiceFlinkListJarApplications", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(serviceFlinkListJarApplicationsOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Applications, nil +} +func (h *FlinkJarApplicationHandler) ServiceFlinkUpdateJarApplication(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkUpdateJarApplicationIn) (*ServiceFlinkUpdateJarApplicationOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkUpdateJarApplication", "PUT", path, in) + if err != nil { + return nil, err + } + out := new(ServiceFlinkUpdateJarApplicationOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} + +type ApplicationOut struct { + CreatedAt *time.Time `json:"created_at,omitempty"` // Created at + CreatedBy *string `json:"created_by,omitempty"` // Created by + Id string `json:"id"` // Application ID + Name string `json:"name"` // Application name + UpdatedAt *time.Time `json:"updated_at,omitempty"` // Updated at + UpdatedBy *string `json:"updated_by,omitempty"` // Updated by +} +type ApplicationVersionOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + FileInfo *FileInfoOut `json:"file_info,omitempty"` // Flink JarApplicationVersion FileInfo + Id string `json:"id"` // ApplicationVersion ID + Version int `json:"version"` // Version number +} + +// CurrentDeploymentOut Flink JarApplicationDeployment +type CurrentDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status CurrentDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} +type CurrentDeploymentStatusType string + +const ( + CurrentDeploymentStatusTypeInitializing CurrentDeploymentStatusType = "INITIALIZING" + CurrentDeploymentStatusTypeCreated CurrentDeploymentStatusType = "CREATED" + CurrentDeploymentStatusTypeRunning CurrentDeploymentStatusType = "RUNNING" + CurrentDeploymentStatusTypeFailing CurrentDeploymentStatusType = "FAILING" + CurrentDeploymentStatusTypeFailed CurrentDeploymentStatusType = "FAILED" + CurrentDeploymentStatusTypeSaving CurrentDeploymentStatusType = "SAVING" + CurrentDeploymentStatusTypeCancellingRequested CurrentDeploymentStatusType = "CANCELLING_REQUESTED" + CurrentDeploymentStatusTypeCancelling CurrentDeploymentStatusType = "CANCELLING" + CurrentDeploymentStatusTypeCanceled CurrentDeploymentStatusType = "CANCELED" + CurrentDeploymentStatusTypeSavingAndStopRequested CurrentDeploymentStatusType = "SAVING_AND_STOP_REQUESTED" + CurrentDeploymentStatusTypeSavingAndStop CurrentDeploymentStatusType = "SAVING_AND_STOP" + CurrentDeploymentStatusTypeFinished CurrentDeploymentStatusType = "FINISHED" + CurrentDeploymentStatusTypeRestarting CurrentDeploymentStatusType = "RESTARTING" + CurrentDeploymentStatusTypeSuspended CurrentDeploymentStatusType = "SUSPENDED" + CurrentDeploymentStatusTypeDeleteRequested CurrentDeploymentStatusType = "DELETE_REQUESTED" + CurrentDeploymentStatusTypeDeleting CurrentDeploymentStatusType = "DELETING" + CurrentDeploymentStatusTypeReconciling CurrentDeploymentStatusType = "RECONCILING" +) + +func CurrentDeploymentStatusTypeChoices() []string { + return []string{"INITIALIZING", "CREATED", "RUNNING", "FAILING", "FAILED", "SAVING", "CANCELLING_REQUESTED", "CANCELLING", "CANCELED", "SAVING_AND_STOP_REQUESTED", "SAVING_AND_STOP", "FINISHED", "RESTARTING", "SUSPENDED", "DELETE_REQUESTED", "DELETING", "RECONCILING"} +} + +// FileInfoOut Flink JarApplicationVersion FileInfo +type FileInfoOut struct { + FileSha256 *string `json:"file_sha256,omitempty"` // sha256 of the file if known + FileSize *int `json:"file_size,omitempty"` // The size of the file in bytes + FileStatus FileStatusType `json:"file_status,omitempty"` // File status + Url *string `json:"url,omitempty"` // AWS s3 pre-signed url + VerifyErrorCode VerifyErrorCodeType `json:"verify_error_code,omitempty"` // Verify error code + VerifyErrorMessage *string `json:"verify_error_message,omitempty"` // Verify error message +} +type FileStatusType string + +const ( + FileStatusTypeInitial FileStatusType = "INITIAL" + FileStatusTypeReady FileStatusType = "READY" + FileStatusTypeFailed FileStatusType = "FAILED" +) + +func FileStatusTypeChoices() []string { + return []string{"INITIAL", "READY", "FAILED"} +} + +// ServiceFlinkCreateJarApplicationIn ServiceFlinkCreateJarApplicationRequestBody +type ServiceFlinkCreateJarApplicationIn struct { + Name string `json:"name"` // Application name +} + +// ServiceFlinkCreateJarApplicationOut ServiceFlinkCreateJarApplicationResponse +type ServiceFlinkCreateJarApplicationOut struct { + ApplicationVersions []ApplicationVersionOut `json:"application_versions"` // JarApplicationVersions + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + CurrentDeployment *CurrentDeploymentOut `json:"current_deployment,omitempty"` // Flink JarApplicationDeployment + Id string `json:"id"` // Application ID + Name string `json:"name"` // Application name + UpdatedAt time.Time `json:"updated_at"` // Updated at + UpdatedBy string `json:"updated_by"` // Updated by +} + +// ServiceFlinkDeleteJarApplicationOut ServiceFlinkDeleteJarApplicationResponse +type ServiceFlinkDeleteJarApplicationOut struct { + ApplicationVersions []ApplicationVersionOut `json:"application_versions"` // JarApplicationVersions + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + CurrentDeployment *CurrentDeploymentOut `json:"current_deployment,omitempty"` // Flink JarApplicationDeployment + Id string `json:"id"` // Application ID + Name string `json:"name"` // Application name + UpdatedAt time.Time `json:"updated_at"` // Updated at + UpdatedBy string `json:"updated_by"` // Updated by +} + +// ServiceFlinkGetJarApplicationOut ServiceFlinkGetJarApplicationResponse +type ServiceFlinkGetJarApplicationOut struct { + ApplicationVersions []ApplicationVersionOut `json:"application_versions"` // JarApplicationVersions + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + CurrentDeployment *CurrentDeploymentOut `json:"current_deployment,omitempty"` // Flink JarApplicationDeployment + Id string `json:"id"` // Application ID + Name string `json:"name"` // Application name + UpdatedAt time.Time `json:"updated_at"` // Updated at + UpdatedBy string `json:"updated_by"` // Updated by +} + +// ServiceFlinkUpdateJarApplicationIn ServiceFlinkUpdateJarApplicationRequestBody +type ServiceFlinkUpdateJarApplicationIn struct { + Name string `json:"name"` // Application name +} + +// ServiceFlinkUpdateJarApplicationOut ServiceFlinkUpdateJarApplicationResponse +type ServiceFlinkUpdateJarApplicationOut struct { + ApplicationVersions []ApplicationVersionOut `json:"application_versions"` // JarApplicationVersions + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + CurrentDeployment *CurrentDeploymentOut `json:"current_deployment,omitempty"` // Flink JarApplicationDeployment + Id string `json:"id"` // Application ID + Name string `json:"name"` // Application name + UpdatedAt time.Time `json:"updated_at"` // Updated at + UpdatedBy string `json:"updated_by"` // Updated by +} +type VerifyErrorCodeType int + +const ( + VerifyErrorCodeType1 VerifyErrorCodeType = 1 + VerifyErrorCodeType2 VerifyErrorCodeType = 2 + VerifyErrorCodeType3 VerifyErrorCodeType = 3 +) + +func VerifyErrorCodeTypeChoices() []int { + return []int{1, 2, 3} +} + +// serviceFlinkListJarApplicationsOut ServiceFlinkListJarApplicationsResponse +type serviceFlinkListJarApplicationsOut struct { + Applications []ApplicationOut `json:"applications"` // Flink JarApplications +} diff --git a/handler/flinkjarapplicationdeployment/flinkjarapplicationdeployment.go b/handler/flinkjarapplicationdeployment/flinkjarapplicationdeployment.go new file mode 100644 index 0000000..3523d86 --- /dev/null +++ b/handler/flinkjarapplicationdeployment/flinkjarapplicationdeployment.go @@ -0,0 +1,295 @@ +// Code generated by Aiven. DO NOT EDIT. + +package flinkjarapplicationdeployment + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "time" +) + +type Handler interface { + // ServiceFlinkCancelJarApplicationDeployment [EXPERIMENTAL] Cancel a JarApplicationDeployment + // POST /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment/{deployment_id}/cancel + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkCancelJarApplicationDeployment + ServiceFlinkCancelJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkCancelJarApplicationDeploymentOut, error) + + // ServiceFlinkCreateJarApplicationDeployment [EXPERIMENTAL] Create an JarApplicationDeployment + // POST /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkCreateJarApplicationDeployment + ServiceFlinkCreateJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkCreateJarApplicationDeploymentIn) (*ServiceFlinkCreateJarApplicationDeploymentOut, error) + + // ServiceFlinkDeleteJarApplicationDeployment [EXPERIMENTAL] Delete a JarApplicationDeployment + // DELETE /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment/{deployment_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkDeleteJarApplicationDeployment + ServiceFlinkDeleteJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkDeleteJarApplicationDeploymentOut, error) + + // ServiceFlinkGetJarApplicationDeployment [EXPERIMENTAL] Get a JarApplicationDeployment + // GET /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment/{deployment_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkGetJarApplicationDeployment + ServiceFlinkGetJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkGetJarApplicationDeploymentOut, error) + + // ServiceFlinkListJarApplicationDeployments [EXPERIMENTAL] Get all JarApplicationDeployments + // GET /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkListJarApplicationDeployments + ServiceFlinkListJarApplicationDeployments(ctx context.Context, project string, serviceName string, applicationId string) ([]DeploymentOut, error) + + // ServiceFlinkStopJarApplicationDeployment [EXPERIMENTAL] Stop an JarApplicationDeployment + // POST /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/deployment/{deployment_id}/stop + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkStopJarApplicationDeployment + ServiceFlinkStopJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkStopJarApplicationDeploymentOut, error) +} + +// doer http client +type doer interface { + Do(ctx context.Context, operationID, method, path string, in any, query ...[2]string) ([]byte, error) +} + +func NewHandler(doer doer) FlinkJarApplicationDeploymentHandler { + return FlinkJarApplicationDeploymentHandler{doer} +} + +type FlinkJarApplicationDeploymentHandler struct { + doer doer +} + +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkCancelJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkCancelJarApplicationDeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment/%s/cancel", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) + b, err := h.doer.Do(ctx, "ServiceFlinkCancelJarApplicationDeployment", "POST", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkCancelJarApplicationDeploymentOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkCreateJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, in *ServiceFlinkCreateJarApplicationDeploymentIn) (*ServiceFlinkCreateJarApplicationDeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkCreateJarApplicationDeployment", "POST", path, in) + if err != nil { + return nil, err + } + out := new(ServiceFlinkCreateJarApplicationDeploymentOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkDeleteJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkDeleteJarApplicationDeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) + b, err := h.doer.Do(ctx, "ServiceFlinkDeleteJarApplicationDeployment", "DELETE", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkDeleteJarApplicationDeploymentOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkGetJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkGetJarApplicationDeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) + b, err := h.doer.Do(ctx, "ServiceFlinkGetJarApplicationDeployment", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkGetJarApplicationDeploymentOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkListJarApplicationDeployments(ctx context.Context, project string, serviceName string, applicationId string) ([]DeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkListJarApplicationDeployments", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(serviceFlinkListJarApplicationDeploymentsOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out.Deployments, nil +} +func (h *FlinkJarApplicationDeploymentHandler) ServiceFlinkStopJarApplicationDeployment(ctx context.Context, project string, serviceName string, applicationId string, deploymentId string) (*ServiceFlinkStopJarApplicationDeploymentOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/deployment/%s/stop", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(deploymentId)) + b, err := h.doer.Do(ctx, "ServiceFlinkStopJarApplicationDeployment", "POST", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkStopJarApplicationDeploymentOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} + +type DeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status DeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} +type DeploymentStatusType string + +const ( + DeploymentStatusTypeInitializing DeploymentStatusType = "INITIALIZING" + DeploymentStatusTypeCreated DeploymentStatusType = "CREATED" + DeploymentStatusTypeRunning DeploymentStatusType = "RUNNING" + DeploymentStatusTypeFailing DeploymentStatusType = "FAILING" + DeploymentStatusTypeFailed DeploymentStatusType = "FAILED" + DeploymentStatusTypeSaving DeploymentStatusType = "SAVING" + DeploymentStatusTypeCancellingRequested DeploymentStatusType = "CANCELLING_REQUESTED" + DeploymentStatusTypeCancelling DeploymentStatusType = "CANCELLING" + DeploymentStatusTypeCanceled DeploymentStatusType = "CANCELED" + DeploymentStatusTypeSavingAndStopRequested DeploymentStatusType = "SAVING_AND_STOP_REQUESTED" + DeploymentStatusTypeSavingAndStop DeploymentStatusType = "SAVING_AND_STOP" + DeploymentStatusTypeFinished DeploymentStatusType = "FINISHED" + DeploymentStatusTypeRestarting DeploymentStatusType = "RESTARTING" + DeploymentStatusTypeSuspended DeploymentStatusType = "SUSPENDED" + DeploymentStatusTypeDeleteRequested DeploymentStatusType = "DELETE_REQUESTED" + DeploymentStatusTypeDeleting DeploymentStatusType = "DELETING" + DeploymentStatusTypeReconciling DeploymentStatusType = "RECONCILING" +) + +func DeploymentStatusTypeChoices() []string { + return []string{"INITIALIZING", "CREATED", "RUNNING", "FAILING", "FAILED", "SAVING", "CANCELLING_REQUESTED", "CANCELLING", "CANCELED", "SAVING_AND_STOP_REQUESTED", "SAVING_AND_STOP", "FINISHED", "RESTARTING", "SUSPENDED", "DELETE_REQUESTED", "DELETING", "RECONCILING"} +} + +// ServiceFlinkCancelJarApplicationDeploymentOut ServiceFlinkCancelJarApplicationDeploymentResponse +type ServiceFlinkCancelJarApplicationDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status ServiceFlinkJarApplicationDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} + +// ServiceFlinkCreateJarApplicationDeploymentIn ServiceFlinkCreateJarApplicationDeploymentRequestBody +type ServiceFlinkCreateJarApplicationDeploymentIn struct { + EntryClass *string `json:"entry_class,omitempty"` // Entry class + Parallelism *int `json:"parallelism,omitempty"` // Flink Job parallelism + ProgramArgs *[]string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + RestartEnabled *bool `json:"restart_enabled,omitempty"` // Specifies whether a Flink Job is restarted in case it fails + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + VersionId string `json:"version_id"` // ApplicationVersion ID +} + +// ServiceFlinkCreateJarApplicationDeploymentOut ServiceFlinkCreateJarApplicationDeploymentResponse +type ServiceFlinkCreateJarApplicationDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status ServiceFlinkJarApplicationDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} + +// ServiceFlinkDeleteJarApplicationDeploymentOut ServiceFlinkDeleteJarApplicationDeploymentResponse +type ServiceFlinkDeleteJarApplicationDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status ServiceFlinkJarApplicationDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} + +// ServiceFlinkGetJarApplicationDeploymentOut ServiceFlinkGetJarApplicationDeploymentResponse +type ServiceFlinkGetJarApplicationDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status ServiceFlinkJarApplicationDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} +type ServiceFlinkJarApplicationDeploymentStatusType string + +const ( + ServiceFlinkJarApplicationDeploymentStatusTypeInitializing ServiceFlinkJarApplicationDeploymentStatusType = "INITIALIZING" + ServiceFlinkJarApplicationDeploymentStatusTypeCreated ServiceFlinkJarApplicationDeploymentStatusType = "CREATED" + ServiceFlinkJarApplicationDeploymentStatusTypeRunning ServiceFlinkJarApplicationDeploymentStatusType = "RUNNING" + ServiceFlinkJarApplicationDeploymentStatusTypeFailing ServiceFlinkJarApplicationDeploymentStatusType = "FAILING" + ServiceFlinkJarApplicationDeploymentStatusTypeFailed ServiceFlinkJarApplicationDeploymentStatusType = "FAILED" + ServiceFlinkJarApplicationDeploymentStatusTypeSaving ServiceFlinkJarApplicationDeploymentStatusType = "SAVING" + ServiceFlinkJarApplicationDeploymentStatusTypeCancellingRequested ServiceFlinkJarApplicationDeploymentStatusType = "CANCELLING_REQUESTED" + ServiceFlinkJarApplicationDeploymentStatusTypeCancelling ServiceFlinkJarApplicationDeploymentStatusType = "CANCELLING" + ServiceFlinkJarApplicationDeploymentStatusTypeCanceled ServiceFlinkJarApplicationDeploymentStatusType = "CANCELED" + ServiceFlinkJarApplicationDeploymentStatusTypeSavingAndStopRequested ServiceFlinkJarApplicationDeploymentStatusType = "SAVING_AND_STOP_REQUESTED" + ServiceFlinkJarApplicationDeploymentStatusTypeSavingAndStop ServiceFlinkJarApplicationDeploymentStatusType = "SAVING_AND_STOP" + ServiceFlinkJarApplicationDeploymentStatusTypeFinished ServiceFlinkJarApplicationDeploymentStatusType = "FINISHED" + ServiceFlinkJarApplicationDeploymentStatusTypeRestarting ServiceFlinkJarApplicationDeploymentStatusType = "RESTARTING" + ServiceFlinkJarApplicationDeploymentStatusTypeSuspended ServiceFlinkJarApplicationDeploymentStatusType = "SUSPENDED" + ServiceFlinkJarApplicationDeploymentStatusTypeDeleteRequested ServiceFlinkJarApplicationDeploymentStatusType = "DELETE_REQUESTED" + ServiceFlinkJarApplicationDeploymentStatusTypeDeleting ServiceFlinkJarApplicationDeploymentStatusType = "DELETING" + ServiceFlinkJarApplicationDeploymentStatusTypeReconciling ServiceFlinkJarApplicationDeploymentStatusType = "RECONCILING" +) + +func ServiceFlinkJarApplicationDeploymentStatusTypeChoices() []string { + return []string{"INITIALIZING", "CREATED", "RUNNING", "FAILING", "FAILED", "SAVING", "CANCELLING_REQUESTED", "CANCELLING", "CANCELED", "SAVING_AND_STOP_REQUESTED", "SAVING_AND_STOP", "FINISHED", "RESTARTING", "SUSPENDED", "DELETE_REQUESTED", "DELETING", "RECONCILING"} +} + +// ServiceFlinkStopJarApplicationDeploymentOut ServiceFlinkStopJarApplicationDeploymentResponse +type ServiceFlinkStopJarApplicationDeploymentOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + EntryClass *string `json:"entry_class,omitempty"` // Entry class + ErrorMsg *string `json:"error_msg,omitempty"` // Deployment error + Id string `json:"id"` // Deployment ID + JobId *string `json:"job_id,omitempty"` // Job ID + LastSavepoint *string `json:"last_savepoint,omitempty"` // Job savepoint + Parallelism int `json:"parallelism"` // Flink Job parallelism + ProgramArgs []string `json:"program_args,omitempty"` // Program arguments. Arguments to pass during Flink job submission through the programArgsList parameter + StartingSavepoint *string `json:"starting_savepoint,omitempty"` // Job savepoint + Status ServiceFlinkJarApplicationDeploymentStatusType `json:"status"` // Deployment status + VersionId string `json:"version_id"` // ApplicationVersion ID +} + +// serviceFlinkListJarApplicationDeploymentsOut ServiceFlinkListJarApplicationDeploymentsResponse +type serviceFlinkListJarApplicationDeploymentsOut struct { + Deployments []DeploymentOut `json:"deployments"` // Flink JarApplicationDeployments +} diff --git a/handler/flinkjarapplicationversion/flinkjarapplicationversion.go b/handler/flinkjarapplicationversion/flinkjarapplicationversion.go new file mode 100644 index 0000000..da1cd65 --- /dev/null +++ b/handler/flinkjarapplicationversion/flinkjarapplicationversion.go @@ -0,0 +1,140 @@ +// Code generated by Aiven. DO NOT EDIT. + +package flinkjarapplicationversion + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "time" +) + +type Handler interface { + // ServiceFlinkCreateJarApplicationVersion [EXPERIMENTAL] Create a Flink JarApplicationVersion + // POST /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/version + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkCreateJarApplicationVersion + ServiceFlinkCreateJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkCreateJarApplicationVersionOut, error) + + // ServiceFlinkDeleteJarApplicationVersion [EXPERIMENTAL] Delete a Flink JarApplicationVersion + // DELETE /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/version/{application_version_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkDeleteJarApplicationVersion + ServiceFlinkDeleteJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkDeleteJarApplicationVersionOut, error) + + // ServiceFlinkGetJarApplicationVersion [EXPERIMENTAL] Get a Flink JarApplicationVersion + // GET /v1/project/{project}/service/{service_name}/flink/jar_application/{application_id}/version/{application_version_id} + // https://api.aiven.io/doc/#tag/Service:_Flink/operation/ServiceFlinkGetJarApplicationVersion + ServiceFlinkGetJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkGetJarApplicationVersionOut, error) +} + +// doer http client +type doer interface { + Do(ctx context.Context, operationID, method, path string, in any, query ...[2]string) ([]byte, error) +} + +func NewHandler(doer doer) FlinkJarApplicationVersionHandler { + return FlinkJarApplicationVersionHandler{doer} +} + +type FlinkJarApplicationVersionHandler struct { + doer doer +} + +func (h *FlinkJarApplicationVersionHandler) ServiceFlinkCreateJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string) (*ServiceFlinkCreateJarApplicationVersionOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/version", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId)) + b, err := h.doer.Do(ctx, "ServiceFlinkCreateJarApplicationVersion", "POST", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkCreateJarApplicationVersionOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationVersionHandler) ServiceFlinkDeleteJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkDeleteJarApplicationVersionOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/version/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(applicationVersionId)) + b, err := h.doer.Do(ctx, "ServiceFlinkDeleteJarApplicationVersion", "DELETE", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkDeleteJarApplicationVersionOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} +func (h *FlinkJarApplicationVersionHandler) ServiceFlinkGetJarApplicationVersion(ctx context.Context, project string, serviceName string, applicationId string, applicationVersionId string) (*ServiceFlinkGetJarApplicationVersionOut, error) { + path := fmt.Sprintf("/v1/project/%s/service/%s/flink/jar_application/%s/version/%s", url.PathEscape(project), url.PathEscape(serviceName), url.PathEscape(applicationId), url.PathEscape(applicationVersionId)) + b, err := h.doer.Do(ctx, "ServiceFlinkGetJarApplicationVersion", "GET", path, nil) + if err != nil { + return nil, err + } + out := new(ServiceFlinkGetJarApplicationVersionOut) + err = json.Unmarshal(b, out) + if err != nil { + return nil, err + } + return out, nil +} + +// FileInfoOut Flink JarApplicationVersion FileInfo +type FileInfoOut struct { + FileSha256 *string `json:"file_sha256,omitempty"` // sha256 of the file if known + FileSize *int `json:"file_size,omitempty"` // The size of the file in bytes + FileStatus FileStatusType `json:"file_status,omitempty"` // File status + Url *string `json:"url,omitempty"` // AWS s3 pre-signed url + VerifyErrorCode VerifyErrorCodeType `json:"verify_error_code,omitempty"` // Verify error code + VerifyErrorMessage *string `json:"verify_error_message,omitempty"` // Verify error message +} +type FileStatusType string + +const ( + FileStatusTypeInitial FileStatusType = "INITIAL" + FileStatusTypeReady FileStatusType = "READY" + FileStatusTypeFailed FileStatusType = "FAILED" +) + +func FileStatusTypeChoices() []string { + return []string{"INITIAL", "READY", "FAILED"} +} + +// ServiceFlinkCreateJarApplicationVersionOut ServiceFlinkCreateJarApplicationVersionResponse +type ServiceFlinkCreateJarApplicationVersionOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + FileInfo *FileInfoOut `json:"file_info,omitempty"` // Flink JarApplicationVersion FileInfo + Id string `json:"id"` // ApplicationVersion ID + Version int `json:"version"` // Version number +} + +// ServiceFlinkDeleteJarApplicationVersionOut ServiceFlinkDeleteJarApplicationVersionResponse +type ServiceFlinkDeleteJarApplicationVersionOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + FileInfo *FileInfoOut `json:"file_info,omitempty"` // Flink JarApplicationVersion FileInfo + Id string `json:"id"` // ApplicationVersion ID + Version int `json:"version"` // Version number +} + +// ServiceFlinkGetJarApplicationVersionOut ServiceFlinkGetJarApplicationVersionResponse +type ServiceFlinkGetJarApplicationVersionOut struct { + CreatedAt time.Time `json:"created_at"` // Created at + CreatedBy string `json:"created_by"` // Created by + FileInfo *FileInfoOut `json:"file_info,omitempty"` // Flink JarApplicationVersion FileInfo + Id string `json:"id"` // ApplicationVersion ID + Version int `json:"version"` // Version number +} +type VerifyErrorCodeType int + +const ( + VerifyErrorCodeType1 VerifyErrorCodeType = 1 + VerifyErrorCodeType2 VerifyErrorCodeType = 2 + VerifyErrorCodeType3 VerifyErrorCodeType = 3 +) + +func VerifyErrorCodeTypeChoices() []int { + return []int{1, 2, 3} +}