Skip to content

Latest commit

 

History

History
188 lines (140 loc) · 14.4 KB

File metadata and controls

188 lines (140 loc) · 14.4 KB

InstanceSKUs

Overview

Available Operations

List

Aggregate availability across instance SKUs that match requirements, grouped by the given property keys. Each group exposes a summed total schedule plus a per-SKU breakdown.

Example Usage

package main

import(
	"context"
	sfc "github.com/sfcompute/sfc-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := sfc.New(
        sfc.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    res, err := s.InstanceSKUs.List(ctx, nil, []string{
        "my-resource-name",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ListAvailabilityResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
requirements *string Filter applied before grouping. Wire format matches RequirementsQuery (e.g. accelerator_type:H100;region:NorthAmerica). Keys/values are validated against the property registry; the caller's audience is injected automatically.
groupBy []string Property keys to group by. Repeatable: ?group_by=region&group_by=accelerator_type. Each key must be a public registry key. Empty group_by → a single aggregate group.
opts []operations.Option The options for this request.

Response

*operations.ListAvailabilityResponse, error

Errors

Error Type Status Code Content Type
apierrors.UnauthorizedError 401 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.APIError 4XX, 5XX */*

ListInstanceSKUs

List all instance SKUs available on the market with their properties.

Example Usage

package main

import(
	"context"
	sfc "github.com/sfcompute/sfc-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := sfc.New(
        sfc.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    res, err := s.InstanceSKUs.ListInstanceSKUs(ctx, sfc.Pointer[int64](50), sfc.Pointer("iskuc_gqXR7s0Kj5mHvE2wNpLc4Q"), sfc.Pointer("iskuc_gqXR7s0Kj5mHvE2wNpLc4Q"))
    if err != nil {
        log.Fatal(err)
    }
    if res.ListInstanceSkusResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
limit *int64 Maximum number of results to return (1-200, default 50).
startingAfter *string Cursor for forward pagination (from a previous response's cursor field). iskuc_gqXR7s0Kj5mHvE2wNpLc4Q
endingBefore *string Cursor for backward pagination. iskuc_gqXR7s0Kj5mHvE2wNpLc4Q
opts []operations.Option The options for this request.

Response

*operations.ListInstanceSkusResponse, error

Errors

Error Type Status Code Content Type
apierrors.UnauthorizedError 401 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.APIError 4XX, 5XX */*

GetInstanceSku

Retrieve an instance SKU by ID, including its registered properties.

Example Usage

package main

import(
	"context"
	sfc "github.com/sfcompute/sfc-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := sfc.New(
        sfc.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    res, err := s.InstanceSKUs.GetInstanceSku(ctx, "isku_k3R-nX9vLm7Qp2Yw5Jd8F")
    if err != nil {
        log.Fatal(err)
    }
    if res.InstanceSku != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
id string ✔️ Instance SKU ID isku_k3R-nX9vLm7Qp2Yw5Jd8F
opts []operations.Option The options for this request.

Response

*operations.GetInstanceSkuResponse, error

Errors

Error Type Status Code Content Type
apierrors.UnauthorizedError 401 application/json
apierrors.NotFoundError 404 application/json
apierrors.InternalServerError 500 application/json
apierrors.APIError 4XX, 5XX */*