emrserverless

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package emrserverless provides the EMR Serverless service implementation.

Index

Constants

View Source
const (
	ApplicationStateCreating   = "CREATING"
	ApplicationStateCreated    = "CREATED"
	ApplicationStateStarting   = "STARTING"
	ApplicationStateStarted    = "STARTED"
	ApplicationStateStopping   = "STOPPING"
	ApplicationStateStopped    = "STOPPED"
	ApplicationStateTerminated = "TERMINATED"
)

Application states.

View Source
const (
	JobRunStateSubmitted  = "SUBMITTED"
	JobRunStatePending    = "PENDING"
	JobRunStateScheduled  = "SCHEDULED"
	JobRunStateRunning    = "RUNNING"
	JobRunStateSuccess    = "SUCCESS"
	JobRunStateFailed     = "FAILED"
	JobRunStateCancelling = "CANCELLING"
	JobRunStateCancelled  = "CANCELLED"
	JobRunStateQueued     = "QUEUED"
)

JobRun states.

View Source
const (
	JobRunModeBatch     = "BATCH"
	JobRunModeStreaming = "STREAMING"
)

JobRun modes.

View Source
const (
	ArchitectureARM64 = "ARM64"
	ArchitectureX8664 = "X86_64"
)

Architecture types.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSTimestamp

type AWSTimestamp struct {
	time.Time
}

AWSTimestamp wraps time.Time for AWS-style JSON serialization (Unix epoch float64).

func (AWSTimestamp) MarshalJSON

func (t AWSTimestamp) MarshalJSON() ([]byte, error)

MarshalJSON serializes time to Unix epoch float64.

func (*AWSTimestamp) UnmarshalJSON

