Skip to content

Commit

Permalink
Merge pull request #16 from seymourtang/remove-cross-region
Browse files Browse the repository at this point in the history
chore:Remove support for cross regional routing access
  • Loading branch information
seymourtang authored Jun 12, 2024
2 parents 3729aa3 + 1745264 commit 14a998d
Show file tree
Hide file tree
Showing 27 changed files with 36 additions and 228 deletions.
10 changes: 0 additions & 10 deletions core/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ const (
CNRegionArea
)

type ForwardedReginPrefix string

const (
DefaultForwardedReginPrefix ForwardedReginPrefix = ""
CNForwardedReginPrefix ForwardedReginPrefix = "/cn"
APForwardedReginPrefix ForwardedReginPrefix = "/ap"
NAForwardedReginPrefix ForwardedReginPrefix = "/na"
EUForwardedReginPrefix ForwardedReginPrefix = "/eu"
)

const (
USWestRegionDomainPrefix = "api-us-west-1"
USEastRegionDomainPrefix = "api-us-east-1"
Expand Down
15 changes: 4 additions & 11 deletions services/cloudrecording/v1/acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import (
)

type Acquire struct {
forwardedRegionPrefix core.ForwardedReginPrefix
client core.Client
prefixPath string // /v1/apps/{appid}/cloud_recording/
client core.Client
prefixPath string // /v1/apps/{appid}/cloud_recording/
}

// buildPath returns the request path.
// [(/cn)|(/ap)|(/na)/(/eu)]/v1/apps/{appid}/cloud_recording/acquire
// /v1/apps/{appid}/cloud_recording/acquire
func (a *Acquire) buildPath() string {
return string(a.forwardedRegionPrefix) + a.prefixPath + "/acquire"
return a.prefixPath + "/acquire"
}

type AcquireReqBody struct {
Expand Down Expand Up @@ -50,12 +49,6 @@ type AcquireSuccessResp struct {
ResourceId string `json:"resourceId"`
}

func (a *Acquire) WithForwardRegion(prefix core.ForwardedReginPrefix) *Acquire {
a.forwardedRegionPrefix = prefix

return a
}

func (a *Acquire) Do(ctx context.Context, payload *AcquireReqBody) (*AcquireResp, error) {
path := a.buildPath()

Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package v1

import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
)

type AcquireIndividualRecodingClientRequest struct {
Expand Down Expand Up @@ -34,7 +32,6 @@ type AcquireIndividualRecodingClientRequest struct {
}

type AcquireIndividualRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) AcquireIndividualRecording
// Do Acquire a resource for individual recording.
//
// cname: Channel name.
Expand Down Expand Up @@ -71,7 +68,6 @@ type StartIndividualRecordingClientRequest struct {
}

type StartIndividualRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) StartIndividualRecording
// Do Start individual recording.
//
// resourceID: Resource ID.
Expand Down Expand Up @@ -107,7 +103,6 @@ type QueryIndividualRecordingVideoScreenshotResp struct {
}

type QueryIndividualRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) QueryIndividualRecording
Do(ctx context.Context, resourceID string, sid string) (*QueryIndividualRecordingResp, error)
DoVideoScreenshot(ctx context.Context, resourceID string, sid string) (*QueryIndividualRecordingVideoScreenshotResp, error)
}
Expand All @@ -117,7 +112,6 @@ type UpdateIndividualRecordingClientRequest struct {
}

type UpdateIndividualRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) UpdateIndividualRecording
Do(ctx context.Context, resourceID string, sid string, cname string, uid string, clientRequest *UpdateIndividualRecordingClientRequest) (*UpdateResp, error)
}

Expand All @@ -144,7 +138,6 @@ type StopIndividualRecordingVideoScreenshotResp struct {
}

type StopIndividualRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) StopIndividualRecording
Do(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*StopIndividualRecordingResp, error)
DoVideoScreenshot(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*StopIndividualRecordingVideoScreenshotResp, error)
}
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording/acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package individualrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Acquire struct {

var _ baseV1.AcquireIndividualRecording = (*Acquire)(nil)

func (a *Acquire) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.AcquireIndividualRecording {
a.Base.WithForwardRegion(prefix)

return a
}

func (a *Acquire) Do(ctx context.Context, cname string, uid string, enablePostpone bool, clientRequest *baseV1.AcquireIndividualRecodingClientRequest) (*baseV1.AcquireResp, error) {
var startParameter *baseV1.StartClientRequest
if clientRequest.StartParameter != nil {
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package individualrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Query struct {

var _ baseV1.QueryIndividualRecording = (*Query)(nil)

func (q *Query) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.QueryIndividualRecording {
q.Base.WithForwardRegion(prefix)

return q
}

func (q *Query) Do(ctx context.Context, resourceID string, sid string) (*baseV1.QueryIndividualRecordingResp, error) {
resp, err := q.Base.Do(ctx, resourceID, sid, baseV1.IndividualMode)
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package individualrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Start struct {

var _ baseV1.StartIndividualRecording = (*Start)(nil)

func (s *Start) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.StartIndividualRecording {
s.Base.WithForwardRegion(prefix)

return s
}

func (s *Start) Do(ctx context.Context, resourceID string, cname string, uid string, clientRequest *baseV1.StartIndividualRecordingClientRequest) (*baseV1.StartResp, error) {
return s.Base.Do(ctx, resourceID, baseV1.IndividualMode, &baseV1.StartReqBody{
Cname: cname,
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package individualrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Stop struct {

var _ baseV1.StopIndividualRecording = (*Stop)(nil)

func (s *Stop) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.StopIndividualRecording {
s.BaseStop.WithForwardRegion(prefix)

return s
}

func (s *Stop) Do(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*baseV1.StopIndividualRecordingResp, error) {
resp, err := s.BaseStop.Do(ctx, resourceID, sid, baseV1.IndividualMode, &baseV1.StopReqBody{
Cname: cname,
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/individualrecording/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package individualrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Update struct {

var _ baseV1.UpdateIndividualRecording = (*Update)(nil)

func (u *Update) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.UpdateIndividualRecording {
u.Base.WithForwardRegion(prefix)

return u
}

func (u *Update) Do(ctx context.Context, resourceID string, sid string, cname string, uid string, clientRequest *baseV1.UpdateIndividualRecordingClientRequest) (*baseV1.UpdateResp, error) {
return u.Base.Do(ctx, resourceID, sid, baseV1.IndividualMode, &baseV1.UpdateReqBody{
Cname: cname,
Expand Down
8 changes: 0 additions & 8 deletions services/cloudrecording/v1/mixrecording.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package v1

import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
)

type AcquireMixRecodingClientRequest struct {
Expand All @@ -19,7 +17,6 @@ type AcquireMixRecodingClientRequest struct {
}

type AcquireMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) AcquireMixRecording
Do(ctx context.Context, cname string, uid string, clientRequest *AcquireMixRecodingClientRequest) (*AcquireResp, error)
}

Expand All @@ -45,7 +42,6 @@ type QueryMixRecordingHLSAndMP4Resp struct {
}

type QueryMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) QueryMixRecording
DoHLS(ctx context.Context, resourceID string, sid string) (*QueryMixRecordingHLSResp, error)
DoHLSAndMP4(ctx context.Context, resourceID string, sid string) (*QueryMixRecordingHLSAndMP4Resp, error)
}
Expand All @@ -58,7 +54,6 @@ type StartMixRecordingClientRequest struct {
}

type StartMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) StartMixRecording
Do(ctx context.Context, resourceID string, cname string, uid string, clientRequest *StartMixRecordingClientRequest) (*StartResp, error)
}

Expand All @@ -85,7 +80,6 @@ type StopMixRecordingHLSAndMP4SuccessResponse struct {
}

type StopMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) StopMixRecording
DoHLS(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*StopMixRecordingHLSSuccessResponse, error)
DoHLSAndMP4(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*StopMixRecordingHLSAndMP4SuccessResponse, error)
}
Expand All @@ -94,7 +88,6 @@ type UpdateMixRecordingClientRequest struct {
StreamSubscribe *UpdateStreamSubscribe
}
type UpdateMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) UpdateMixRecording
Do(ctx context.Context, resourceID string, sid string, cname string, uid string, clientRequest *UpdateMixRecordingClientRequest) (*UpdateResp, error)
}

Expand All @@ -109,7 +102,6 @@ type UpdateLayoutUpdateMixRecordingClientRequest struct {
}

type UpdateLayoutMixRecording interface {
WithForwardRegion(prefix core.ForwardedReginPrefix) UpdateLayoutMixRecording
Do(ctx context.Context, resourceID string, sid string, cname string, uid string, clientRequest *UpdateLayoutUpdateMixRecordingClientRequest) (*UpdateLayoutResp, error)
}

Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Acquire struct {

var _ baseV1.AcquireMixRecording = (*Acquire)(nil)

func (a *Acquire) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.AcquireMixRecording {
a.Base.WithForwardRegion(prefix)

return a
}

func (a *Acquire) Do(ctx context.Context, cname string, uid string, clientRequest *baseV1.AcquireMixRecodingClientRequest) (*baseV1.AcquireResp, error) {
var startParameter *baseV1.StartClientRequest
if clientRequest.StartParameter != nil {
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Query struct {

var _ baseV1.QueryMixRecording = (*Query)(nil)

func (q *Query) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.QueryMixRecording {
q.Base.WithForwardRegion(prefix)

return q
}

func (q *Query) DoHLS(ctx context.Context, resourceID string, sid string) (*baseV1.QueryMixRecordingHLSResp, error) {
resp, err := q.Base.Do(ctx, resourceID, sid, baseV1.MixMode)
if err != nil {
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Start struct {

var _ baseV1.StartMixRecording = (*Start)(nil)

func (s *Start) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.StartMixRecording {
s.Base.WithForwardRegion(prefix)

return s
}

func (s *Start) Do(ctx context.Context, resourceID string, cname string, uid string, clientRequest *baseV1.StartMixRecordingClientRequest) (*baseV1.StartResp, error) {
return s.Base.Do(ctx, resourceID, baseV1.MixMode, &baseV1.StartReqBody{
Cname: cname,
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Stop struct {

var _ baseV1.StopMixRecording = (*Stop)(nil)

func (s *Stop) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.StopMixRecording {
s.Base.WithForwardRegion(prefix)

return s
}

func (s *Stop) DoHLS(ctx context.Context, resourceID string, sid string, cname string, uid string, asyncStop bool) (*baseV1.StopMixRecordingHLSSuccessResponse, error) {
resp, err := s.Base.Do(ctx, resourceID, sid, baseV1.MixMode, &baseV1.StopReqBody{
Cname: cname,
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type Update struct {

var _ baseV1.UpdateMixRecording = (*Update)(nil)

func (u *Update) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.UpdateMixRecording {
u.Base.WithForwardRegion(prefix)

return u
}

func (u *Update) Do(ctx context.Context, resourceID string, sid string, cname string, uid string,
clientRequest *baseV1.UpdateMixRecordingClientRequest,
) (*baseV1.UpdateResp, error) {
Expand Down
7 changes: 0 additions & 7 deletions services/cloudrecording/v1/mixrecording/updatelayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package mixrecording
import (
"context"

"github.com/AgoraIO-Community/agora-rest-client-go/core"
baseV1 "github.com/AgoraIO-Community/agora-rest-client-go/services/cloudrecording/v1"
)

Expand All @@ -13,12 +12,6 @@ type UpdateLayout struct {

var _ baseV1.UpdateLayoutMixRecording = (*UpdateLayout)(nil)

func (u *UpdateLayout) WithForwardRegion(prefix core.ForwardedReginPrefix) baseV1.UpdateLayoutMixRecording {
u.Base.WithForwardRegion(prefix)

return u
}

func (u *UpdateLayout) Do(ctx context.Context, resourceID string, sid string, cname string, uid string,
clientRequest *baseV1.UpdateLayoutUpdateMixRecordingClientRequest,
) (*baseV1.UpdateLayoutResp, error) {
Expand Down
Loading

0 comments on commit 14a998d

Please sign in to comment.