feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
// ABOUTME: Core type definitions for EdgeXR Master Controller SDK
|
|
|
|
|
// ABOUTME: These types are based on the swagger API specification and existing client patterns
|
|
|
|
|
|
2025-09-29 09:41:44 +02:00
|
|
|
package edgeconnect
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
|
2025-09-25 15:32:07 +02:00
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"fmt"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
|
2025-09-30 12:09:00 +02:00
|
|
|
// App field constants for partial updates (based on EdgeXR API specification)
|
|
|
|
|
const (
|
|
|
|
|
AppFieldKey = "2"
|
|
|
|
|
AppFieldKeyOrganization = "2.1"
|
|
|
|
|
AppFieldKeyName = "2.2"
|
|
|
|
|
AppFieldKeyVersion = "2.3"
|
|
|
|
|
AppFieldImagePath = "4"
|
|
|
|
|
AppFieldImageType = "5"
|
|
|
|
|
AppFieldAccessPorts = "7"
|
|
|
|
|
AppFieldDefaultFlavor = "9"
|
|
|
|
|
AppFieldDefaultFlavorName = "9.1"
|
|
|
|
|
AppFieldAuthPublicKey = "12"
|
|
|
|
|
AppFieldCommand = "13"
|
|
|
|
|
AppFieldAnnotations = "14"
|
|
|
|
|
AppFieldDeployment = "15"
|
|
|
|
|
AppFieldDeploymentManifest = "16"
|
|
|
|
|
AppFieldDeploymentGenerator = "17"
|
|
|
|
|
AppFieldAndroidPackageName = "18"
|
|
|
|
|
AppFieldDelOpt = "20"
|
|
|
|
|
AppFieldConfigs = "21"
|
|
|
|
|
AppFieldConfigsKind = "21.1"
|
|
|
|
|
AppFieldConfigsConfig = "21.2"
|
|
|
|
|
AppFieldScaleWithCluster = "22"
|
|
|
|
|
AppFieldInternalPorts = "23"
|
|
|
|
|
AppFieldRevision = "24"
|
|
|
|
|
AppFieldOfficialFqdn = "25"
|
|
|
|
|
AppFieldMd5Sum = "26"
|
|
|
|
|
AppFieldAutoProvPolicy = "28"
|
|
|
|
|
AppFieldAccessType = "29"
|
|
|
|
|
AppFieldDeletePrepare = "31"
|
|
|
|
|
AppFieldAutoProvPolicies = "32"
|
|
|
|
|
AppFieldTemplateDelimiter = "33"
|
|
|
|
|
AppFieldSkipHcPorts = "34"
|
|
|
|
|
AppFieldCreatedAt = "35"
|
|
|
|
|
AppFieldCreatedAtSeconds = "35.1"
|
|
|
|
|
AppFieldCreatedAtNanos = "35.2"
|
|
|
|
|
AppFieldUpdatedAt = "36"
|
|
|
|
|
AppFieldUpdatedAtSeconds = "36.1"
|
|
|
|
|
AppFieldUpdatedAtNanos = "36.2"
|
|
|
|
|
AppFieldTrusted = "37"
|
|
|
|
|
AppFieldRequiredOutboundConnections = "38"
|
|
|
|
|
AppFieldAllowServerless = "39"
|
|
|
|
|
AppFieldServerlessConfig = "40"
|
|
|
|
|
AppFieldVmAppOsType = "41"
|
|
|
|
|
AppFieldAlertPolicies = "42"
|
|
|
|
|
AppFieldQosSessionProfile = "43"
|
|
|
|
|
AppFieldQosSessionDuration = "44"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// AppInstance field constants for partial updates (based on EdgeXR API specification)
|
|
|
|
|
const (
|
2025-11-14 16:00:43 +01:00
|
|
|
AppInstFieldKey = "2"
|
|
|
|
|
AppInstFieldKeyAppKey = "2.1"
|
|
|
|
|
AppInstFieldKeyAppKeyOrganization = "2.1.1"
|
|
|
|
|
AppInstFieldKeyAppKeyName = "2.1.2"
|
|
|
|
|
AppInstFieldKeyAppKeyVersion = "2.1.3"
|
|
|
|
|
AppInstFieldKeyClusterInstKey = "2.4"
|
|
|
|
|
AppInstFieldKeyClusterInstKeyClusterKey = "2.4.1"
|
|
|
|
|
AppInstFieldKeyClusterInstKeyClusterKeyName = "2.4.1.1"
|
|
|
|
|
AppInstFieldKeyClusterInstKeyCloudletKey = "2.4.2"
|
|
|
|
|
AppInstFieldKeyClusterInstKeyCloudletKeyOrganization = "2.4.2.1"
|
|
|
|
|
AppInstFieldKeyClusterInstKeyCloudletKeyName = "2.4.2.2"
|
2025-09-30 12:09:00 +02:00
|
|
|
AppInstFieldKeyClusterInstKeyCloudletKeyFederatedOrganization = "2.4.2.3"
|
2025-11-14 16:00:43 +01:00
|
|
|
AppInstFieldKeyClusterInstKeyOrganization = "2.4.3"
|
|
|
|
|
AppInstFieldCloudletLoc = "3"
|
|
|
|
|
AppInstFieldCloudletLocLatitude = "3.1"
|
|
|
|
|
AppInstFieldCloudletLocLongitude = "3.2"
|
|
|
|
|
AppInstFieldCloudletLocHorizontalAccuracy = "3.3"
|
|
|
|
|
AppInstFieldCloudletLocVerticalAccuracy = "3.4"
|
|
|
|
|
AppInstFieldCloudletLocAltitude = "3.5"
|
|
|
|
|
AppInstFieldCloudletLocCourse = "3.6"
|
|
|
|
|
AppInstFieldCloudletLocSpeed = "3.7"
|
|
|
|
|
AppInstFieldCloudletLocTimestamp = "3.8"
|
|
|
|
|
AppInstFieldCloudletLocTimestampSeconds = "3.8.1"
|
|
|
|
|
AppInstFieldCloudletLocTimestampNanos = "3.8.2"
|
|
|
|
|
AppInstFieldUri = "4"
|
|
|
|
|
AppInstFieldLiveness = "6"
|
|
|
|
|
AppInstFieldMappedPorts = "9"
|
|
|
|
|
AppInstFieldMappedPortsProto = "9.1"
|
|
|
|
|
AppInstFieldMappedPortsInternalPort = "9.2"
|
|
|
|
|
AppInstFieldMappedPortsPublicPort = "9.3"
|
|
|
|
|
AppInstFieldMappedPortsFqdnPrefix = "9.5"
|
|
|
|
|
AppInstFieldMappedPortsEndPort = "9.6"
|
|
|
|
|
AppInstFieldMappedPortsTls = "9.7"
|
|
|
|
|
AppInstFieldMappedPortsNginx = "9.8"
|
|
|
|
|
AppInstFieldMappedPortsMaxPktSize = "9.9"
|
|
|
|
|
AppInstFieldFlavor = "12"
|
|
|
|
|
AppInstFieldFlavorName = "12.1"
|
|
|
|
|
AppInstFieldState = "14"
|
|
|
|
|
AppInstFieldErrors = "15"
|
|
|
|
|
AppInstFieldCrmOverride = "16"
|
|
|
|
|
AppInstFieldRuntimeInfo = "17"
|
|
|
|
|
AppInstFieldRuntimeInfoContainerIds = "17.1"
|
|
|
|
|
AppInstFieldCreatedAt = "21"
|
|
|
|
|
AppInstFieldCreatedAtSeconds = "21.1"
|
|
|
|
|
AppInstFieldCreatedAtNanos = "21.2"
|
|
|
|
|
AppInstFieldAutoClusterIpAccess = "22"
|
|
|
|
|
AppInstFieldRevision = "24"
|
|
|
|
|
AppInstFieldForceUpdate = "25"
|
|
|
|
|
AppInstFieldUpdateMultiple = "26"
|
|
|
|
|
AppInstFieldConfigs = "27"
|
|
|
|
|
AppInstFieldConfigsKind = "27.1"
|
|
|
|
|
AppInstFieldConfigsConfig = "27.2"
|
|
|
|
|
AppInstFieldHealthCheck = "29"
|
|
|
|
|
AppInstFieldPowerState = "31"
|
|
|
|
|
AppInstFieldExternalVolumeSize = "32"
|
|
|
|
|
AppInstFieldAvailabilityZone = "33"
|
|
|
|
|
AppInstFieldVmFlavor = "34"
|
|
|
|
|
AppInstFieldOptRes = "35"
|
|
|
|
|
AppInstFieldUpdatedAt = "36"
|
|
|
|
|
AppInstFieldUpdatedAtSeconds = "36.1"
|
|
|
|
|
AppInstFieldUpdatedAtNanos = "36.2"
|
|
|
|
|
AppInstFieldRealClusterName = "37"
|
|
|
|
|
AppInstFieldInternalPortToLbIp = "38"
|
|
|
|
|
AppInstFieldInternalPortToLbIpKey = "38.1"
|
|
|
|
|
AppInstFieldInternalPortToLbIpValue = "38.2"
|
|
|
|
|
AppInstFieldDedicatedIp = "39"
|
|
|
|
|
AppInstFieldUniqueId = "40"
|
|
|
|
|
AppInstFieldDnsLabel = "41"
|
2025-09-30 12:09:00 +02:00
|
|
|
)
|
|
|
|
|
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
// Message interface for types that can provide error messages
|
|
|
|
|
type Message interface {
|
|
|
|
|
GetMessage() string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Base message type for API responses
|
|
|
|
|
type msg struct {
|
|
|
|
|
Message string `json:"message,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m msg) GetMessage() string {
|
|
|
|
|
return m.Message
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppKey uniquely identifies an application
|
|
|
|
|
type AppKey struct {
|
|
|
|
|
Organization string `json:"organization"`
|
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CloudletKey uniquely identifies a cloudlet
|
|
|
|
|
type CloudletKey struct {
|
|
|
|
|
Organization string `json:"organization"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppInstanceKey uniquely identifies an application instance
|
|
|
|
|
type AppInstanceKey struct {
|
|
|
|
|
Organization string `json:"organization"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
CloudletKey CloudletKey `json:"cloudlet_key"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flavor defines resource allocation for instances
|
|
|
|
|
type Flavor struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SecurityRule defines network access rules
|
|
|
|
|
type SecurityRule struct {
|
|
|
|
|
PortRangeMax int `json:"port_range_max"`
|
|
|
|
|
PortRangeMin int `json:"port_range_min"`
|
|
|
|
|
Protocol string `json:"protocol"`
|
|
|
|
|
RemoteCIDR string `json:"remote_cidr"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// App represents an application definition
|
|
|
|
|
type App struct {
|
|
|
|
|
msg `json:",inline"`
|
|
|
|
|
Key AppKey `json:"key"`
|
|
|
|
|
Deployment string `json:"deployment,omitempty"`
|
|
|
|
|
ImageType string `json:"image_type,omitempty"`
|
|
|
|
|
ImagePath string `json:"image_path,omitempty"`
|
|
|
|
|
AllowServerless bool `json:"allow_serverless,omitempty"`
|
|
|
|
|
DefaultFlavor Flavor `json:"defaultFlavor,omitempty"`
|
|
|
|
|
ServerlessConfig interface{} `json:"serverless_config,omitempty"`
|
|
|
|
|
DeploymentGenerator string `json:"deployment_generator,omitempty"`
|
|
|
|
|
DeploymentManifest string `json:"deployment_manifest,omitempty"`
|
|
|
|
|
RequiredOutboundConnections []SecurityRule `json:"required_outbound_connections"`
|
2025-09-30 12:09:00 +02:00
|
|
|
Fields []string `json:"fields,omitempty"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppInstance represents a deployed application instance
|
|
|
|
|
type AppInstance struct {
|
2025-10-20 13:34:22 +02:00
|
|
|
msg `json:",inline"`
|
|
|
|
|
Key AppInstanceKey `json:"key"`
|
|
|
|
|
AppKey AppKey `json:"app_key,omitempty"`
|
|
|
|
|
Flavor Flavor `json:"flavor,omitempty"`
|
|
|
|
|
State string `json:"state,omitempty"`
|
|
|
|
|
PowerState string `json:"power_state,omitempty"`
|
|
|
|
|
Fields []string `json:"fields,omitempty"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cloudlet represents edge infrastructure
|
|
|
|
|
type Cloudlet struct {
|
2025-09-25 15:32:07 +02:00
|
|
|
msg `json:",inline"`
|
|
|
|
|
Key CloudletKey `json:"key"`
|
|
|
|
|
Location Location `json:"location"`
|
|
|
|
|
IpSupport string `json:"ip_support,omitempty"`
|
|
|
|
|
NumDynamicIps int32 `json:"num_dynamic_ips,omitempty"`
|
|
|
|
|
State string `json:"state,omitempty"`
|
|
|
|
|
Flavor Flavor `json:"flavor,omitempty"`
|
|
|
|
|
PhysicalName string `json:"physical_name,omitempty"`
|
|
|
|
|
Region string `json:"region,omitempty"`
|
|
|
|
|
NotifySrvAddr string `json:"notify_srv_addr,omitempty"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Location represents geographical coordinates
|
|
|
|
|
type Location struct {
|
|
|
|
|
Latitude float64 `json:"latitude"`
|
|
|
|
|
Longitude float64 `json:"longitude"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Input types for API operations
|
|
|
|
|
|
|
|
|
|
// NewAppInput represents input for creating an application
|
|
|
|
|
type NewAppInput struct {
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
App App `json:"app"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewAppInstanceInput represents input for creating an app instance
|
|
|
|
|
type NewAppInstanceInput struct {
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
AppInst AppInstance `json:"appinst"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewCloudletInput represents input for creating a cloudlet
|
|
|
|
|
type NewCloudletInput struct {
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
Cloudlet Cloudlet `json:"cloudlet"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-30 12:09:00 +02:00
|
|
|
// UpdateAppInput represents input for updating an application
|
|
|
|
|
type UpdateAppInput struct {
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
App App `json:"app"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UpdateAppInstanceInput represents input for updating an app instance
|
|
|
|
|
type UpdateAppInstanceInput struct {
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
AppInst AppInstance `json:"appinst"`
|
|
|
|
|
}
|
|
|
|
|
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
// Response wrapper types
|
|
|
|
|
|
|
|
|
|
// Response wraps a single API response
|
|
|
|
|
type Response[T Message] struct {
|
|
|
|
|
Data T `json:"data"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (res *Response[T]) HasData() bool {
|
|
|
|
|
return !res.IsMessage()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (res *Response[T]) IsMessage() bool {
|
|
|
|
|
return res.Data.GetMessage() != ""
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-16 11:12:57 +02:00
|
|
|
// ResultResponse represents an API result with error code
|
|
|
|
|
type ResultResponse struct {
|
|
|
|
|
Result struct {
|
|
|
|
|
Message string `json:"message"`
|
|
|
|
|
Code int `json:"code"`
|
|
|
|
|
} `json:"result"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *ResultResponse) IsError() bool {
|
|
|
|
|
return r.Result.Code >= 400
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *ResultResponse) GetMessage() string {
|
|
|
|
|
return r.Result.Message
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *ResultResponse) GetCode() int {
|
|
|
|
|
return r.Result.Code
|
|
|
|
|
}
|
|
|
|
|
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
// Responses wraps multiple API responses with metadata
|
|
|
|
|
type Responses[T Message] struct {
|
|
|
|
|
Responses []Response[T] `json:"responses,omitempty"`
|
|
|
|
|
StatusCode int `json:"-"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *Responses[T]) GetData() []T {
|
|
|
|
|
var data []T
|
|
|
|
|
for _, v := range r.Responses {
|
|
|
|
|
if v.HasData() {
|
|
|
|
|
data = append(data, v.Data)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *Responses[T]) GetMessages() []string {
|
|
|
|
|
var messages []string
|
|
|
|
|
for _, v := range r.Responses {
|
|
|
|
|
if v.IsMessage() {
|
|
|
|
|
messages = append(messages, v.Data.GetMessage())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return messages
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *Responses[T]) IsSuccessful() bool {
|
|
|
|
|
return r.StatusCode >= 200 && r.StatusCode < 400
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *Responses[T]) Error() error {
|
|
|
|
|
if r.IsSuccessful() {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return &APIError{
|
|
|
|
|
StatusCode: r.StatusCode,
|
|
|
|
|
Messages: r.GetMessages(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// APIError represents an API error with details
|
|
|
|
|
type APIError struct {
|
|
|
|
|
StatusCode int `json:"status_code"`
|
|
|
|
|
Code string `json:"code,omitempty"`
|
|
|
|
|
Messages []string `json:"messages,omitempty"`
|
|
|
|
|
Body []byte `json:"-"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (e *APIError) Error() string {
|
2025-09-25 15:32:07 +02:00
|
|
|
jsonErr, err := json.Marshal(e)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Sprintf("API error: %v", err)
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
2025-09-25 15:32:07 +02:00
|
|
|
return fmt.Sprintf("API error: %s", jsonErr)
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Filter types for querying
|
|
|
|
|
|
|
|
|
|
// AppFilter represents filters for app queries
|
|
|
|
|
type AppFilter struct {
|
2025-09-25 16:23:35 +02:00
|
|
|
App App `json:"app"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
Region string `json:"region"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppInstanceFilter represents filters for app instance queries
|
|
|
|
|
type AppInstanceFilter struct {
|
2025-09-25 16:59:24 +02:00
|
|
|
AppInstance AppInstance `json:"appinst"`
|
|
|
|
|
Region string `json:"region"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CloudletFilter represents filters for cloudlet queries
|
|
|
|
|
type CloudletFilter struct {
|
2025-09-25 17:08:08 +02:00
|
|
|
Cloudlet Cloudlet `json:"cloudlet"`
|
|
|
|
|
Region string `json:"region"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CloudletManifest represents cloudlet deployment manifest
|
|
|
|
|
type CloudletManifest struct {
|
2025-09-25 15:32:07 +02:00
|
|
|
Manifest string `json:"manifest"`
|
feat(sdk): ✨ Implement EdgeXR Master Controller Go SDK foundation
Phase 1 Implementation - Core SDK foundation with typed APIs:
## New Components Added:
- **SDK Package Structure**: `/sdk/client`, `/sdk/internal/http`, `/sdk/examples`
- **Core Types**: App, AppInstance, Cloudlet with JSON marshaling
- **HTTP Transport**: Resilient HTTP client with go-retryablehttp
- **Auth System**: Pluggable providers (StaticToken, NoAuth)
- **Client**: Configurable SDK client with retry and logging options
## API Implementation:
- **App Management**: CreateApp, ShowApp, ShowApps, DeleteApp
- **Error Handling**: Structured APIError with status codes and messages
- **Response Parsing**: EdgeXR streaming JSON response support
- **Context Support**: All APIs accept context.Context for timeouts/cancellation
## Testing & Examples:
- **Unit Tests**: Comprehensive test suite with httptest mock servers
- **Example App**: Complete app lifecycle demonstration in examples/deploy_app.go
- **Test Coverage**: Create, show, list, delete operations with error conditions
## Build Infrastructure:
- **Makefile**: Automated code generation, testing, and building
- **Dependencies**: Added go-retryablehttp, testify, oapi-codegen
- **Configuration**: oapi-codegen.yaml for type generation
## API Mapping:
- CreateApp → POST /auth/ctrl/CreateApp
- ShowApp → POST /auth/ctrl/ShowApp
- DeleteApp → POST /auth/ctrl/DeleteApp
Following existing prototype patterns while adding type safety, retry logic,
and comprehensive error handling. Ready for Phase 2 AppInstance APIs.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 14:05:20 +02:00
|
|
|
LastModified time.Time `json:"last_modified,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CloudletResourceUsage represents cloudlet resource utilization
|
|
|
|
|
type CloudletResourceUsage struct {
|
|
|
|
|
CloudletKey CloudletKey `json:"cloudlet_key"`
|
|
|
|
|
Region string `json:"region"`
|
|
|
|
|
Usage map[string]interface{} `json:"usage"`
|
2025-09-25 15:32:07 +02:00
|
|
|
}
|