func (t *AWSTimestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes Unix epoch float64 to time.Time.

type Application

type Application struct {
	ApplicationID           string                      `json:"applicationId"`
	Arn                     string                      `json:"arn"`
	Name                    string                      `json:"name,omitempty"`
	Type                    string                      `json:"type"`
	ReleaseLabel            string                      `json:"releaseLabel"`
	State                   string                      `json:"state"`
	StateDetails            string                      `json:"stateDetails,omitempty"`
	Architecture            string                      `json:"architecture,omitempty"`
	InitialCapacity         map[string]*InitialCapacity `json:"initialCapacity,omitempty"`
	MaximumCapacity         *MaximumCapacity            `json:"maximumCapacity,omitempty"`
	AutoStartConfiguration  *AutoStartConfiguration     `json:"autoStartConfiguration,omitempty"`
	AutoStopConfiguration   *AutoStopConfiguration      `json:"autoStopConfiguration,omitempty"`
	NetworkConfiguration    *NetworkConfiguration       `json:"networkConfiguration,omitempty"`
	MonitoringConfiguration *MonitoringConfiguration    `json:"monitoringConfiguration,omitempty"`
	Tags                    map[string]string           `json:"tags,omitempty"`
	CreatedAt               AWSTimestamp                `json:"createdAt"`
	UpdatedAt               AWSTimestamp                `json:"updatedAt"`
}

Application represents an EMR Serverless application.

type ApplicationSummary

type ApplicationSummary struct {
	ApplicationID string       `json:"id"`
	Arn           string       `json:"arn"`
	Name          string       `json:"name,omitempty"`
	Type          string       `json:"type"`
	ReleaseLabel  string       `json:"releaseLabel"`
	State         string       `json:"state"`
	StateDetails  string       `json:"stateDetails,omitempty"`
	Architecture  string       `json:"architecture,omitempty"`
	CreatedAt     AWSTimestamp `json:"createdAt"`
	UpdatedAt     AWSTimestamp `json:"updatedAt"`
}

ApplicationSummary represents a summary of an EMR Serverless application.

type AutoStartConfiguration

type AutoStartConfiguration struct {
	Enabled bool `json:"enabled"`
}

AutoStartConfiguration represents auto start configuration.

type AutoStopConfiguration

type AutoStopConfiguration struct {
	Enabled            bool  `json:"enabled"`
	IdleTimeoutMinutes int32 `json:"idleTimeoutMinutes,omitempty"`
}

AutoStopConfiguration represents auto stop configuration.

type CancelJobRunOutput

type CancelJobRunOutput struct {
	ApplicationID string `json:"applicationId"`
	JobRunID      string `json:"jobRunId"`
}

CancelJobRunOutput represents the output for CancelJobRun.

type CloudWatchLoggingConfiguration

type CloudWatchLoggingConfiguration struct {
	Enabled             bool                `json:"enabled"`
	LogGroupName        string              `json:"logGroupName,omitempty"`
	LogStreamNamePrefix string              `json:"logStreamNamePrefix,omitempty"`
	EncryptionKeyArn    string              `json:"encryptionKeyArn,omitempty"`
	LogTypes            map[string][]string `json:"logTypes,omitempty"`
}

CloudWatchLoggingConfiguration represents CloudWatch logging configuration.

type Configuration

type Configuration struct {
	Classification string            `json:"classification"`
	Properties     map[string]string `json:"properties,omitempty"`
	Configurations []*Configuration  `json:"configurations,omitempty"`
}

Configuration represents a configuration entry.

type ConfigurationOverrides

type ConfigurationOverrides struct {
	ApplicationConfiguration []*Configuration         `json:"applicationConfiguration,omitempty"`
	MonitoringConfiguration  *MonitoringConfiguration `json:"monitoringConfiguration,omitempty"`
}

ConfigurationOverrides represents configuration overrides.

type CreateApplicationInput

type CreateApplicationInput struct {
	Name                    string                      `json:"name,omitempty"`
	Type                    string                      `json:"type"`
	ReleaseLabel            string                      `json:"releaseLabel"`
	Architecture            string                      `json:"architecture,omitempty"`
	ClientToken             string                      `json:"clientToken,omitempty"`
	InitialCapacity         map[string]*InitialCapacity `json:"initialCapacity,omitempty"`
	MaximumCapacity         *MaximumCapacity            `json:"maximumCapacity,omitempty"`
	AutoStartConfiguration  *AutoStartConfiguration     `json:"autoStartConfiguration,omitempty"`
	AutoStopConfiguration   *AutoStopConfiguration      `json:"autoStopConfiguration,omitempty"`
	NetworkConfiguration    *NetworkConfiguration       `json:"networkConfiguration,omitempty"`
	MonitoringConfiguration *MonitoringConfiguration    `json:"monitoringConfiguration,omitempty"`
	Tags                    map[string]string           `json:"tags,omitempty"`
}

CreateApplicationInput represents the input for CreateApplication.

type CreateApplicationOutput

type CreateApplicationOutput struct {
	ApplicationID string `json:"applicationId"`
	Arn           string `json:"arn"`
	Name          string `json:"name,omitempty"`
}

CreateApplicationOutput represents the output for CreateApplication.

type Error

type Error struct {
	Code    string
	Message string
}

Error represents an EMR Serverless service error.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface.

func (*Error) ErrorCode

func (e *Error) ErrorCode() string

ErrorCode returns the error code.

func (*Error) HTTPStatusCode

func (e *Error) HTTPStatusCode() int

HTTPStatusCode returns the HTTP status code for the error.

type ErrorResponse

type ErrorResponse struct {
	Type    string `json:"__type"`
	Message string `json:"message"`
}

ErrorResponse represents an AWS error response.

type GetApplicationOutput

type GetApplicationOutput struct {
	Application *Application `json:"application"`
}

GetApplicationOutput represents the output for GetApplication.

type GetJobRunOutput

type GetJobRunOutput struct {
	JobRun *JobRun `json:"jobRun"`
}

GetJobRunOutput represents the output for GetJobRun.

type Hive

type Hive struct {
	Query         string `json:"query"`
	InitQueryFile string `json:"initQueryFile,omitempty"`
	Parameters    string `json:"parameters,omitempty"`
}

Hive represents Hive job configuration.

type InitialCapacity

type InitialCapacity struct {
	WorkerCount         int64                `json:"workerCount"`
	WorkerConfiguration *WorkerConfiguration `json:"workerConfiguration,omitempty"`
}

InitialCapacity represents initial capacity configuration.

type JobDriver

type JobDriver struct {
	SparkSubmit *SparkSubmit `json:"sparkSubmit,omitempty"`
	Hive        *Hive        `json:"hive,omitempty"`
}

JobDriver represents the job driver configuration.

type JobRun

type JobRun struct {
	ApplicationID                 string                    `json:"applicationId"`
	JobRunID                      string                    `json:"jobRunId"`
	Arn                           string                    `json:"arn"`
	Name                          string                    `json:"name,omitempty"`
	State                         string                    `json:"state"`
	StateDetails                  string                    `json:"stateDetails,omitempty"`
	Mode                          string                    `json:"mode,omitempty"`
	ReleaseLabel                  string                    `json:"releaseLabel"`
	ExecutionRole                 string                    `json:"executionRole"`
	JobDriver                     *JobDriver                `json:"jobDriver"`
	ConfigurationOverrides        *ConfigurationOverrides   `json:"configurationOverrides,omitempty"`
	Tags                          map[string]string         `json:"tags,omitempty"`
	TotalResourceUtilization      *TotalResourceUtilization `json:"totalResourceUtilization,omitempty"`
	TotalExecutionDurationSeconds int64                     `json:"totalExecutionDurationSeconds,omitempty"`
	ExecutionTimeoutMinutes       int64                     `json:"executionTimeoutMinutes,omitempty"`
	CreatedAt                     AWSTimestamp              `json:"createdAt"`
	UpdatedAt                     AWSTimestamp              `json:"updatedAt"`
	CreatedBy                     string                    `json:"createdBy"`
}

JobRun represents an EMR Serverless job run.

type JobRunSummary

type JobRunSummary struct {
	ApplicationID string       `json:"applicationId"`
	JobRunID      string       `json:"id"`
	Arn           string       `json:"arn"`
	Name          string       `json:"name,omitempty"`
	State         string       `json:"state"`
	StateDetails  string       `json:"stateDetails,omitempty"`
	Mode          string       `json:"mode,omitempty"`
	ReleaseLabel  string       `json:"releaseLabel"`
	Type          string       `json:"type,omitempty"`
	CreatedAt     AWSTimestamp `json:"createdAt"`
	UpdatedAt     AWSTimestamp `json:"updatedAt"`
	CreatedBy     string       `json:"createdBy"`
}

JobRunSummary represents a summary of a job run.

type ListApplicationsInput

type ListApplicationsInput struct {
	MaxResults int32    `json:"maxResults,omitempty"`
	NextToken  string   `json:"nextToken,omitempty"`
	States     []string `json:"states,omitempty"`
}

ListApplicationsInput represents the input for ListApplications.

type ListApplicationsOutput

type ListApplicationsOutput struct {
	Applications []*ApplicationSummary `json:"applications"`
	NextToken    string                `json:"nextToken,omitempty"`
}

ListApplicationsOutput represents the output for ListApplications.

type ListJobRunsInput

type ListJobRunsInput struct {
	ApplicationID   string   `json:"-"`
	MaxResults      int32    `json:"maxResults,omitempty"`
	NextToken       string   `json:"nextToken,omitempty"`
	States          []string `json:"states,omitempty"`
	Mode            string   `json:"mode,omitempty"`
	CreatedAtBefore string   `json:"createdAtBefore,omitempty"`
	CreatedAtAfter  string   `json:"createdAtAfter,omitempty"`
}

ListJobRunsInput represents the input for ListJobRuns.

type ListJobRunsOutput

type ListJobRunsOutput struct {
	JobRuns   []*JobRunSummary `json:"jobRuns"`
	NextToken string           `json:"nextToken,omitempty"`
}

ListJobRunsOutput represents the output for ListJobRuns.

type ManagedPersistenceMonitoringConfiguration

type ManagedPersistenceMonitoringConfiguration struct {
	Enabled          bool   `json:"enabled"`
	EncryptionKeyArn string `json:"encryptionKeyArn,omitempty"`
}

ManagedPersistenceMonitoringConfiguration represents managed persistence monitoring.

type MaximumCapacity

type MaximumCapacity struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
	Disk   string `json:"disk,omitempty"`
}

