Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.1.0-alpha.1 #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0-alpha.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 105
configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nvidia-ishandhanani%2Fnvidia-gpu-cloud-7f0aa99cc03e38b5c0f449943aaaec43861131521f12ba8724b73af96940a6d8.yml
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## 0.1.0-alpha.1 (2024-11-12)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/brevdev/ngc-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** api update ([b2bccf6](https://github.com/brevdev/ngc-go/commit/b2bccf607671f2fb3f73702abb45afae4baf25cb))
* **api:** api update ([#3](https://github.com/brevdev/ngc-go/issues/3)) ([3b9b216](https://github.com/brevdev/ngc-go/commit/3b9b216f32f542af5815d2105859ba41ab334602))


### Chores

* rebuild project due to codegen change ([#5](https://github.com/brevdev/ngc-go/issues/5)) ([4632864](https://github.com/brevdev/ngc-go/commit/4632864cd3e6f1417b5d2af8f5a540282ebb5970))
* rebuild project due to codegen change ([#6](https://github.com/brevdev/ngc-go/issues/6)) ([3baa80f](https://github.com/brevdev/ngc-go/commit/3baa80feeb00aed36ce832ff853af12f36f25260))
* rebuild project due to codegen change ([#7](https://github.com/brevdev/ngc-go/issues/7)) ([a694c0a](https://github.com/brevdev/ngc-go/commit/a694c0a2e2615331b6f61a2c711ba8487ca34700))
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To use a local version of this library from source in another project, edit the
directive. This can be done through the CLI with the following:

```sh
$ go mod edit -replace github.com/stainless-sdks/nvidia-gpu-cloud-go=/path/to/nvidia-gpu-cloud-go
$ go mod edit -replace github.com/brevdev/ngc-go=/path/to/ngc-go
```

## Running tests
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Nvidia GPU Cloud
Copyright 2024 Ngc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
73 changes: 40 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
# Nvidia GPU Cloud Go API Library
# Ngc Go API Library

<a href="https://pkg.go.dev/github.com/stainless-sdks/nvidia-gpu-cloud-go"><img src="https://pkg.go.dev/badge/github.com/stainless-sdks/nvidia-gpu-cloud-go.svg" alt="Go Reference"></a>
<a href="https://pkg.go.dev/github.com/brevdev/ngc-go"><img src="https://pkg.go.dev/badge/github.com/brevdev/ngc-go.svg" alt="Go Reference"></a>

The Nvidia GPU Cloud Go library provides convenient access to [the Nvidia GPU Cloud REST
API](https://docs.nvidia-gpu-cloud.com) from applications written in Go. The full API of this library can be found in [api.md](api.md).
The Ngc Go library provides convenient access to [the Ngc REST
API](https://docs.ngc.com) from applications written in Go. The full API of this library can be found in [api.md](api.md).

It is generated with [Stainless](https://www.stainlessapi.com/).

## Installation

<!-- x-release-please-start-version -->

```go
import (
"github.com/stainless-sdks/nvidia-gpu-cloud-go" // imported as nvidiagpucloud
"github.com/brevdev/ngc-go" // imported as ngc
)
```

<!-- x-release-please-end -->

Or to pin the version:

<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/stainless-sdks/nvidia-gpu-cloud-go@v0.0.1-alpha.0'
go get -u 'github.com/brevdev/ngc-go@v0.1.0-alpha.1'
```

<!-- x-release-please-end -->

## Requirements

This library requires Go 1.18+.
Expand All @@ -36,20 +44,19 @@ import (
"context"
"fmt"

"github.com/stainless-sdks/nvidia-gpu-cloud-go"
"github.com/stainless-sdks/nvidia-gpu-cloud-go/option"
"github.com/brevdev/ngc-go"
"github.com/brevdev/ngc-go/option"
)

func main() {
client := nvidiagpucloud.NewClient(
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("API_KEY")
option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("BEARER_TOKEN")
client := ngc.NewClient(
option.WithAPIKey("My API Key"),
)
org, err := client.Orgs.New(context.TODO(), nvidiagpucloud.OrgNewParams{})
orgResponse, err := client.Orgs.New(context.TODO(), ngc.OrgNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", org.Organizations)
fmt.Printf("%+v\n", orgResponse.Organizations)
}

```
Expand All @@ -68,18 +75,18 @@ To send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](

```go
params := FooParams{
Name: nvidiagpucloud.F("hello"),
Name: ngc.F("hello"),

// Explicitly send `"description": null`
Description: nvidiagpucloud.Null[string](),
Description: ngc.Null[string](),

Point: nvidiagpucloud.F(nvidiagpucloud.Point{
X: nvidiagpucloud.Int(0),
Y: nvidiagpucloud.Int(1),
Point: ngc.F(ngc.Point{
X: ngc.Int(0),
Y: ngc.Int(1),

// In cases where the API specifies a given type,
// but you want to send something else, use `Raw`:
Z: nvidiagpucloud.Raw[int64](0.01), // sends a float
Z: ngc.Raw[int64](0.01), // sends a float
}),
}
```
Expand Down Expand Up @@ -133,7 +140,7 @@ This library uses the functional options pattern. Functions defined in the
requests. For example:

```go
client := nvidiagpucloud.NewClient(
client := ngc.NewClient(
// Adds a header to every request made by the client
option.WithHeader("X-Some-Header", "custom_header_info"),
)
Expand All @@ -146,7 +153,7 @@ client.Orgs.New(context.TODO(), ...,
)
```

See the [full list of request options](https://pkg.go.dev/github.com/stainless-sdks/nvidia-gpu-cloud-go/option).
See the [full list of request options](https://pkg.go.dev/github.com/brevdev/ngc-go/option).

### Pagination

Expand All @@ -160,16 +167,16 @@ with additional helper methods like `.GetNextPage()`, e.g.:
### Errors

When the API returns a non-success status code, we return an error with type
`*nvidiagpucloud.Error`. This contains the `StatusCode`, `*http.Request`, and
`*ngc.Error`. This contains the `StatusCode`, `*http.Request`, and
`*http.Response` values of the request, as well as the JSON of the error body
(much like other response objects in the SDK).

To handle errors, we recommend that you use the `errors.As` pattern:

```go
_, err := client.Orgs.New(context.TODO(), nvidiagpucloud.OrgNewParams{})
_, err := client.Orgs.New(context.TODO(), ngc.OrgNewParams{})
if err != nil {
var apierr *nvidiagpucloud.Error
var apierr *ngc.Error
if errors.As(err, &apierr) {
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
Expand All @@ -194,7 +201,7 @@ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Orgs.New(
ctx,
nvidiagpucloud.OrgNewParams{},
ngc.OrgNewParams{},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
)
Expand All @@ -210,7 +217,7 @@ The file name and content-type can be customized by implementing `Name() string`
string` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a
file returned by `os.Open` will be sent with the file name on disk.

We also provide a helper `nvidiagpucloud.FileParam(reader io.Reader, filename string, contentType string)`
We also provide a helper `ngc.FileParam(reader io.Reader, filename string, contentType string)`
which can be used to wrap any `io.Reader` with the appropriate file name and content type.

### Retries
Expand All @@ -223,14 +230,14 @@ You can use the `WithMaxRetries` option to configure or disable this:

```go
// Configure the default for all requests:
client := nvidiagpucloud.NewClient(
client := ngc.NewClient(
option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Orgs.New(
context.TODO(),
nvidiagpucloud.OrgNewParams{},
ngc.OrgNewParams{},
option.WithMaxRetries(5),
)
```
Expand Down Expand Up @@ -268,9 +275,9 @@ or the `option.WithJSONSet()` methods.

```go
params := FooNewParams{
ID: nvidiagpucloud.F("id_xxxx"),
Data: nvidiagpucloud.F(FooNewParamsData{
FirstName: nvidiagpucloud.F("John"),
ID: ngc.F("id_xxxx"),
Data: ngc.F(FooNewParamsData{
FirstName: ngc.F("John"),
}),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Expand Down Expand Up @@ -305,7 +312,7 @@ func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response,
return res, err
}

client := nvidiagpucloud.NewClient(
client := ngc.NewClient(
option.WithMiddleware(Logger),
)
```
Expand All @@ -330,7 +337,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/nvidia-gpu-cloud-go/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/brevdev/ngc-go/issues) with questions, bugs, or suggestions.

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Nvidia GPU Cloud please follow the respective company's security reporting guidelines.
or products provided by Ngc please follow the respective company's security reporting guidelines.

### Nvidia GPU Cloud Terms and Policies
### Ngc Terms and Policies

Please contact dev-feedback@nvidia-gpu-cloud.com for any questions or concerns regarding security of our services.
Please contact dev-feedback@ngc.com for any questions or concerns regarding security of our services.

---

Expand Down
29 changes: 7 additions & 22 deletions admin.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package nvidiagpucloud
package ngc

import (
"context"
"net/http"

"github.com/stainless-sdks/nvidia-gpu-cloud-go/internal/requestconfig"
"github.com/stainless-sdks/nvidia-gpu-cloud-go/option"
"github.com/brevdev/ngc-go/option"
)

// AdminService contains methods and other services that help with interacting with
// the nvidia-gpu-cloud API.
// the ngc API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewAdminService] method instead.
type AdminService struct {
Options []option.RequestOption
Orgs *AdminOrgService
Users *AdminUserService
Org *AdminOrgService
Entitlements *AdminEntitlementService
Options []option.RequestOption
Orgs *AdminOrgService
Users *AdminUserService
Org *AdminOrgService
}

// NewAdminService generates a new service that applies the given options to each
Expand All @@ -33,15 +28,5 @@ func NewAdminService(opts ...option.RequestOption) (r *AdminService) {
r.Orgs = NewAdminOrgService(opts...)
r.Users = NewAdminUserService(opts...)
r.Org = NewAdminOrgService(opts...)
r.Entitlements = NewAdminEntitlementService(opts...)
return
}

// Backfill Orgs to Kratos
func (r *AdminService) BackfillOrgsToKratos(ctx context.Context, opts ...option.RequestOption) (res *http.Response, err error) {
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
path := "v2/admin/backfill-orgs-to-kratos"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
return
}
Loading