Skip to content

Commit

Permalink
Merge pull request #113 from wallyworld/applicationoffer-uuid
Browse files Browse the repository at this point in the history
#113

The application offer tag payload is now the offer uuid, not name.

Because this is a breaking change, rev the module to v5.

Jira card: JUJU-5211
  • Loading branch information
jujubot authored Dec 15, 2023
2 parents 3f671f1 + 404c027 commit 2971c5b
Show file tree
Hide file tree
Showing 29 changed files with 64 additions and 206 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Makefile for juju/names
#

PROJECT := github.com/juju/names/v4
PROJECT := github.com/juju/names/v5
PROJECT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PROJECT_PACKAGES := $(shell go list $(PROJECT)/... | grep -v /acceptancetests/)
TEST_TIMEOUT := 600s
Expand Down
2 changes: 1 addition & 1 deletion action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type actionSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type applicationSuite struct{}
Expand Down
14 changes: 2 additions & 12 deletions applicationoffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@

package names

import (
"regexp"
)

const ApplicationOfferTagKind = "applicationoffer"

const (
ApplicationOfferSnippet = "(?:[a-z][a-z0-9]*(?:-[a-z0-9]*[a-z][a-z0-9]*)*)"
)

var validApplicationOffer = regexp.MustCompile("^" + ApplicationOfferSnippet + "$")

// IsValidApplicationOffer returns whether name is a valid application offer name.
func IsValidApplicationOffer(name string) bool {
return validApplicationOffer.MatchString(name)
func IsValidApplicationOffer(uuid string) bool {
return validUUID.MatchString(uuid)
}

type ApplicationOfferTag struct {
Expand Down
6 changes: 3 additions & 3 deletions applicationoffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type applicationOfferSuite struct{}
Expand All @@ -21,8 +21,8 @@ var parseApplicationOfferTagTests = []struct {
tag: "",
err: names.InvalidTagError("", ""),
}, {
tag: "applicationoffer-dave",
expected: names.NewApplicationOfferTag("dave"),
tag: "applicationoffer-f47ac10b-58cc-4372-a567-0e02b2c3d479",
expected: names.NewApplicationOfferTag("f47ac10b-58cc-4372-a567-0e02b2c3d479"),
}, {
tag: "dave",
err: names.InvalidTagError("dave", ""),
Expand Down
2 changes: 1 addition & 1 deletion caasmodel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type caasModelSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion charm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type charmSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type cloudSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion cloudcredential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type cloudCredentialSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type controllerSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion controlleragent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type ControllerAgentSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion environ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package names_test
import (
gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type environSuite struct{}
Expand Down
2 changes: 1 addition & 1 deletion filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

gc "gopkg.in/check.v1"

"github.com/juju/names/v4"
"github.com/juju/names/v5"
)

type filesystemSuite struct{}
Expand Down
27 changes: 11 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
module github.com/juju/names/v4
module github.com/juju/names/v5

go 1.17
go 1.21

require (
github.com/juju/errors v0.0.0-20220203013757-bd733f3c86b9
github.com/juju/testing v0.0.0-20220203020004-a0ff61f03494
github.com/juju/utils/v3 v3.0.0-20220203023959-c3fbc78a33b0
github.com/juju/errors v1.0.0
github.com/juju/testing v1.1.0
github.com/juju/utils/v3 v3.1.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
)

require (
github.com/juju/clock v0.0.0-20220203021603-d9deb868a28a // indirect
github.com/juju/collections v0.0.0-20220203020748-febd7cad8a7a // indirect
github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect
github.com/juju/mgo/v2 v2.0.0-20220111072304-f200228f1090 // indirect
github.com/juju/retry v0.0.0-20220204093819-62423bf33287 // indirect
github.com/juju/version/v2 v2.0.0-20220204124744-fc9915e3d935 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/juju/clock v1.0.2 // indirect
github.com/juju/loggo v1.0.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/text v0.3.7 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.7.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 2971c5b

Please sign in to comment.