MaximumCapacity represents maximum capacity configuration.

type MemoryStorage

type MemoryStorage struct {
	Applications map[string]*Application       `json:"applications"`
	JobRuns      map[string]map[string]*JobRun `json:"jobRuns"`
	// contains filtered or unexported fields
}

MemoryStorage implements the Storage interface using in-memory storage.

func NewMemoryStorage

func NewMemoryStorage(opts ...Option) *MemoryStorage

NewMemoryStorage creates a new MemoryStorage.

func (*MemoryStorage) CancelJobRun

func (m *MemoryStorage) CancelJobRun(_ context.Context, applicationID, jobRunID string) (*JobRun, error)

CancelJobRun cancels a job run.

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

Close saves the storage state to disk if persistence is enabled.

func (*MemoryStorage) CreateApplication

func (m *MemoryStorage) CreateApplication(_ context.Context, req *CreateApplicationInput) (*Application, error)

CreateApplication creates a new application.

func (*MemoryStorage) DeleteApplication

func (m *MemoryStorage) DeleteApplication(_ context.Context, applicationID string) error

DeleteApplication deletes an application.

func (*MemoryStorage) GetApplication

func (m *MemoryStorage) GetApplication(_ context.Context, applicationID string) (*Application, error)

GetApplication retrieves an application by ID.

func (*MemoryStorage) GetJobRun

