@@ -41,13 +41,6 @@ type RegistryService interface {
41
41
GetSubscription (context.Context ) (* RegistrySubscription , * Response , error )
42
42
UpdateSubscription (context.Context , * RegistrySubscriptionUpdateRequest ) (* RegistrySubscription , * Response , error )
43
43
ValidateName (context.Context , * RegistryValidateNameRequest ) (* Response , error )
44
-
45
- // Multi-registry Open Beta API methods
46
- GetBeta (context.Context , string ) (* Registry , * Response , error )
47
- ListBeta (context.Context ) ([]* Registry , * Response , error )
48
- CreateBeta (context.Context , * RegistriesCreateRequest ) (* Registry , * Response , error )
49
- DeleteBeta (context.Context , string ) (* Response , error )
50
- DockerCredentialsBeta (context.Context , string , * RegistryDockerCredentialsRequest ) (* DockerCredentials , * Response , error )
51
44
}
52
45
53
46
var _ RegistryService = & RegistryServiceOp {}
@@ -634,10 +627,27 @@ func (svc *RegistryServiceOp) ValidateName(ctx context.Context, request *Registr
634
627
return resp , nil
635
628
}
636
629
637
- // Multi-registry Open Beta API endpoints
630
+ // RegistriesService is an interface for interfacing with the new multiple-registry beta endpoints
631
+ // of the DigitalOcean API.
632
+ //
633
+ // We are creating a separate Service in alignment with the new /v2/registries endpoints.
634
+ type RegistriesService interface {
635
+ Get (context.Context , string ) (* Registry , * Response , error )
636
+ List (context.Context ) ([]* Registry , * Response , error )
637
+ Create (context.Context , * RegistriesCreateRequest ) (* Registry , * Response , error )
638
+ Delete (context.Context , string ) (* Response , error )
639
+ DockerCredentials (context.Context , string , * RegistryDockerCredentialsRequest ) (* DockerCredentials , * Response , error )
640
+ }
641
+
642
+ var _ RegistriesService = & RegistriesServiceOp {}
643
+
644
+ // RegistriesServiceOp handles communication with the multiple-registry beta methods.
645
+ type RegistriesServiceOp struct {
646
+ client * Client
647
+ }
638
648
639
- // GetBeta returns the details of a named Registry.
640
- func (svc * RegistryServiceOp ) GetBeta (ctx context.Context , registry string ) (* Registry , * Response , error ) {
649
+ // Get returns the details of a named Registry.
650
+ func (svc * RegistriesServiceOp ) Get (ctx context.Context , registry string ) (* Registry , * Response , error ) {
641
651
path := fmt .Sprintf ("%s/%s" , registriesPath , registry )
642
652
req , err := svc .client .NewRequest (ctx , http .MethodGet , path , nil )
643
653
if err != nil {
@@ -651,8 +661,8 @@ func (svc *RegistryServiceOp) GetBeta(ctx context.Context, registry string) (*Re
651
661
return root .Registry , resp , nil
652
662
}
653
663
654
- // ListBeta returns a list of the named Registries.
655
- func (svc * RegistryServiceOp ) ListBeta (ctx context.Context ) ([]* Registry , * Response , error ) {
664
+ // List returns a list of the named Registries.
665
+ func (svc * RegistriesServiceOp ) List (ctx context.Context ) ([]* Registry , * Response , error ) {
656
666
req , err := svc .client .NewRequest (ctx , http .MethodGet , registriesPath , nil )
657
667
if err != nil {
658
668
return nil , nil , err
@@ -665,8 +675,8 @@ func (svc *RegistryServiceOp) ListBeta(ctx context.Context) ([]*Registry, *Respo
665
675
return root .Registries , resp , nil
666
676
}
667
677
668
- // CreateBeta creates a named Registry.
669
- func (svc * RegistryServiceOp ) CreateBeta (ctx context.Context , create * RegistriesCreateRequest ) (* Registry , * Response , error ) {
678
+ // Create creates a named Registry.
679
+ func (svc * RegistriesServiceOp ) Create (ctx context.Context , create * RegistriesCreateRequest ) (* Registry , * Response , error ) {
670
680
req , err := svc .client .NewRequest (ctx , http .MethodPost , registriesPath , create )
671
681
if err != nil {
672
682
return nil , nil , err
@@ -681,7 +691,7 @@ func (svc *RegistryServiceOp) CreateBeta(ctx context.Context, create *Registries
681
691
682
692
// Delete deletes a named Registry. There is no way to recover a Registry once it has
683
693
// been destroyed.
684
- func (svc * RegistryServiceOp ) DeleteBeta (ctx context.Context , registry string ) (* Response , error ) {
694
+ func (svc * RegistriesServiceOp ) Delete (ctx context.Context , registry string ) (* Response , error ) {
685
695
path := fmt .Sprintf ("%s/%s" , registriesPath , registry )
686
696
req , err := svc .client .NewRequest (ctx , http .MethodDelete , path , nil )
687
697
if err != nil {
@@ -695,7 +705,7 @@ func (svc *RegistryServiceOp) DeleteBeta(ctx context.Context, registry string) (
695
705
}
696
706
697
707
// DockerCredentials retrieves a Docker config file containing named Registry's credentials.
698
- func (svc * RegistryServiceOp ) DockerCredentialsBeta (ctx context.Context , registry string , request * RegistryDockerCredentialsRequest ) (* DockerCredentials , * Response , error ) {
708
+ func (svc * RegistriesServiceOp ) DockerCredentials (ctx context.Context , registry string , request * RegistryDockerCredentialsRequest ) (* DockerCredentials , * Response , error ) {
699
709
path := fmt .Sprintf ("%s/%s/%s" , registriesPath , registry , "docker-credentials" )
700
710
req , err := svc .client .NewRequest (ctx , http .MethodGet , path , nil )
701
711
if err != nil {
0 commit comments