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

TRITON-2469 Update joyent links to TritonDataCenter #201

Open
wants to merge 18 commits into
base: v1
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
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased

## 1.8.6 (Dec 08 2024)

- Updated joyent links to TritonDataCenter to reflect new repo home

## 1.8.5 (Aug 19 2020)

- Added delegate_dataset support to instance creation
Expand Down Expand Up @@ -126,11 +130,11 @@ We also now add support for using `SDC_*` and `TRITON_*` env vars when working w
connections per host, total of 10x connections per client.
- Expose an optional Headers attribute to clients to allow them to customize
HTTP headers when making Object requests.
- Fix a bug in Directory ListIndex [#69](https://github.com/joyent/issues/69)
- Fix a bug in Directory ListIndex [#69](https://github.com/TritonDataCenter/issues/69)
- Inputs to Object inputs have been relaxed to `io.Reader` (formerly a
`io.ReadSeeker`) [#73](https://github.com/joyent/issues/73).
- Add support for ForceDelete of all children of a directory [#71](https://github.com/joyent/issues/71)
- storage: Introduce `Objects.GetInfo` and `Objects.IsDir` using HEAD requests [#74](https://github.com/joyent/triton-go/issues/74)
`io.ReadSeeker`) [#73](https://github.com/TritonDataCenter/issues/73).
- Add support for ForceDelete of all children of a directory [#71](https://github.com/TritonDataCenter/issues/71)
- storage: Introduce `Objects.GetInfo` and `Objects.IsDir` using HEAD requests [#74](https://github.com/TritonDataCenter/triton-go/issues/74)

## 0.2.1 (November 8 2017)

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# triton-go

`triton-go` is a client SDK for Go applications using Joyent's Triton Compute
`triton-go` is a client SDK for Go applications using Triton Compute
and Object Storage (Manta) APIs.

The Triton Go SDK is used in the following open source projects.
Expand All @@ -10,8 +10,8 @@ The Triton Go SDK is used in the following open source projects.
- [Vault](http://github.com/hashicorp/vault)
- [Terraform](http://github.com/hashicorp/terraform)
- [Terraform Triton Provider](https://github.com/terraform-providers/terraform-provider-triton)
- [Docker Machine](https://github.com/joyent/docker-machine-driver-triton)
- [Triton Kubernetes](https://github.com/joyent/triton-kubernetes)
- [Docker Machine](https://github.com/TritonDataCenter/docker-machine-driver-triton)
- [Triton Kubernetes](https://github.com/TritonDataCenter/triton-kubernetes)
- [HashiCorp go-discover](https://github.com/hashicorp/go-discover)

## Usage
Expand Down Expand Up @@ -89,15 +89,15 @@ is performed using the [pkg/errors][7] library.

Acceptance Tests run directly against the Triton API (e.g. CloudAPI), so you
will need an installation of Triton in order to run them, or
[COAL](https://github.com/joyent/triton/blob/master/docs/developer-guide/coal-setup.md)
[COAL](https://github.com/TritonDataCenter/triton/blob/master/docs/developer-guide/coal-setup.md)
(Cloud On A Laptop). The tests create real resources and thus could cost real
money if you are using a paid Triton account! It is also possible that the
acceptance tests will leave behind resources, so extra attention will be needed
to clean up these test resources.

The acceptance tests depend upon a few things in your Triton setup:

- the [Ubuntu 16.04](https://docs.joyent.com/public-cloud/instances/virtual-machines/images/linux/ubuntu-certified#1604-xenial-images) LX image to be installed
- the [Ubuntu 24.04](https://docs.tritondatacenter.com/public-cloud/instances/virtual-machines/images) HVM image to be installed
- a generic package with Memory in the range of 128MB to 1024MB
- a public (external) network to provision with
- if your Triton setup is used for testing - then running
Expand Down Expand Up @@ -131,7 +131,7 @@ The verbose output has been removed for brevity here.
```
$ HTTP_PROXY=http://localhost:8888 \
TRITON_TEST=1 \
TRITON_URL=https://us-sw-1.api.joyent.com \
TRITON_URL=https://us-central-1.api.mnx.io \
TRITON_ACCOUNT=AccountName \
TRITON_KEY_ID=a4:c6:f3:75:80:27:e0:03:a9:98:79:ef:c5:0a:06:11 \
go test -v -run "TestAccKey"
Expand All @@ -142,7 +142,7 @@ $ HTTP_PROXY=http://localhost:8888 \
=== RUN TestAccKey_Delete
--- PASS: TestAccKey_Delete (15.08s)
PASS
ok github.com/joyent/triton-go 31.861s
ok github.com/TritonDataCenter/triton-go 31.861s
```

## Example API
Expand Down Expand Up @@ -173,9 +173,9 @@ import (
"os"
"time"

triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/authentication"
"github.com/joyent/triton-go/compute"
triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/authentication"
"github.com/TritonDataCenter/triton-go/compute"
)

func main() {
Expand Down Expand Up @@ -259,7 +259,7 @@ func main() {

```

[4]: https://github.com/joyent/node-http-signature/blob/master/http_signing.md
[5]: https://godoc.org/github.com/joyent/triton-go/authentication
[6]: https://godoc.org/github.com/joyent/triton-go/authentication
[4]: https://github.com/TritonDataCenter/node-http-signature/blob/master/http_signing.md
[5]: https://godoc.org/github.com/TritonDataCenter/triton-go/authentication
[6]: https://godoc.org/github.com/TritonDataCenter/triton-go/authentication
[7]: https://github.com/pkg/errors
3 changes: 2 additions & 1 deletion account/account.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -15,7 +16,7 @@ import (
"path"
"time"

"github.com/joyent/triton-go/client"
"github.com/TritonDataCenter/triton-go/client"
"github.com/pkg/errors"
)

Expand Down
7 changes: 4 additions & 3 deletions account/account_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -16,9 +17,9 @@ import (
"strings"
"testing"

triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/account"
"github.com/joyent/triton-go/testutils"
triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/account"
"github.com/TritonDataCenter/triton-go/testutils"
"github.com/pkg/errors"
)

Expand Down
5 changes: 3 additions & 2 deletions account/client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -11,8 +12,8 @@ package account
import (
"net/http"

triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/client"
triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/client"
)

type AccountClient struct {
Expand Down
3 changes: 2 additions & 1 deletion account/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -14,7 +15,7 @@ import (
"net/http"
"path"

"github.com/joyent/triton-go/client"
"github.com/TritonDataCenter/triton-go/client"
"github.com/pkg/errors"
)

Expand Down
7 changes: 4 additions & 3 deletions account/config_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -16,9 +17,9 @@ import (
"strings"
"testing"

triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/account"
"github.com/joyent/triton-go/testutils"
triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/account"
"github.com/TritonDataCenter/triton-go/testutils"
"github.com/pkg/errors"
)

Expand Down
3 changes: 2 additions & 1 deletion account/keys.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -14,7 +15,7 @@ import (
"net/http"
"path"

"github.com/joyent/triton-go/client"
"github.com/TritonDataCenter/triton-go/client"
"github.com/pkg/errors"
)

Expand Down
7 changes: 4 additions & 3 deletions account/keys_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -16,10 +17,10 @@ import (
"strings"
"testing"

triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/account"
"github.com/TritonDataCenter/triton-go/testutils"
"github.com/abdullin/seq"
triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/account"
"github.com/joyent/triton-go/testutils"
"github.com/pkg/errors"
)

Expand Down
33 changes: 11 additions & 22 deletions client/client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright 2020 Joyent, Inc.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -20,13 +21,12 @@ import (
"net/url"
"os"
"regexp"
"strings"
"time"

triton "github.com/joyent/triton-go"
"github.com/joyent/triton-go/authentication"
"github.com/joyent/triton-go/errors"
tritonutils "github.com/joyent/triton-go/utils"
triton "github.com/TritonDataCenter/triton-go"
"github.com/TritonDataCenter/triton-go/authentication"
"github.com/TritonDataCenter/triton-go/errors"
tritonutils "github.com/TritonDataCenter/triton-go/utils"
pkgerrors "github.com/pkg/errors"
)

Expand All @@ -41,13 +41,10 @@ var (
InvalidDCInURL = "invalid data center in URL"

knownDCFormats = []string{
`https?://(.*).api.joyent.com`,
`https?://(.*).api.joyentcloud.com`,
`https?://(.*).api.samsungcloud.io`,
`https?://(.*).api.mnx.io`,
}

jpcFormatURL = "https://tsg.%s.svc.joyent.zone"
spcFormatURL = "https://tsg.%s.svc.samsungcloud.zone"
jpcFormatURL = "https://tsg.%s.svc.triton.zone"

tritonTransportHttpTraceChecked = false
tritonTransportHttpTraceEnabled = false
Expand Down Expand Up @@ -95,21 +92,16 @@ func wrapTritonTransport(in http.RoundTripper) http.RoundTripper {
// parseDC parses out the data center commonly found in Triton URLs. Returns an
// error if the Triton URL does not include a known data center name, in which
// case a URL override (TRITON_TSG_URL) must be provided.
func parseDC(url string) (string, bool, error) {
isSamsung := false
if strings.Contains(url, "samsung") {
isSamsung = true
}

func parseDC(url string) (string, error) {
for _, pattern := range knownDCFormats {
re := regexp.MustCompile(pattern)
matches := re.FindStringSubmatch(url)
if len(matches) > 1 {
return matches[1], isSamsung, nil
return matches[1], nil
}
}

return "", isSamsung, fmt.Errorf("failed to parse datacenter from '%s'", url)
return "", fmt.Errorf("failed to parse datacenter from '%s'", url)
}

// New is used to construct a Client in order to make API
Expand Down Expand Up @@ -141,15 +133,12 @@ func New(tritonURL string, mantaURL string, accountName string, signers ...authe
// variable is available than override using that value instead.
tsgURL := triton.GetEnv("TSG_URL")
if tsgURL == "" && tritonURL != "" && !isPrivateInstall(tritonURL) {
currentDC, isSamsung, err := parseDC(tritonURL)
currentDC, err := parseDC(tritonURL)
if err != nil {
return nil, pkgerrors.Wrapf(err, InvalidDCInURL)
}

tsgURL = fmt.Sprintf(jpcFormatURL, currentDC)
if isSamsung {
tsgURL = fmt.Sprintf(spcFormatURL, currentDC)
}
}

servicesURL, err := url.Parse(tsgURL)
Expand Down
12 changes: 5 additions & 7 deletions client/client_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -13,7 +14,7 @@ import (
"strings"
"testing"

auth "github.com/joyent/triton-go/authentication"
auth "github.com/TritonDataCenter/triton-go/authentication"
)

const BadURL = "**ftp://man($$"
Expand Down Expand Up @@ -85,12 +86,10 @@ gnfBQoS89m3aO035henSfRFKVJkHaEoasj8hB3pwl9FGZUJp1c2JxiKzONqZhyGa
}

func TestNew(t *testing.T) {
mantaURL := "https://us-east.manta.joyent.com"
mantaURL := "https://us-central.manta.mnx.io"
tsgEnv := "http://tsg.test.org"
jpcTritonURL := "https://us-east-1.api.joyent.com"
spcTritonURL := "https://us-east-1.api.samsungcloud.io"
jpcServiceURL := "https://tsg.us-east-1.svc.joyent.zone"
spcServiceURL := "https://tsg.us-east-1.svc.samsungcloud.zone"
jpcTritonURL := "https://us-central-1.api.mnx.io"
jpcServiceURL := "https://tsg.us-central-1.svc.triton.zone"
privateInstallUrl := "https://myinstall.mycompany.com"

accountName := "test.user"
Expand All @@ -107,7 +106,6 @@ func TestNew(t *testing.T) {
err interface{}
}{
{"default", jpcTritonURL, mantaURL, "", jpcServiceURL, accountName, signer, nil},
{"in samsung", spcTritonURL, mantaURL, "", spcServiceURL, accountName, signer, nil},
{"env TSG", jpcTritonURL, mantaURL, tsgEnv, tsgEnv, accountName, signer, nil},
{"missing url", "", "", "", "", accountName, signer, ErrMissingURL},
{"bad tritonURL", BadURL, mantaURL, "", "", accountName, signer, InvalidTritonURL},
Expand Down
7 changes: 4 additions & 3 deletions cmd/agent/account/public.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (c) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -13,9 +14,9 @@ import (

"strconv"

"github.com/joyent/triton-go/account"
tac "github.com/joyent/triton-go/account"
"github.com/joyent/triton-go/cmd/config"
"github.com/TritonDataCenter/triton-go/account"
tac "github.com/TritonDataCenter/triton-go/account"
"github.com/TritonDataCenter/triton-go/cmd/config"
"github.com/pkg/errors"
)

Expand Down
7 changes: 4 additions & 3 deletions cmd/agent/compute/public.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// Copyright (tcc) 2018, Joyent, Inc. All rights reserved.
// Copyright 2024 MNX Cloud, Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -15,10 +16,10 @@ import (

"fmt"

"github.com/TritonDataCenter/triton-go/cmd/config"
tcc "github.com/TritonDataCenter/triton-go/compute"
terrors "github.com/TritonDataCenter/triton-go/errors"
"github.com/imdario/mergo"
"github.com/joyent/triton-go/cmd/config"
tcc "github.com/joyent/triton-go/compute"
terrors "github.com/joyent/triton-go/errors"
"github.com/pkg/errors"
)

Expand Down
Loading