func (m *MemoryStorage) GetJobRun(_ context.Context, applicationID, jobRunID string) (*JobRun, error)

GetJobRun retrieves a job run by ID.

func (*MemoryStorage) ListApplications

ListApplications lists applications with optional filters.

func (*MemoryStorage) ListJobRuns

ListJobRuns lists job runs with optional filters.

func (*MemoryStorage) MarshalJSON

func (m *MemoryStorage) MarshalJSON() ([]byte, error)

MarshalJSON serializes the storage state to JSON.

func (*MemoryStorage) StartApplication

func (m *MemoryStorage) StartApplication(_ context.Context, applicationID string) error

StartApplication starts an application.

func (*MemoryStorage) StartJobRun

func (m *MemoryStorage) StartJobRun(_ context.Context, req *StartJobRunInput) (*JobRun, error)

StartJobRun starts a new job run.

func (*MemoryStorage) StopApplication

func (m *MemoryStorage) StopApplication(_ context.Context, applicationID string) error

StopApplication stops an application.

func (*MemoryStorage) UnmarshalJSON

func (m *MemoryStorage) UnmarshalJSON(data []byte) error

UnmarshalJSON restores the storage state from JSON.

func (*MemoryStorage) UpdateApplication

func (m *MemoryStorage) UpdateApplication(_ context.Context, req *UpdateApplicationInput) (*Application, error)

UpdateApplication updates an existing application.

type MonitoringConfiguration

type MonitoringConfiguration struct {
	S3MonitoringConfiguration                 *S3MonitoringConfiguration                 `json:"s3MonitoringConfiguration,omitempty"`
	ManagedPersistenceMonitoringConfiguration *ManagedPersistenceMonitoringConfiguration `json:"managedPersistenceMonitoringConfiguration,omitempty"`
	CloudWatchLoggingConfiguration            *CloudWatchLoggingConfiguration            `json:"cloudWatchLoggingConfiguration,omitempty"`
}

MonitoringConfiguration represents monitoring configuration.

type NetworkConfiguration

type NetworkConfiguration struct {
	SubnetIDs        []string `json:"subnetIds,omitempty"`
	SecurityGroupIDs []string `json:"securityGroupIds,omitempty"`
}

NetworkConfiguration represents network configuration.

type Option

type Option func(*MemoryStorage)

Option is a configuration option for MemoryStorage.

func WithDataDir

func WithDataDir(dir string) Option

WithDataDir enables persistent storage in the specified directory.

type S3MonitoringConfiguration

type S3MonitoringConfiguration struct {
	LogURI           string `json:"logUri,omitempty"`
	EncryptionKeyArn string `json:"encryptionKeyArn,omitempty"`
}

S3MonitoringConfiguration represents S3 monitoring configuration.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements the EMR Serverless service.

func New

func New(storage Storage) *Service

New creates a new EMR Serverless service.

func (*Service) CancelJobRun

func (s *Service) CancelJobRun(w http.ResponseWriter, r *http.Request)

CancelJobRun handles the CancelJobRun API operation.

func (*Service) Close

func (s *Service) Close() error

Close saves the storage state if persistence is enabled.

func (*Service) CreateApplication

func (s *Service) CreateApplication(w http.ResponseWriter, r *http.Request)

CreateApplication handles the CreateApplication API operation.

func (*Service) DeleteApplication

func (s *Service) DeleteApplication(w http.ResponseWriter, r *http.Request)

DeleteApplication handles the DeleteApplication API operation.

func (*Service) GetApplication

func (s *Service) GetApplication(w http.ResponseWriter, r *http.Request)

GetApplication handles the GetApplication API operation.

func (*Service) GetJobRun

func (s *Service) GetJobRun(w http.ResponseWriter, r *http.Request)

GetJobRun handles the GetJobRun API operation.

func (*Service) ListApplications

func (s *Service) ListApplications(w http.ResponseWriter, r *http.Request)

ListApplications handles the ListApplications API operation.

func (*Service) ListJobRuns

func (s *Service) ListJobRuns(w http.ResponseWriter, r *http.Request)

ListJobRuns handles the ListJobRuns API operation.

func (*Service) Meta

func (s *Service) Meta() service.Meta

Meta returns the service's documentation metadata.

func (*Service) Name

func (s *Service) Name() string

Name returns the service name.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r service.Router)

RegisterRoutes registers the service routes.

func (*Service) StartApplication

func (s *Service) StartApplication(w http.ResponseWriter, r *http.Request)

StartApplication handles the StartApplication API operation.

func (*Service) StartJobRun

