Skip to content

Commit dcbe0e2

Browse files
authored
feat(apple_silicon): add CI-CD runner installation APIs (#2737)
1 parent d53174d commit dcbe0e2

File tree

1 file changed

+98
-2
lines changed

1 file changed

+98
-2
lines changed

api/applesilicon/v1alpha1/applesilicon_sdk.go

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,45 @@ func (enum *ListServersRequestOrderBy) UnmarshalJSON(data []byte) error {
234234
return nil
235235
}
236236

237+
type RunnerConfigurationProvider string
238+
239+
const (
240+
RunnerConfigurationProviderUnknownProvider = RunnerConfigurationProvider("unknown_provider")
241+
RunnerConfigurationProviderGithub = RunnerConfigurationProvider("github")
242+
RunnerConfigurationProviderGitlab = RunnerConfigurationProvider("gitlab")
243+
)
244+
245+
func (enum RunnerConfigurationProvider) String() string {
246+
if enum == "" {
247+
// return default value if empty
248+
return string(RunnerConfigurationProviderUnknownProvider)
249+
}
250+
return string(enum)
251+
}
252+
253+
func (enum RunnerConfigurationProvider) Values() []RunnerConfigurationProvider {
254+
return []RunnerConfigurationProvider{
255+
"unknown_provider",
256+
"github",
257+
"gitlab",
258+
}
259+
}
260+
261+
func (enum RunnerConfigurationProvider) MarshalJSON() ([]byte, error) {
262+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
263+
}
264+
265+
func (enum *RunnerConfigurationProvider) UnmarshalJSON(data []byte) error {
266+
tmp := ""
267+
268+
if err := json.Unmarshal(data, &tmp); err != nil {
269+
return err
270+
}
271+
272+
*enum = RunnerConfigurationProvider(RunnerConfigurationProvider(tmp).String())
273+
return nil
274+
}
275+
237276
type ServerPrivateNetworkServerStatus string
238277

239278
const (
@@ -416,6 +455,13 @@ func (enum *ServerTypeStock) UnmarshalJSON(data []byte) error {
416455
return nil
417456
}
418457

458+
// OSSupportedServerType: os supported server type.
459+
type OSSupportedServerType struct {
460+
ServerType string `json:"server_type"`
461+
462+
FastDeliveryAvailable bool `json:"fast_delivery_available"`
463+
}
464+
419465
// Commitment: commitment.
420466
type Commitment struct {
421467
// Type: default value: duration_24h
@@ -450,8 +496,32 @@ type OS struct {
450496
// XcodeVersion: the current xcode version for this OS.
451497
XcodeVersion string `json:"xcode_version"`
452498

453-
// CompatibleServerTypes: list of compatible server types.
454-
CompatibleServerTypes []string `json:"compatible_server_types"`
499+
// Deprecated: CompatibleServerTypes: list of compatible server types. Deprecated.
500+
CompatibleServerTypes *[]string `json:"compatible_server_types,omitempty"`
501+
502+
// ReleaseNotesURL: url of the release notes for the OS image or softwares pre-installed.
503+
ReleaseNotesURL string `json:"release_notes_url"`
504+
505+
// Description: a summary of the OS image content and configuration.
506+
Description string `json:"description"`
507+
508+
// Tags: list of tags for the OS configuration.
509+
Tags []string `json:"tags"`
510+
511+
// SupportedServerTypes: list of server types which supports the OS configuration. Also gives information about immediate stock availability.
512+
SupportedServerTypes []*OSSupportedServerType `json:"supported_server_types"`
513+
}
514+
515+
// RunnerConfiguration: runner configuration.
516+
type RunnerConfiguration struct {
517+
Name string `json:"name"`
518+
519+
URL string `json:"url"`
520+
521+
Token string `json:"token"`
522+
523+
// Provider: default value: unknown_provider
524+
Provider RunnerConfigurationProvider `json:"provider"`
455525
}
456526

457527
// ServerTypeCPU: server type cpu.
@@ -461,6 +531,10 @@ type ServerTypeCPU struct {
461531
CoreCount uint32 `json:"core_count"`
462532

463533
Frequency uint64 `json:"frequency"`
534+
535+
Sockets uint32 `json:"sockets"`
536+
537+
ThreadsPerCore uint32 `json:"threads_per_core"`
464538
}
465539

466540
// ServerTypeDisk: server type disk.
@@ -482,11 +556,18 @@ type ServerTypeMemory struct {
482556
Type string `json:"type"`
483557
}
484558

559+
// ServerTypeNPU: server type npu.
560+
type ServerTypeNPU struct {
561+
Count uint64 `json:"count"`
562+
}
563+
485564
// ServerTypeNetwork: server type network.
486565
type ServerTypeNetwork struct {
487566
PublicBandwidthBps uint64 `json:"public_bandwidth_bps"`
488567

489568
SupportedBandwidth []uint64 `json:"supported_bandwidth"`
569+
570+
DefaultPublicBandwidth uint64 `json:"default_public_bandwidth"`
490571
}
491572

492573
// BatchCreateServersRequestBatchInnerCreateServerRequest: batch create servers request batch inner create server request.
@@ -560,6 +641,12 @@ type Server struct {
560641

561642
// PublicBandwidthBps: public bandwidth configured for this server. Expressed in bits per second.
562643
PublicBandwidthBps uint64 `json:"public_bandwidth_bps"`
644+
645+
// RunnerConfiguration: current runner configuration, empty if none is installed.
646+
RunnerConfiguration *RunnerConfiguration `json:"runner_configuration"`
647+
648+
// Tags: a list of tags attached to the server.
649+
Tags []string `json:"tags"`
563650
}
564651

565652
// ConnectivityDiagnosticServerHealth: connectivity diagnostic server health.
@@ -637,6 +724,9 @@ type ServerType struct {
637724

638725
// DefaultOs: the default OS for this server type.
639726
DefaultOs *OS `json:"default_os"`
727+
728+
// Npu: nPU description.
729+
Npu *ServerTypeNPU `json:"npu"`
640730
}
641731

642732
// CommitmentTypeValue: commitment type value.
@@ -721,6 +811,9 @@ type CreateServerRequest struct {
721811

722812
// PublicBandwidthBps: public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
723813
PublicBandwidthBps uint64 `json:"public_bandwidth_bps"`
814+
815+
// RunnerConfiguration: specify the configuration to install an optional CICD runner on the server during installation.
816+
RunnerConfiguration *RunnerConfiguration `json:"runner_configuration,omitempty"`
724817
}
725818

726819
// DeleteServerRequest: delete server request.
@@ -1000,6 +1093,9 @@ type ReinstallServerRequest struct {
10001093

10011094
// OsID: reinstall the server with the target OS, when no os_id provided the default OS for the server type is used.
10021095
OsID *string `json:"os_id,omitempty"`
1096+
1097+
// RunnerConfiguration: specify the configuration to install an optional CICD runner on the server during installation.
1098+
RunnerConfiguration *RunnerConfiguration `json:"runner_configuration,omitempty"`
10031099
}
10041100

10051101
// SetServerPrivateNetworksResponse: set server private networks response.

0 commit comments

Comments
 (0)