func (s *Service) StartJobRun(w http.ResponseWriter, r *http.Request)

StartJobRun handles the StartJobRun API operation.

func (*Service) StopApplication

func (s *Service) StopApplication(w http.ResponseWriter, r *http.Request)

StopApplication handles the StopApplication API operation.

func (*Service) UpdateApplication

func (s *Service) UpdateApplication(w http.ResponseWriter, r *http.Request)

UpdateApplication handles the UpdateApplication API operation.

type SparkSubmit

type SparkSubmit struct {
	EntryPoint            string   `json:"entryPoint"`
	EntryPointArguments   []string `json:"entryPointArguments,omitempty"`
	SparkSubmitParameters string   `json:"sparkSubmitParameters,omitempty"`
}

SparkSubmit represents Spark submit configuration.

type StartJobRunInput

type StartJobRunInput struct {
	ApplicationID           string                  `json:"-"`
	ClientToken             string                  `json:"clientToken,omitempty"`
	Name                    string                  `json:"name,omitempty"`
	ExecutionRoleArn        string                  `json:"executionRoleArn"`
	JobDriver               *JobDriver              `json:"jobDriver"`
	ConfigurationOverrides  *ConfigurationOverrides `json:"configurationOverrides,omitempty"`
	Tags                    map[string]string       `json:"tags,omitempty"`
	ExecutionTimeoutMinutes int64                   `json:"executionTimeoutMinutes,omitempty"`
	Mode                    string                  `json:"mode,omitempty"`
}

StartJobRunInput represents the input for StartJobRun.

type StartJobRunOutput

type StartJobRunOutput struct {
	ApplicationID string `json:"applicationId"`
	JobRunID      string `json:"jobRunId"`
	Arn           string `json:"arn"`
}

StartJobRunOutput represents the output for StartJobRun.

type Storage

type Storage interface {
	// Application operations.
	CreateApplication(ctx context.Context, req *CreateApplicationInput) (*Application, error)
	GetApplication(ctx context.Context, applicationID string) (*Application, error)
	ListApplications(ctx context.Context, req *ListApplicationsInput) (*ListApplicationsOutput, error)
	UpdateApplication(ctx context.Context, req *UpdateApplicationInput) (*Application, error)
	DeleteApplication(ctx context.Context, applicationID string) error
	StartApplication(ctx context.Context, applicationID string) error
	StopApplication(ctx context.Context, applicationID string) error

	// Job run operations.
	StartJobRun(ctx context.Context, req *StartJobRunInput) (*JobRun, error)
	GetJobRun(ctx context.Context, applicationID, jobRunID string) (*JobRun, error)
	ListJobRuns(ctx context.Context, req *ListJobRunsInput) (*ListJobRunsOutput, error)
	CancelJobRun(ctx context.Context, applicationID, jobRunID string) (*JobRun, error)
}

Storage defines the interface for EMR Serverless storage operations.

type TotalResourceUtilization

type TotalResourceUtilization struct {
	VCPUHour      float64 `json:"vCPUHour,omitempty"`
	MemoryGBHour  float64 `json:"memoryGBHour,omitempty"`
	StorageGBHour float64 `json:"storageGBHour,omitempty"`
}

TotalResourceUtilization represents resource utilization.

type UpdateApplicationInput

type UpdateApplicationInput struct {
	ApplicationID           string                      `json:"-"`
	Architecture            string                      `json:"architecture,omitempty"`
	AutoStartConfiguration  *AutoStartConfiguration     `json:"autoStartConfiguration,omitempty"`
	AutoStopConfiguration   *AutoStopConfiguration      `json:"autoStopConfiguration,omitempty"`
	InitialCapacity         map[string]*InitialCapacity `json:"initialCapacity,omitempty"`
	MaximumCapacity         *MaximumCapacity            `json:"maximumCapacity,omitempty"`
	NetworkConfiguration    *NetworkConfiguration       `json:"networkConfiguration,omitempty"`
	MonitoringConfiguration *MonitoringConfiguration    `json:"monitoringConfiguration,omitempty"`
	ReleaseLabel            string                      `json:"releaseLabel,omitempty"`
}

UpdateApplicationInput represents the input for UpdateApplication.

type UpdateApplicationOutput

type UpdateApplicationOutput struct {
	Application *Application `json:"application"`
}

UpdateApplicationOutput represents the output for UpdateApplication.

type WorkerConfiguration

type WorkerConfiguration struct {
	CPU    string `json:"cpu"`
	Memory string `json:"memory"`
	Disk   string `json:"disk,omitempty"`
}

WorkerConfiguration represents worker configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL