diff --git a/client/client.go b/client/client.go index 9fd4fef..b64644a 100644 --- a/client/client.go +++ b/client/client.go @@ -174,8 +174,8 @@ func (s *client) VNetworkGateway() lsgateway.IVNetworkGateway { return s.vnetworkGateway } -func (s *client) usingIamOauth2AsAuthOption(pauthConfig ISdkConfigure) func() (lsclient.ISdkAuthentication, lserr.ISdkError) { - authFunc := func() (lsclient.ISdkAuthentication, lserr.ISdkError) { +func (s *client) usingIamOauth2AsAuthOption(pauthConfig ISdkConfigure) func() (lsclient.ISdkAuthentication, lserr.IError) { + authFunc := func() (lsclient.ISdkAuthentication, lserr.IError) { token, err := s.iamGateway.V2().IdentityService().GetAccessToken( lssvcIdentityV2.NewGetAccessTokenRequest(pauthConfig.GetClientId(), pauthConfig.GetClientSecret())) if err != nil { diff --git a/vngcloud/client/http.go b/vngcloud/client/http.go index f9fac3c..17d6c23 100644 --- a/vngcloud/client/http.go +++ b/vngcloud/client/http.go @@ -22,7 +22,7 @@ type ( retryCount int client *lreq.Client - reauthFunc func() (ISdkAuthentication, lserr.ISdkError) + reauthFunc func() (ISdkAuthentication, lserr.IError) reauthOption AuthOpts accessToken ISdkAuthentication @@ -39,7 +39,7 @@ type ( reauthFuture struct { done chan struct{} - err lserr.ISdkError + err lserr.IError } AuthOpts string @@ -89,13 +89,13 @@ func (s *httpClient) WithKvDefaultHeaders(pargs ...string) IHttpClient { return s } -func (s *httpClient) WithReauthFunc(pauthOpt AuthOpts, preauthFunc func() (ISdkAuthentication, lserr.ISdkError)) IHttpClient { +func (s *httpClient) WithReauthFunc(pauthOpt AuthOpts, preauthFunc func() (ISdkAuthentication, lserr.IError)) IHttpClient { s.reauthFunc = preauthFunc s.reauthOption = pauthOpt return s } -func (s *httpClient) DoRequest(purl string, preq IRequest) (*lreq.Response, lserr.ISdkError) { +func (s *httpClient) DoRequest(purl string, preq IRequest) (*lreq.Response, lserr.IError) { req := s.client.R().SetContext(s.context).SetHeaders(s.defaultHeaders).SetHeaders(preq.GetMoreHeaders()) if opt := preq.GetRequestBody(); opt != nil { req.SetBodyJsonMarshal(opt) @@ -172,7 +172,7 @@ func (s *httpClient) needReauth(preq IRequest) bool { return s.accessToken.NeedReauth() } -func (s *httpClient) reauthenticate() lserr.ISdkError { +func (s *httpClient) reauthenticate() lserr.IError { if s.reauthFunc == nil { return lserr.ErrorHandler(nil, lserr.WithErrorReauthFuncNotSet()) } @@ -217,17 +217,17 @@ func newReauthFuture() *reauthFuture { } } -func (s *reauthFuture) get() lserr.ISdkError { +func (s *reauthFuture) get() lserr.IError { <-s.done return s.err } -func (s *reauthFuture) set(err lserr.ISdkError) { +func (s *reauthFuture) set(err lserr.IError) { s.err = err close(s.done) } -func defaultErrorResponse(perr error, purl string, preq IRequest, resp *lreq.Response) lserr.ISdkError { +func defaultErrorResponse(perr error, purl string, preq IRequest, resp *lreq.Response) lserr.IError { return lserr.ErrorHandler(perr).WithKVparameters( "statusCode", resp.StatusCode, "url", purl, diff --git a/vngcloud/client/iclient.go b/vngcloud/client/iclient.go index cd744b6..c598b91 100644 --- a/vngcloud/client/iclient.go +++ b/vngcloud/client/iclient.go @@ -14,9 +14,9 @@ type IHttpClient interface { WithTimeout(ptimeout ltime.Duration) IHttpClient WithSleep(psleep ltime.Duration) IHttpClient WithKvDefaultHeaders(pargs ...string) IHttpClient - WithReauthFunc(pauthOpt AuthOpts, preauthFunc func() (ISdkAuthentication, lserr.ISdkError)) IHttpClient + WithReauthFunc(pauthOpt AuthOpts, preauthFunc func() (ISdkAuthentication, lserr.IError)) IHttpClient - DoRequest(purl string, preq IRequest) (*lreq.Response, lserr.ISdkError) + DoRequest(purl string, preq IRequest) (*lreq.Response, lserr.IError) } type IRequest interface { diff --git a/vngcloud/client/iservice_client.go b/vngcloud/client/iservice_client.go index b357469..ece9f69 100644 --- a/vngcloud/client/iservice_client.go +++ b/vngcloud/client/iservice_client.go @@ -20,10 +20,10 @@ type IServiceClient interface { GetZoneId() string GetUserId() string - Post(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) - Get(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) - Delete(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) - Put(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) + Post(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) + Get(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) + Delete(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) + Put(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) } type ISdkAuthentication interface { diff --git a/vngcloud/client/service_client.go b/vngcloud/client/service_client.go index 836aaa2..06fb69a 100644 --- a/vngcloud/client/service_client.go +++ b/vngcloud/client/service_client.go @@ -67,19 +67,19 @@ func (s *serviceClient) ServiceURL(pparts ...string) string { return s.endpoint + lstr.Join(pparts, "/") } -func (s *serviceClient) Post(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) { +func (s *serviceClient) Post(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) { return s.client.DoRequest(purl, preq.WithRequestMethod(MethodPost)) } -func (s *serviceClient) Get(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) { +func (s *serviceClient) Get(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) { return s.client.DoRequest(purl, preq.WithRequestMethod(MethodGet)) } -func (s *serviceClient) Delete(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) { +func (s *serviceClient) Delete(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) { return s.client.DoRequest(purl, preq.WithRequestMethod(MethodDelete)) } -func (s *serviceClient) Put(purl string, preq IRequest) (*lreq.Response, lsdkErr.ISdkError) { +func (s *serviceClient) Put(purl string, preq IRequest) (*lreq.Response, lsdkErr.IError) { return s.client.DoRequest(purl, preq.WithRequestMethod(MethodPut)) } diff --git a/vngcloud/sdk_error/common.go b/vngcloud/sdk_error/common.go index 96dd0d6..6eba6d5 100644 --- a/vngcloud/sdk_error/common.go +++ b/vngcloud/sdk_error/common.go @@ -10,7 +10,7 @@ const ( patternPagingInvalid = "page or size invalid" ) -func ErrorHandler(perr error, popts ...func(psdkErr ISdkError)) ISdkError { +func ErrorHandler(perr error, popts ...func(psdkErr IError)) IError { sdkErr := &SdkError{ error: perr, errorCode: EcUnknownError, @@ -30,7 +30,7 @@ func ErrorHandler(perr error, popts ...func(psdkErr ISdkError)) ISdkError { return sdkErr } -func SdkErrorHandler(psdkErr ISdkError, perrResp IErrorRespone, popts ...func(psdkErr ISdkError)) ISdkError { +func SdkErrorHandler(psdkErr IError, perrResp IErrorRespone, popts ...func(psdkErr IError)) IError { if psdkErr == nil && perrResp == nil { return nil } @@ -54,24 +54,24 @@ func SdkErrorHandler(psdkErr ISdkError, perrResp IErrorRespone, popts ...func(ps return psdkErr } -func WithErrorInternalServerError() func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorInternalServerError() func(IError) { + return func(sdkErr IError) { sdkErr.WithErrorCode(EcInternalServerError). WithMessage("Internal Server Error"). WithErrors(lfmt.Errorf("internal server error from making request to external service")) } } -func WithErrorPermissionDenied() func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorPermissionDenied() func(IError) { + return func(sdkErr IError) { sdkErr.WithErrorCode(EcPermissionDenied). WithMessage("Permission Denied"). WithErrors(lfmt.Errorf("permission denied when making request to external service")) } } -func WithErrorOutOfPoc(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorOutOfPoc(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -85,8 +85,8 @@ func WithErrorOutOfPoc(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorPagingInvalid(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorPagingInvalid(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -100,8 +100,8 @@ func WithErrorPagingInvalid(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorUnexpected() func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorUnexpected() func(IError) { + return func(sdkErr IError) { sdkErr.WithErrorCode(EcUnexpectedError). WithMessage("Unexpected Error"). WithErrors(lfmt.Errorf("unexpected error from making request to external service")) diff --git a/vngcloud/sdk_error/endpoint.go b/vngcloud/sdk_error/endpoint.go index 61f19b0..5561dc6 100644 --- a/vngcloud/sdk_error/endpoint.go +++ b/vngcloud/sdk_error/endpoint.go @@ -2,8 +2,8 @@ package sdk_error import lstr "strings" -func WithErrorEndpointStatusInvalid(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorEndpointStatusInvalid(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -16,8 +16,8 @@ func WithErrorEndpointStatusInvalid(perrResp IErrorRespone) func(sdkError ISdkEr } } -func WithErrorEndpointOfVpcExists(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorEndpointOfVpcExists(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -30,8 +30,8 @@ func WithErrorEndpointOfVpcExists(perrResp IErrorRespone) func(sdkError ISdkErro } } -func WithErrorEndpointPackageNotBelongToEndpointService(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorEndpointPackageNotBelongToEndpointService(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -44,8 +44,8 @@ func WithErrorEndpointPackageNotBelongToEndpointService(perrResp IErrorRespone) } } -func WithErrorContainInvalidCharacter(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorContainInvalidCharacter(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -58,8 +58,8 @@ func WithErrorContainInvalidCharacter(perrResp IErrorRespone) func(sdkError ISdk } } -func WithErrorLockOnProcess(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLockOnProcess(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/identity.go b/vngcloud/sdk_error/identity.go index 63134d5..0400d1e 100644 --- a/vngcloud/sdk_error/identity.go +++ b/vngcloud/sdk_error/identity.go @@ -4,8 +4,8 @@ import ( lfmt "fmt" ) -func WithErrorAuthenticationFailed(perrResp IErrorRespone) func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorAuthenticationFailed(perrResp IErrorRespone) func(IError) { + return func(sdkErr IError) { if perrResp == nil { return } @@ -22,16 +22,16 @@ func WithErrorAuthenticationFailed(perrResp IErrorRespone) func(ISdkError) { } } -func WithErrorReauthFuncNotSet() func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorReauthFuncNotSet() func(IError) { + return func(sdkErr IError) { sdkErr.WithErrorCode(EcReauthFuncNotSet). WithMessage("Reauthentication function is not configured"). WithErrors(lfmt.Errorf("reauthentication function is not configured")) } } -func WithErrorTooManyFailedLogin(perrResp IErrorRespone) func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorTooManyFailedLogin(perrResp IErrorRespone) func(IError) { + return func(sdkErr IError) { if perrResp == nil { return } @@ -48,8 +48,8 @@ func WithErrorTooManyFailedLogin(perrResp IErrorRespone) func(ISdkError) { } } -func WithErrorUnknownAuthFailure(perrResp IErrorRespone) func(ISdkError) { - return func(sdkErr ISdkError) { +func WithErrorUnknownAuthFailure(perrResp IErrorRespone) func(IError) { + return func(sdkErr IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/isdk_error.go b/vngcloud/sdk_error/isdk_error.go index f0e0de1..c6ef74a 100644 --- a/vngcloud/sdk_error/isdk_error.go +++ b/vngcloud/sdk_error/isdk_error.go @@ -1,14 +1,14 @@ package sdk_error -type ISdkError interface { +type IError interface { IsError(perrCode ErrorCode) bool IsErrorAny(perrCodes ...ErrorCode) bool - WithErrorCode(perrCode ErrorCode) ISdkError - WithMessage(pmsg string) ISdkError - WithErrors(perrs ...error) ISdkError - WithParameters(pparams map[string]interface{}) ISdkError - WithKVparameters(pparams ...interface{}) ISdkError + WithErrorCode(perrCode ErrorCode) IError + WithMessage(pmsg string) IError + WithErrors(perrs ...error) IError + WithParameters(pparams map[string]interface{}) IError + WithKVparameters(pparams ...interface{}) IError GetError() error GetMessage() string diff --git a/vngcloud/sdk_error/loadbalancer.go b/vngcloud/sdk_error/loadbalancer.go index 333c312..48b95f2 100644 --- a/vngcloud/sdk_error/loadbalancer.go +++ b/vngcloud/sdk_error/loadbalancer.go @@ -28,8 +28,8 @@ var ( regexErrorPoolIsUpdating = lregexp.MustCompile(patternPoolIsUpdating) ) -func WithErrorLoadBalancerNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLoadBalancerNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -45,8 +45,8 @@ func WithErrorLoadBalancerNotFound(perrResp IErrorRespone) func(sdkError ISdkErr } // WithErrorLoadBalancerNotFound2 indicate the issue creating Pool with non-existed LoadBalancer -func WithErrorLoadBalancerNotFound2(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLoadBalancerNotFound2(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -60,8 +60,8 @@ func WithErrorLoadBalancerNotFound2(perrResp IErrorRespone) func(sdkError ISdkEr } } -func WithErrorLoadBalancerExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLoadBalancerExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -75,8 +75,8 @@ func WithErrorLoadBalancerExceedQuota(perrResp IErrorRespone) func(sdkError ISdk } } -func WithErrorLoadBalancerDuplicatePoolName(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLoadBalancerDuplicatePoolName(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -90,8 +90,8 @@ func WithErrorLoadBalancerDuplicatePoolName(perrResp IErrorRespone) func(sdkErro } } -func WithErrorListenerDuplicateProtocolOrPort(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorListenerDuplicateProtocolOrPort(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -105,8 +105,8 @@ func WithErrorListenerDuplicateProtocolOrPort(perrResp IErrorRespone) func(sdkEr } } -func WithErrorListenerDuplicateName(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorListenerDuplicateName(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -120,8 +120,8 @@ func WithErrorListenerDuplicateName(perrResp IErrorRespone) func(sdkError ISdkEr } } -func WithErrorPoolNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorPoolNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -135,8 +135,8 @@ func WithErrorPoolNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorPoolInUse(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorPoolInUse(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -150,8 +150,8 @@ func WithErrorPoolInUse(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorLoadBalancerNotReady(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorLoadBalancerNotReady(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -167,8 +167,8 @@ func WithErrorLoadBalancerNotReady(perrResp IErrorRespone) func(sdkError ISdkErr } } -func WithErrorListenerNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorListenerNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -182,8 +182,8 @@ func WithErrorListenerNotFound(perrResp IErrorRespone) func(sdkError ISdkError) } } -func WithErrorMemberMustIdentical(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorMemberMustIdentical(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/network.go b/vngcloud/sdk_error/network.go index d4f3b74..3dae369 100644 --- a/vngcloud/sdk_error/network.go +++ b/vngcloud/sdk_error/network.go @@ -16,8 +16,8 @@ var ( regexErrorSubnetNotBelongNetwork = lregexp.MustCompile(patternSubnetNotBelongNetwork) ) -func WithErrorNetworkNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorNetworkNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -31,8 +31,8 @@ func WithErrorNetworkNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorSubnetNotBelongNetwork(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSubnetNotBelongNetwork(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -46,8 +46,8 @@ func WithErrorSubnetNotBelongNetwork(perrResp IErrorRespone) func(sdkError ISdkE } } -func WithErrorSubnetNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSubnetNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/quota.go b/vngcloud/sdk_error/quota.go index 27c38bc..32f6165 100644 --- a/vngcloud/sdk_error/quota.go +++ b/vngcloud/sdk_error/quota.go @@ -2,8 +2,8 @@ package sdk_error import lfmt "fmt" -func WithErrorQuotaNotFound(_ IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorQuotaNotFound(_ IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { sdkError.WithErrorCode(EcVServerQuotaNotFound). WithMessage("Quota not found"). WithErrors(lfmt.Errorf("quota not found")) diff --git a/vngcloud/sdk_error/sdk_error.go b/vngcloud/sdk_error/sdk_error.go index 50bd490..e9be12e 100644 --- a/vngcloud/sdk_error/sdk_error.go +++ b/vngcloud/sdk_error/sdk_error.go @@ -6,7 +6,7 @@ import ( ) var ( - _ ISdkError = new(SdkError) + _ IError = new(SdkError) ) type ( @@ -34,17 +34,17 @@ func (s *SdkError) IsErrorAny(perrCodes ...ErrorCode) bool { return false } -func (s *SdkError) WithErrorCode(perrCode ErrorCode) ISdkError { +func (s *SdkError) WithErrorCode(perrCode ErrorCode) IError { s.errorCode = perrCode return s } -func (s *SdkError) WithMessage(pmsg string) ISdkError { +func (s *SdkError) WithMessage(pmsg string) IError { s.message = pmsg return s } -func (s *SdkError) WithErrors(perrs ...error) ISdkError { +func (s *SdkError) WithErrors(perrs ...error) IError { if len(perrs) == 0 { return s } @@ -61,7 +61,7 @@ func (s *SdkError) WithErrors(perrs ...error) ISdkError { return s } -func (s *SdkError) WithParameters(pparams map[string]interface{}) ISdkError { +func (s *SdkError) WithParameters(pparams map[string]interface{}) IError { if s.parameters == nil { s.parameters = pparams return s @@ -74,7 +74,7 @@ func (s *SdkError) WithParameters(pparams map[string]interface{}) ISdkError { return s } -func (s *SdkError) WithKVparameters(pparams ...interface{}) ISdkError { +func (s *SdkError) WithKVparameters(pparams ...interface{}) IError { if s.parameters == nil { s.parameters = make(map[string]interface{}) } diff --git a/vngcloud/sdk_error/secgroup.go b/vngcloud/sdk_error/secgroup.go index 8d32094..cfbb65a 100644 --- a/vngcloud/sdk_error/secgroup.go +++ b/vngcloud/sdk_error/secgroup.go @@ -9,8 +9,8 @@ const ( patternSecgroupInUse = "securitygroupinuse" ) -func WithErrorSecgroupNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -24,8 +24,8 @@ func WithErrorSecgroupNotFound(perrResp IErrorRespone) func(sdkError ISdkError) } } -func WithErrorSecgroupNameAlreadyExists(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupNameAlreadyExists(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -39,8 +39,8 @@ func WithErrorSecgroupNameAlreadyExists(perrResp IErrorRespone) func(sdkError IS } } -func WithErrorSecgroupExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -54,8 +54,8 @@ func WithErrorSecgroupExceedQuota(perrResp IErrorRespone) func(sdkError ISdkErro } } -func WithErrorSecgroupInUse(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupInUse(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/secgroup_rule.go b/vngcloud/sdk_error/secgroup_rule.go index 4fa33e0..0da0f7f 100644 --- a/vngcloud/sdk_error/secgroup_rule.go +++ b/vngcloud/sdk_error/secgroup_rule.go @@ -8,8 +8,8 @@ const ( patternSecgroupRuleExceedQuota = "exceeded secgroup_rule quota" ) -func WithErrorSecgroupRuleNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupRuleNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -23,8 +23,8 @@ func WithErrorSecgroupRuleNotFound(perrResp IErrorRespone) func(sdkError ISdkErr } } -func WithErrorSecgroupRuleAlreadyExists(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupRuleAlreadyExists(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -38,8 +38,8 @@ func WithErrorSecgroupRuleAlreadyExists(perrResp IErrorRespone) func(sdkError IS } } -func WithErrorSecgroupRuleExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSecgroupRuleExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/server.go b/vngcloud/sdk_error/server.go index 85c3d60..b84dedf 100644 --- a/vngcloud/sdk_error/server.go +++ b/vngcloud/sdk_error/server.go @@ -16,8 +16,8 @@ const ( patternServerUpdatingSecgroups = "cannot change security group of server with status changing-security-group" ) -func WithErrorServerNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -31,8 +31,8 @@ func WithErrorServerNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorServerFlavorSystemExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerFlavorSystemExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -46,8 +46,8 @@ func WithErrorServerFlavorSystemExceedQuota(perrResp IErrorRespone) func(sdkErro } } -func WithErrorServerDeleteCreatingServer(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerDeleteCreatingServer(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -61,8 +61,8 @@ func WithErrorServerDeleteCreatingServer(perrResp IErrorRespone) func(sdkError I } } -func WithErrorServerExpired(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerExpired(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -76,8 +76,8 @@ func WithErrorServerExpired(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorServerUpdatingSecgroups(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerUpdatingSecgroups(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -91,8 +91,8 @@ func WithErrorServerUpdatingSecgroups(perrResp IErrorRespone) func(sdkError ISdk } } -func WithErrorServerExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -106,8 +106,8 @@ func WithErrorServerExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) } } -func WithErrorServerDeleteDeletingServer(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerDeleteDeletingServer(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -121,8 +121,8 @@ func WithErrorServerDeleteDeletingServer(perrResp IErrorRespone) func(sdkError I } } -func WithErrorServerDeleteBillingServer(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerDeleteBillingServer(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -136,8 +136,8 @@ func WithErrorServerDeleteBillingServer(perrResp IErrorRespone) func(sdkError IS } } -func WithErrorServerCreateBillingPaymentMethodNotAllowed(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerCreateBillingPaymentMethodNotAllowed(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -151,8 +151,8 @@ func WithErrorServerCreateBillingPaymentMethodNotAllowed(perrResp IErrorRespone) } } -func WithErrorServerAttachVolumeQuotaExceeded(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerAttachVolumeQuotaExceeded(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -166,8 +166,8 @@ func WithErrorServerAttachVolumeQuotaExceeded(perrResp IErrorRespone) func(sdkEr } } -func WithErrorServerAttachEncryptedVolume(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorServerAttachEncryptedVolume(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/snapshot.go b/vngcloud/sdk_error/snapshot.go index 6601c37..acf3cb1 100644 --- a/vngcloud/sdk_error/snapshot.go +++ b/vngcloud/sdk_error/snapshot.go @@ -7,8 +7,8 @@ const ( patternSnapshotNotFound = "not found snapshot-volume-point" ) -func WithErrorSnapshotNameNotValid(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSnapshotNameNotValid(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -22,8 +22,8 @@ func WithErrorSnapshotNameNotValid(perrResp IErrorRespone) func(sdkError ISdkErr } } -func WithErrorSnapshotNameNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorSnapshotNameNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/volume.go b/vngcloud/sdk_error/volume.go index 217361d..128230e 100644 --- a/vngcloud/sdk_error/volume.go +++ b/vngcloud/sdk_error/volume.go @@ -34,8 +34,8 @@ var ( regexErrorVolumeNotFound = lregexp.MustCompile(patternVolumeNotFound) ) -func WithErrorVolumeNameNotValid(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeNameNotValid(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -49,8 +49,8 @@ func WithErrorVolumeNameNotValid(perrResp IErrorRespone) func(sdkError ISdkError } } -func WithErrorVolumeSizeOutOfRange(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeSizeOutOfRange(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -65,8 +65,8 @@ func WithErrorVolumeSizeOutOfRange(perrResp IErrorRespone) func(sdkError ISdkErr } } -func WithErrorVolumeSizeExceedGlobalQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeSizeExceedGlobalQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -80,8 +80,8 @@ func WithErrorVolumeSizeExceedGlobalQuota(perrResp IErrorRespone) func(sdkError } } -func WithErrorVolumeExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeExceedQuota(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -95,8 +95,8 @@ func WithErrorVolumeExceedQuota(perrResp IErrorRespone) func(sdkError ISdkError) } } -func WithErrorVolumeNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -112,8 +112,8 @@ func WithErrorVolumeNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { } // WithErrorVolumeAvailable indicates that the volume is AVAILABLE state but try to make detach this volume out of server -func WithErrorVolumeAvailable(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeAvailable(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -127,8 +127,8 @@ func WithErrorVolumeAvailable(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorVolumeAlreadyAttached(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeAlreadyAttached(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -142,8 +142,8 @@ func WithErrorVolumeAlreadyAttached(perrResp IErrorRespone) func(sdkError ISdkEr } } -func WithErrorVolumeAlreadyAttachedThisServer(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeAlreadyAttachedThisServer(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -157,8 +157,8 @@ func WithErrorVolumeAlreadyAttachedThisServer(perrResp IErrorRespone) func(sdkEr } } -func WithErrorVolumeInProcess(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeInProcess(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -172,8 +172,8 @@ func WithErrorVolumeInProcess(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorVolumeUnchanged(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeUnchanged(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -187,8 +187,8 @@ func WithErrorVolumeUnchanged(perrResp IErrorRespone) func(sdkError ISdkError) { } } -func WithErrorVolumeMustSameZone(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMustSameZone(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -202,8 +202,8 @@ func WithErrorVolumeMustSameZone(perrResp IErrorRespone) func(sdkError ISdkError } } -func WithErrorVolumeMigrateMissingInit(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateMissingInit(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -217,8 +217,8 @@ func WithErrorVolumeMigrateMissingInit(perrResp IErrorRespone) func(sdkError ISd } } -func WithErrorVolumeMigrateNeedProcess(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateNeedProcess(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -232,8 +232,8 @@ func WithErrorVolumeMigrateNeedProcess(perrResp IErrorRespone) func(sdkError ISd } } -func WithErrorVolumeMigrateNeedConfirm(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateNeedConfirm(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -247,8 +247,8 @@ func WithErrorVolumeMigrateNeedConfirm(perrResp IErrorRespone) func(sdkError ISd } } -func WithErrorVolumeMigrateBeingProcess(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateBeingProcess(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -262,8 +262,8 @@ func WithErrorVolumeMigrateBeingProcess(perrResp IErrorRespone) func(sdkError IS } } -func WithErrorVolumeMigrateBeingFinish(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateBeingFinish(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -277,8 +277,8 @@ func WithErrorVolumeMigrateBeingFinish(perrResp IErrorRespone) func(sdkError ISd } } -func WithErrorVolumeMigrateProcessingConfirm(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateProcessingConfirm(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -294,8 +294,8 @@ func WithErrorVolumeMigrateProcessingConfirm(perrResp IErrorRespone) func(sdkErr // -func WithErrorVolumeMigrateBeingMigrating(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateBeingMigrating(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -309,8 +309,8 @@ func WithErrorVolumeMigrateBeingMigrating(perrResp IErrorRespone) func(sdkError } } -func WithErrorVolumeMigrateInSameZone(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeMigrateInSameZone(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } @@ -324,8 +324,8 @@ func WithErrorVolumeMigrateInSameZone(perrResp IErrorRespone) func(sdkError ISdk } } -func WithErrorVolumeIsMigrating(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeIsMigrating(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/sdk_error/volumetype.go b/vngcloud/sdk_error/volumetype.go index 151fd62..b74af97 100644 --- a/vngcloud/sdk_error/volumetype.go +++ b/vngcloud/sdk_error/volumetype.go @@ -6,8 +6,8 @@ const ( patternVolumeTypeNotFound = "cannot get volume type with id" ) -func WithErrorVolumeTypeNotFound(perrResp IErrorRespone) func(sdkError ISdkError) { - return func(sdkError ISdkError) { +func WithErrorVolumeTypeNotFound(perrResp IErrorRespone) func(sdkError IError) { + return func(sdkError IError) { if perrResp == nil { return } diff --git a/vngcloud/services/compute/icompute.go b/vngcloud/services/compute/icompute.go index 7808fb9..fedfb50 100644 --- a/vngcloud/services/compute/icompute.go +++ b/vngcloud/services/compute/icompute.go @@ -7,10 +7,10 @@ import ( ) type IComputeServiceV2 interface { - CreateServer(popts lscomputeSvcV2.ICreateServerRequest) (*lsentity.Server, lserr.ISdkError) - GetServerById(popts lscomputeSvcV2.IGetServerByIdRequest) (*lsentity.Server, lserr.ISdkError) - DeleteServerById(popts lscomputeSvcV2.IDeleteServerByIdRequest) lserr.ISdkError - UpdateServerSecgroupsByServerId(popts lscomputeSvcV2.IUpdateServerSecgroupsByServerIdRequest) (*lsentity.Server, lserr.ISdkError) - AttachBlockVolume(popts lscomputeSvcV2.IAttachBlockVolumeRequest) lserr.ISdkError - DetachBlockVolume(popts lscomputeSvcV2.IDetachBlockVolumeRequest) lserr.ISdkError + CreateServer(popts lscomputeSvcV2.ICreateServerRequest) (*lsentity.Server, lserr.IError) + GetServerById(popts lscomputeSvcV2.IGetServerByIdRequest) (*lsentity.Server, lserr.IError) + DeleteServerById(popts lscomputeSvcV2.IDeleteServerByIdRequest) lserr.IError + UpdateServerSecgroupsByServerId(popts lscomputeSvcV2.IUpdateServerSecgroupsByServerIdRequest) (*lsentity.Server, lserr.IError) + AttachBlockVolume(popts lscomputeSvcV2.IAttachBlockVolumeRequest) lserr.IError + DetachBlockVolume(popts lscomputeSvcV2.IDetachBlockVolumeRequest) lserr.IError } diff --git a/vngcloud/services/compute/v2/server.go b/vngcloud/services/compute/v2/server.go index d4aa834..c15d9ea 100644 --- a/vngcloud/services/compute/v2/server.go +++ b/vngcloud/services/compute/v2/server.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *ComputeServiceV2) CreateServer(popts ICreateServerRequest) (*lsentity.Server, lserr.ISdkError) { +func (s *ComputeServiceV2) CreateServer(popts ICreateServerRequest) (*lsentity.Server, lserr.IError) { url := createServerUrl(s.VServerClient) resp := new(CreateServerResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -32,7 +32,7 @@ func (s *ComputeServiceV2) CreateServer(popts ICreateServerRequest) (*lsentity.S return resp.ToEntityServer(), nil } -func (s *ComputeServiceV2) GetServerById(popts IGetServerByIdRequest) (*lsentity.Server, lserr.ISdkError) { +func (s *ComputeServiceV2) GetServerById(popts IGetServerByIdRequest) (*lsentity.Server, lserr.IError) { url := getServerByIdUrl(s.VServerClient, popts) resp := new(GetServerByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -51,7 +51,7 @@ func (s *ComputeServiceV2) GetServerById(popts IGetServerByIdRequest) (*lsentity return resp.ToEntityServer(), nil } -func (s *ComputeServiceV2) DeleteServerById(popts IDeleteServerByIdRequest) lserr.ISdkError { +func (s *ComputeServiceV2) DeleteServerById(popts IDeleteServerByIdRequest) lserr.IError { url := deleteServerByIdUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -72,7 +72,7 @@ func (s *ComputeServiceV2) DeleteServerById(popts IDeleteServerByIdRequest) lser return nil } -func (s *ComputeServiceV2) UpdateServerSecgroupsByServerId(popts IUpdateServerSecgroupsByServerIdRequest) (*lsentity.Server, lserr.ISdkError) { +func (s *ComputeServiceV2) UpdateServerSecgroupsByServerId(popts IUpdateServerSecgroupsByServerIdRequest) (*lsentity.Server, lserr.IError) { url := updateServerSecgroupsByServerIdUrl(s.VServerClient, popts) resp := new(UpdateServerSecgroupsByServerIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -96,7 +96,7 @@ func (s *ComputeServiceV2) UpdateServerSecgroupsByServerId(popts IUpdateServerSe return resp.ToEntityServer(), nil } -func (s *ComputeServiceV2) AttachBlockVolume(popts IAttachBlockVolumeRequest) lserr.ISdkError { +func (s *ComputeServiceV2) AttachBlockVolume(popts IAttachBlockVolumeRequest) lserr.IError { url := attachBlockVolumeUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -122,7 +122,7 @@ func (s *ComputeServiceV2) AttachBlockVolume(popts IAttachBlockVolumeRequest) ls return nil } -func (s *ComputeServiceV2) DetachBlockVolume(popts IDetachBlockVolumeRequest) lserr.ISdkError { +func (s *ComputeServiceV2) DetachBlockVolume(popts IDetachBlockVolumeRequest) lserr.IError { url := detachBlockVolumeUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). diff --git a/vngcloud/services/identity/iidentity.go b/vngcloud/services/identity/iidentity.go index 61f2039..2456d10 100644 --- a/vngcloud/services/identity/iidentity.go +++ b/vngcloud/services/identity/iidentity.go @@ -7,5 +7,5 @@ import ( ) type IIdentityServiceV2 interface { - GetAccessToken(popts lsidentitySvcV2.IGetAccessTokenRequest) (*lsentity.AccessToken, lsdkErr.ISdkError) + GetAccessToken(popts lsidentitySvcV2.IGetAccessTokenRequest) (*lsentity.AccessToken, lsdkErr.IError) } diff --git a/vngcloud/services/identity/v2/identity.go b/vngcloud/services/identity/v2/identity.go index c80a3de..bda02cc 100644 --- a/vngcloud/services/identity/v2/identity.go +++ b/vngcloud/services/identity/v2/identity.go @@ -8,7 +8,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *IdentityServiceV2) GetAccessToken(popts IGetAccessTokenRequest) (*lsentity.AccessToken, lserr.ISdkError) { +func (s *IdentityServiceV2) GetAccessToken(popts IGetAccessTokenRequest) (*lsentity.AccessToken, lserr.IError) { url := getAccessTokenUrl(s.IamClient) resp := new(GetAccessTokenResponse) errResp := lserr.NewErrorResponse(lserr.IamErrorType) diff --git a/vngcloud/services/loadbalancer/iloadbalancer.go b/vngcloud/services/loadbalancer/iloadbalancer.go index 9991fc7..22eca67 100644 --- a/vngcloud/services/loadbalancer/iloadbalancer.go +++ b/vngcloud/services/loadbalancer/iloadbalancer.go @@ -8,24 +8,24 @@ import ( ) type ILoadBalancerServiceV2 interface { - CreateLoadBalancer(popts lslbSvcV2.ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.ISdkError) - GetLoadBalancerById(popts lslbSvcV2.IGetLoadBalancerByIdRequest) (*lsentity.LoadBalancer, lserr.ISdkError) - ListLoadBalancers(popts lslbSvcV2.IListLoadBalancersRequest) (*lsentity.ListLoadBalancers, lserr.ISdkError) - CreatePool(popts lslbSvcV2.ICreatePoolRequest) (*lsentity.Pool, lserr.ISdkError) - CreateListener(popts lslbSvcV2.ICreateListenerRequest) (*lsentity.Listener, lserr.ISdkError) - UpdateListener(popts lslbSvcV2.IUpdateListenerRequest) lserr.ISdkError - ListListenersByLoadBalancerId(popts lslbSvcV2.IListListenersByLoadBalancerIdRequest) (*lsentity.ListListeners, lserr.ISdkError) - ListPoolsByLoadBalancerId(popts lslbSvcV2.IListPoolsByLoadBalancerIdRequest) (*lsentity.ListPools, lserr.ISdkError) - UpdatePoolMembers(popts lslbSvcV2.IUpdatePoolMembersRequest) lserr.ISdkError - ListPoolMembers(popts lslbSvcV2.IListPoolMembersRequest) (*lsentity.ListMembers, lserr.ISdkError) - DeletePoolById(popt lslbSvcV2.IDeletePoolByIdRequest) lserr.ISdkError - DeleteListenerById(popts lslbSvcV2.IDeleteListenerByIdRequest) lserr.ISdkError - DeleteLoadBalancerById(popts lslbSvcV2.IDeleteLoadBalancerByIdRequest) lserr.ISdkError - ListTags(popts lslbSvcV2.IListTagsRequest) (*lsentity.ListTags, lserr.ISdkError) - CreateTags(popts lslbSvcV2.ICreateTagsRequest) lserr.ISdkError - UpdateTags(popts lslbSvcV2.IUpdateTagsRequest) lserr.ISdkError + CreateLoadBalancer(popts lslbSvcV2.ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.IError) + GetLoadBalancerById(popts lslbSvcV2.IGetLoadBalancerByIdRequest) (*lsentity.LoadBalancer, lserr.IError) + ListLoadBalancers(popts lslbSvcV2.IListLoadBalancersRequest) (*lsentity.ListLoadBalancers, lserr.IError) + CreatePool(popts lslbSvcV2.ICreatePoolRequest) (*lsentity.Pool, lserr.IError) + CreateListener(popts lslbSvcV2.ICreateListenerRequest) (*lsentity.Listener, lserr.IError) + UpdateListener(popts lslbSvcV2.IUpdateListenerRequest) lserr.IError + ListListenersByLoadBalancerId(popts lslbSvcV2.IListListenersByLoadBalancerIdRequest) (*lsentity.ListListeners, lserr.IError) + ListPoolsByLoadBalancerId(popts lslbSvcV2.IListPoolsByLoadBalancerIdRequest) (*lsentity.ListPools, lserr.IError) + UpdatePoolMembers(popts lslbSvcV2.IUpdatePoolMembersRequest) lserr.IError + ListPoolMembers(popts lslbSvcV2.IListPoolMembersRequest) (*lsentity.ListMembers, lserr.IError) + DeletePoolById(popt lslbSvcV2.IDeletePoolByIdRequest) lserr.IError + DeleteListenerById(popts lslbSvcV2.IDeleteListenerByIdRequest) lserr.IError + DeleteLoadBalancerById(popts lslbSvcV2.IDeleteLoadBalancerByIdRequest) lserr.IError + ListTags(popts lslbSvcV2.IListTagsRequest) (*lsentity.ListTags, lserr.IError) + CreateTags(popts lslbSvcV2.ICreateTagsRequest) lserr.IError + UpdateTags(popts lslbSvcV2.IUpdateTagsRequest) lserr.IError } type ILoadBalancerServiceInternal interface { - CreateLoadBalancer(popts lslbSvcIn.ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.ISdkError) + CreateLoadBalancer(popts lslbSvcIn.ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.IError) } diff --git a/vngcloud/services/loadbalancer/inter/loadbalancer.go b/vngcloud/services/loadbalancer/inter/loadbalancer.go index 7ae7e79..4b295cb 100644 --- a/vngcloud/services/loadbalancer/inter/loadbalancer.go +++ b/vngcloud/services/loadbalancer/inter/loadbalancer.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *LoadBalancerServiceInternal) CreateLoadBalancer(popts ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.ISdkError) { +func (s *LoadBalancerServiceInternal) CreateLoadBalancer(popts ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.IError) { url := createLoadBalancerUrl(s.VLBClient) resp := new(CreateLoadBalancerResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/loadbalancer/v2/loadbalancer.go b/vngcloud/services/loadbalancer/v2/loadbalancer.go index 6111cf2..424e2be 100644 --- a/vngcloud/services/loadbalancer/v2/loadbalancer.go +++ b/vngcloud/services/loadbalancer/v2/loadbalancer.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *LoadBalancerServiceV2) CreateLoadBalancer(popts ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) CreateLoadBalancer(popts ICreateLoadBalancerRequest) (*lsentity.LoadBalancer, lserr.IError) { url := createLoadBalancerUrl(s.VLBClient) resp := new(CreateLoadBalancerResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -25,7 +25,7 @@ func (s *LoadBalancerServiceV2) CreateLoadBalancer(popts ICreateLoadBalancerRequ return resp.ToEntityLoadBalancer(), nil } -func (s *LoadBalancerServiceV2) GetLoadBalancerById(popts IGetLoadBalancerByIdRequest) (*lsentity.LoadBalancer, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) GetLoadBalancerById(popts IGetLoadBalancerByIdRequest) (*lsentity.LoadBalancer, lserr.IError) { url := getLoadBalancerByIdUrl(s.VLBClient, popts) resp := new(GetLoadBalancerByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -44,7 +44,7 @@ func (s *LoadBalancerServiceV2) GetLoadBalancerById(popts IGetLoadBalancerByIdRe return resp.ToEntityLoadBalancer(), nil } -func (s *LoadBalancerServiceV2) ListLoadBalancers(popts IListLoadBalancersRequest) (*lsentity.ListLoadBalancers, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) ListLoadBalancers(popts IListLoadBalancersRequest) (*lsentity.ListLoadBalancers, lserr.IError) { url := listLoadBalancersUrl(s.VLBClient, popts) resp := new(ListLoadBalancersResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -61,7 +61,7 @@ func (s *LoadBalancerServiceV2) ListLoadBalancers(popts IListLoadBalancersReques return resp.ToEntityListLoadBalancers(), nil } -func (s *LoadBalancerServiceV2) CreatePool(popts ICreatePoolRequest) (*lsentity.Pool, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) CreatePool(popts ICreatePoolRequest) (*lsentity.Pool, lserr.IError) { url := createPoolUrl(s.VLBClient, popts) resp := new(CreatePoolResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -84,7 +84,7 @@ func (s *LoadBalancerServiceV2) CreatePool(popts ICreatePoolRequest) (*lsentity. return resp.ToEntityPool(), nil } -func (s *LoadBalancerServiceV2) CreateListener(popts ICreateListenerRequest) (*lsentity.Listener, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) CreateListener(popts ICreateListenerRequest) (*lsentity.Listener, lserr.IError) { url := createListenerUrl(s.VLBClient, popts) resp := new(CreateListenerResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -108,7 +108,7 @@ func (s *LoadBalancerServiceV2) CreateListener(popts ICreateListenerRequest) (*l return resp.ToEntityListener(), nil } -func (s *LoadBalancerServiceV2) UpdateListener(popts IUpdateListenerRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) UpdateListener(popts IUpdateListenerRequest) lserr.IError { url := updateListenerUrl(s.VLBClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -127,7 +127,7 @@ func (s *LoadBalancerServiceV2) UpdateListener(popts IUpdateListenerRequest) lse return nil } -func (s *LoadBalancerServiceV2) ListListenersByLoadBalancerId(popts IListListenersByLoadBalancerIdRequest) (*lsentity.ListListeners, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) ListListenersByLoadBalancerId(popts IListListenersByLoadBalancerIdRequest) (*lsentity.ListListeners, lserr.IError) { url := listListenersByLoadBalancerIdUrl(s.VLBClient, popts) resp := new(ListListenersByLoadBalancerIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -146,7 +146,7 @@ func (s *LoadBalancerServiceV2) ListListenersByLoadBalancerId(popts IListListene return resp.ToEntityListListeners(), nil } -func (s *LoadBalancerServiceV2) ListPoolsByLoadBalancerId(popts IListPoolsByLoadBalancerIdRequest) (*lsentity.ListPools, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) ListPoolsByLoadBalancerId(popts IListPoolsByLoadBalancerIdRequest) (*lsentity.ListPools, lserr.IError) { url := listPoolsByLoadBalancerIdUrl(s.VLBClient, popts) resp := new(ListPoolsByLoadBalancerIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -165,7 +165,7 @@ func (s *LoadBalancerServiceV2) ListPoolsByLoadBalancerId(popts IListPoolsByLoad return resp.ToEntityListPools(), nil } -func (s *LoadBalancerServiceV2) UpdatePoolMembers(popts IUpdatePoolMembersRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) UpdatePoolMembers(popts IUpdatePoolMembersRequest) lserr.IError { url := updatePoolMembersUrl(s.VLBClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -185,7 +185,7 @@ func (s *LoadBalancerServiceV2) UpdatePoolMembers(popts IUpdatePoolMembersReques return nil } -func (s *LoadBalancerServiceV2) ListPoolMembers(popts IListPoolMembersRequest) (*lsentity.ListMembers, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) ListPoolMembers(popts IListPoolMembersRequest) (*lsentity.ListMembers, lserr.IError) { url := listPoolMembersUrl(s.VLBClient, popts) resp := new(ListPoolMembersResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -204,7 +204,7 @@ func (s *LoadBalancerServiceV2) ListPoolMembers(popts IListPoolMembersRequest) ( return resp.ToEntityListMembers(), nil } -func (s *LoadBalancerServiceV2) DeletePoolById(popts IDeletePoolByIdRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) DeletePoolById(popts IDeletePoolByIdRequest) lserr.IError { url := deletePoolByIdUrl(s.VLBClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -222,7 +222,7 @@ func (s *LoadBalancerServiceV2) DeletePoolById(popts IDeletePoolByIdRequest) lse return nil } -func (s *LoadBalancerServiceV2) DeleteListenerById(popts IDeleteListenerByIdRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) DeleteListenerById(popts IDeleteListenerByIdRequest) lserr.IError { url := deleteListenerByIdUrl(s.VLBClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -240,7 +240,7 @@ func (s *LoadBalancerServiceV2) DeleteListenerById(popts IDeleteListenerByIdRequ return nil } -func (s *LoadBalancerServiceV2) DeleteLoadBalancerById(popts IDeleteLoadBalancerByIdRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) DeleteLoadBalancerById(popts IDeleteLoadBalancerByIdRequest) lserr.IError { url := deleteLoadBalancerByIdUrl(s.VLBClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). diff --git a/vngcloud/services/loadbalancer/v2/tag.go b/vngcloud/services/loadbalancer/v2/tag.go index 8e36ac1..99da37c 100644 --- a/vngcloud/services/loadbalancer/v2/tag.go +++ b/vngcloud/services/loadbalancer/v2/tag.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *LoadBalancerServiceV2) ListTags(popts IListTagsRequest) (*lsentity.ListTags, lserr.ISdkError) { +func (s *LoadBalancerServiceV2) ListTags(popts IListTagsRequest) (*lsentity.ListTags, lserr.IError) { url := listTagsUrl(s.VServerClient, popts) resp := new(ListTagsResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -23,7 +23,7 @@ func (s *LoadBalancerServiceV2) ListTags(popts IListTagsRequest) (*lsentity.List return resp.ToEntityListTags(), nil } -func (s *LoadBalancerServiceV2) CreateTags(popts ICreateTagsRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) CreateTags(popts ICreateTagsRequest) lserr.IError { url := createTagsUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -39,7 +39,7 @@ func (s *LoadBalancerServiceV2) CreateTags(popts ICreateTagsRequest) lserr.ISdkE return nil } -func (s *LoadBalancerServiceV2) UpdateTags(popts IUpdateTagsRequest) lserr.ISdkError { +func (s *LoadBalancerServiceV2) UpdateTags(popts IUpdateTagsRequest) lserr.IError { tags, sdkErr := s.ListTags(NewListTagsRequest(popts.GetLoadBalancerId())) if sdkErr != nil { return sdkErr diff --git a/vngcloud/services/network/inetwork.go b/vngcloud/services/network/inetwork.go index 7c59a34..7ccaaf0 100644 --- a/vngcloud/services/network/inetwork.go +++ b/vngcloud/services/network/inetwork.go @@ -8,29 +8,29 @@ import ( ) type INetworkServiceV1 interface { - GetEndpointById(pops lsnetworkSvcV1.IGetEndpointByIdRequest) (*lsentity.Endpoint, lserr.ISdkError) - CreateEndpoint(popts lsnetworkSvcV1.ICreateEndpointRequest) (*lsentity.Endpoint, lserr.ISdkError) - DeleteEndpointById(popts lsnetworkSvcV1.IDeleteEndpointByIdRequest) lserr.ISdkError - ListEndpoints(popts lsnetworkSvcV1.IListEndpointsRequest) (*lsentity.ListEndpoints, lserr.ISdkError) + GetEndpointById(pops lsnetworkSvcV1.IGetEndpointByIdRequest) (*lsentity.Endpoint, lserr.IError) + CreateEndpoint(popts lsnetworkSvcV1.ICreateEndpointRequest) (*lsentity.Endpoint, lserr.IError) + DeleteEndpointById(popts lsnetworkSvcV1.IDeleteEndpointByIdRequest) lserr.IError + ListEndpoints(popts lsnetworkSvcV1.IListEndpointsRequest) (*lsentity.ListEndpoints, lserr.IError) } type INetworkServiceV2 interface { // The group of Network APIs - GetNetworkById(popts lsnetworkSvcV2.IGetNetworkByIdRequest) (*lsentity.Network, lserr.ISdkError) + GetNetworkById(popts lsnetworkSvcV2.IGetNetworkByIdRequest) (*lsentity.Network, lserr.IError) // The group of Secgroup APIs - GetSecgroupById(popts lsnetworkSvcV2.IGetSecgroupByIdRequest) (*lsentity.Secgroup, lserr.ISdkError) - CreateSecgroup(popts lsnetworkSvcV2.ICreateSecgroupRequest) (*lsentity.Secgroup, lserr.ISdkError) - DeleteSecgroupById(popts lsnetworkSvcV2.IDeleteSecgroupByIdRequest) lserr.ISdkError + GetSecgroupById(popts lsnetworkSvcV2.IGetSecgroupByIdRequest) (*lsentity.Secgroup, lserr.IError) + CreateSecgroup(popts lsnetworkSvcV2.ICreateSecgroupRequest) (*lsentity.Secgroup, lserr.IError) + DeleteSecgroupById(popts lsnetworkSvcV2.IDeleteSecgroupByIdRequest) lserr.IError // The group of SecgroupRule APIs - CreateSecgroupRule(popts lsnetworkSvcV2.ICreateSecgroupRuleRequest) (*lsentity.SecgroupRule, lserr.ISdkError) - DeleteSecgroupRuleById(popts lsnetworkSvcV2.IDeleteSecgroupRuleByIdRequest) lserr.ISdkError - ListSecgroupRulesBySecgroupId(popts lsnetworkSvcV2.IListSecgroupRulesBySecgroupIdRequest) (*lsentity.ListSecgroupRules, lserr.ISdkError) + CreateSecgroupRule(popts lsnetworkSvcV2.ICreateSecgroupRuleRequest) (*lsentity.SecgroupRule, lserr.IError) + DeleteSecgroupRuleById(popts lsnetworkSvcV2.IDeleteSecgroupRuleByIdRequest) lserr.IError + ListSecgroupRulesBySecgroupId(popts lsnetworkSvcV2.IListSecgroupRulesBySecgroupIdRequest) (*lsentity.ListSecgroupRules, lserr.IError) // Subnet - GetSubnetById(popts lsnetworkSvcV2.IGetSubnetByIdRequest) (*lsentity.Subnet, lserr.ISdkError) + GetSubnetById(popts lsnetworkSvcV2.IGetSubnetByIdRequest) (*lsentity.Subnet, lserr.IError) } diff --git a/vngcloud/services/network/v1/endpoint.go b/vngcloud/services/network/v1/endpoint.go index b7307fe..11e7cfb 100644 --- a/vngcloud/services/network/v1/endpoint.go +++ b/vngcloud/services/network/v1/endpoint.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *NetworkServiceV1) GetEndpointById(popts IGetEndpointByIdRequest) (*lsentity.Endpoint, lserr.ISdkError) { +func (s *NetworkServiceV1) GetEndpointById(popts IGetEndpointByIdRequest) (*lsentity.Endpoint, lserr.IError) { url := getEndpointByIdUrl(s.VNetworkClient, popts) resp := new(GetEndpointByIdResponse) errResp := lserr.NewErrorResponse(lserr.NetworkGatewayErrorType) @@ -26,7 +26,7 @@ func (s *NetworkServiceV1) GetEndpointById(popts IGetEndpointByIdRequest) (*lsen return resp.ToEntityEndpoint(), nil } -func (s *NetworkServiceV1) CreateEndpoint(popts ICreateEndpointRequest) (*lsentity.Endpoint, lserr.ISdkError) { +func (s *NetworkServiceV1) CreateEndpoint(popts ICreateEndpointRequest) (*lsentity.Endpoint, lserr.IError) { url := createEndpointUrl(s.VNetworkClient) resp := new(CreateEndpointResponse) errResp := lserr.NewErrorResponse(lserr.NetworkGatewayErrorType) @@ -49,7 +49,7 @@ func (s *NetworkServiceV1) CreateEndpoint(popts ICreateEndpointRequest) (*lsenti return resp.ToEntityEndpoint(), nil } -func (s *NetworkServiceV1) DeleteEndpointById(popts IDeleteEndpointByIdRequest) lserr.ISdkError { +func (s *NetworkServiceV1) DeleteEndpointById(popts IDeleteEndpointByIdRequest) lserr.IError { url := deleteEndpointByIdUrl(s.VNetworkClient, popts) errResp := lserr.NewErrorResponse(lserr.NetworkGatewayErrorType) req := lsclient.NewRequest(). @@ -69,7 +69,7 @@ func (s *NetworkServiceV1) DeleteEndpointById(popts IDeleteEndpointByIdRequest) return nil } -func (s *NetworkServiceV1) ListEndpoints(popts IListEndpointsRequest) (*lsentity.ListEndpoints, lserr.ISdkError) { +func (s *NetworkServiceV1) ListEndpoints(popts IListEndpointsRequest) (*lsentity.ListEndpoints, lserr.IError) { url := listEndpointsUrl(s.VNetworkClient, popts) resp := new(ListEndpointsResponse) errResp := lserr.NewErrorResponse(lserr.NetworkGatewayErrorType) diff --git a/vngcloud/services/network/v2/network.go b/vngcloud/services/network/v2/network.go index a19af5a..17b44ea 100644 --- a/vngcloud/services/network/v2/network.go +++ b/vngcloud/services/network/v2/network.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *NetworkServiceV2) GetNetworkById(popts IGetNetworkByIdRequest) (*lsentity.Network, lserr.ISdkError) { +func (s *NetworkServiceV2) GetNetworkById(popts IGetNetworkByIdRequest) (*lsentity.Network, lserr.IError) { url := getNetworkByIdUrl(s.VserverClient, popts) resp := new(GetNetworkByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/network/v2/secgroup.go b/vngcloud/services/network/v2/secgroup.go index 8ff59f5..83a9252 100644 --- a/vngcloud/services/network/v2/secgroup.go +++ b/vngcloud/services/network/v2/secgroup.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *NetworkServiceV2) GetSecgroupById(popts IGetSecgroupByIdRequest) (*lsentity.Secgroup, lserr.ISdkError) { +func (s *NetworkServiceV2) GetSecgroupById(popts IGetSecgroupByIdRequest) (*lsentity.Secgroup, lserr.IError) { url := getSecgroupByIdUrl(s.VserverClient, popts) resp := new(GetSecgroupByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -26,7 +26,7 @@ func (s *NetworkServiceV2) GetSecgroupById(popts IGetSecgroupByIdRequest) (*lsen return resp.ToEntitySecgroup(), nil } -func (s *NetworkServiceV2) CreateSecgroup(popts ICreateSecgroupRequest) (*lsentity.Secgroup, lserr.ISdkError) { +func (s *NetworkServiceV2) CreateSecgroup(popts ICreateSecgroupRequest) (*lsentity.Secgroup, lserr.IError) { url := createSecgroupUrl(s.VserverClient) resp := new(CreateSecgroupResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -48,7 +48,7 @@ func (s *NetworkServiceV2) CreateSecgroup(popts ICreateSecgroupRequest) (*lsenti return resp.ToEntitySecgroup(), nil } -func (s *NetworkServiceV2) DeleteSecgroupById(popts IDeleteSecgroupByIdRequest) lserr.ISdkError { +func (s *NetworkServiceV2) DeleteSecgroupById(popts IDeleteSecgroupByIdRequest) lserr.IError { url := deleteSecgroupByIdUrl(s.VserverClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). diff --git a/vngcloud/services/network/v2/secgroup_rule.go b/vngcloud/services/network/v2/secgroup_rule.go index fa71db1..27a1679 100644 --- a/vngcloud/services/network/v2/secgroup_rule.go +++ b/vngcloud/services/network/v2/secgroup_rule.go @@ -7,7 +7,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *NetworkServiceV2) CreateSecgroupRule(popts ICreateSecgroupRuleRequest) (*lsentity.SecgroupRule, lserr.ISdkError) { +func (s *NetworkServiceV2) CreateSecgroupRule(popts ICreateSecgroupRuleRequest) (*lsentity.SecgroupRule, lserr.IError) { url := createSecgroupRuleUrl(s.VserverClient, popts) resp := new(CreateSecgroupRuleResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -29,7 +29,7 @@ func (s *NetworkServiceV2) CreateSecgroupRule(popts ICreateSecgroupRuleRequest) return resp.ToEntitySecgroupRule(), nil } -func (s *NetworkServiceV2) DeleteSecgroupRuleById(popts IDeleteSecgroupRuleByIdRequest) lserr.ISdkError { +func (s *NetworkServiceV2) DeleteSecgroupRuleById(popts IDeleteSecgroupRuleByIdRequest) lserr.IError { url := deleteSecgroupRuleByIdUrl(s.VserverClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -49,7 +49,7 @@ func (s *NetworkServiceV2) DeleteSecgroupRuleById(popts IDeleteSecgroupRuleByIdR return nil } -func (s *NetworkServiceV2) ListSecgroupRulesBySecgroupId(popts IListSecgroupRulesBySecgroupIdRequest) (*lsentity.ListSecgroupRules, lserr.ISdkError) { +func (s *NetworkServiceV2) ListSecgroupRulesBySecgroupId(popts IListSecgroupRulesBySecgroupIdRequest) (*lsentity.ListSecgroupRules, lserr.IError) { url := listSecgroupRulesBySecgroupIdUrl(s.VserverClient, popts) resp := new(ListSecgroupRulesBySecgroupIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/network/v2/subnet.go b/vngcloud/services/network/v2/subnet.go index ccb3895..48bf0c8 100644 --- a/vngcloud/services/network/v2/subnet.go +++ b/vngcloud/services/network/v2/subnet.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *NetworkServiceV2) GetSubnetById(popts IGetSubnetByIdRequest) (*lsentity.Subnet, lserr.ISdkError) { +func (s *NetworkServiceV2) GetSubnetById(popts IGetSubnetByIdRequest) (*lsentity.Subnet, lserr.IError) { url := getSubnetByIdUrl(s.VserverClient, popts) resp := new(GetSubnetByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/portal/iportal.go b/vngcloud/services/portal/iportal.go index cf5d92d..17046d8 100644 --- a/vngcloud/services/portal/iportal.go +++ b/vngcloud/services/portal/iportal.go @@ -8,10 +8,10 @@ import ( ) type IPortalServiceV1 interface { - GetPortalInfo(popts lsportalV1.IGetPortalInfoRequest) (*lsentity.Portal, lserr.ISdkError) + GetPortalInfo(popts lsportalV1.IGetPortalInfoRequest) (*lsentity.Portal, lserr.IError) } type IPortalServiceV2 interface { - ListAllQuotaUsed() (*lsentity.ListQuotas, lserr.ISdkError) - GetQuotaByName(popts lsportalV2.IGetQuotaByNameRequest) (*lsentity.Quota, lserr.ISdkError) + ListAllQuotaUsed() (*lsentity.ListQuotas, lserr.IError) + GetQuotaByName(popts lsportalV2.IGetQuotaByNameRequest) (*lsentity.Quota, lserr.IError) } diff --git a/vngcloud/services/portal/v1/portal.go b/vngcloud/services/portal/v1/portal.go index 1b1c5a8..0c39cb5 100644 --- a/vngcloud/services/portal/v1/portal.go +++ b/vngcloud/services/portal/v1/portal.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *PortalServiceV1) GetPortalInfo(popts IGetPortalInfoRequest) (*lsentity.Portal, lserr.ISdkError) { +func (s *PortalServiceV1) GetPortalInfo(popts IGetPortalInfoRequest) (*lsentity.Portal, lserr.IError) { url := getPortalInfoUrl(s.PortalClient, popts) resp := new(GetPortalInfoResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/portal/v2/portal.go b/vngcloud/services/portal/v2/portal.go index db3a80d..f00a07b 100644 --- a/vngcloud/services/portal/v2/portal.go +++ b/vngcloud/services/portal/v2/portal.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *PortalServiceV2) ListAllQuotaUsed() (*lsentity.ListQuotas, lserr.ISdkError) { +func (s *PortalServiceV2) ListAllQuotaUsed() (*lsentity.ListQuotas, lserr.IError) { url := listAllQuotaUsedUrl(s.PortalClient) resp := new(ListAllQuotaUsedResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -23,7 +23,7 @@ func (s *PortalServiceV2) ListAllQuotaUsed() (*lsentity.ListQuotas, lserr.ISdkEr return resp.ToEntityListQuotas(), nil } -func (s *PortalServiceV2) GetQuotaByName(popts IGetQuotaByNameRequest) (*lsentity.Quota, lserr.ISdkError) { +func (s *PortalServiceV2) GetQuotaByName(popts IGetQuotaByNameRequest) (*lsentity.Quota, lserr.IError) { listQuotas, sdkErr := s.ListAllQuotaUsed() if sdkErr != nil { return nil, sdkErr diff --git a/vngcloud/services/volume/ivolume.go b/vngcloud/services/volume/ivolume.go index 928902e..f228226 100644 --- a/vngcloud/services/volume/ivolume.go +++ b/vngcloud/services/volume/ivolume.go @@ -8,22 +8,22 @@ import ( ) type IVolumeServiceV2 interface { - CreateBlockVolume(popts lsvolumeSvcV2.ICreateBlockVolumeRequest) (*lsentity.Volume, lserr.ISdkError) - DeleteBlockVolumeById(popts lsvolumeSvcV2.IDeleteBlockVolumeByIdRequest) lserr.ISdkError - ListBlockVolumes(popts lsvolumeSvcV2.IListBlockVolumesRequest) (*lsentity.ListVolumes, lserr.ISdkError) - GetBlockVolumeById(popts lsvolumeSvcV2.IGetBlockVolumeByIdRequest) (*lsentity.Volume, lserr.ISdkError) - ResizeBlockVolumeById(popts lsvolumeSvcV2.IResizeBlockVolumeByIdRequest) (*lsentity.Volume, lserr.ISdkError) - GetUnderBlockVolumeId(popts lsvolumeSvcV2.IGetUnderBlockVolumeIdRequest) (*lsentity.Volume, lserr.ISdkError) - MigrateBlockVolumeById(popts lsvolumeSvcV2.IMigrateBlockVolumeByIdRequest) lserr.ISdkError + CreateBlockVolume(popts lsvolumeSvcV2.ICreateBlockVolumeRequest) (*lsentity.Volume, lserr.IError) + DeleteBlockVolumeById(popts lsvolumeSvcV2.IDeleteBlockVolumeByIdRequest) lserr.IError + ListBlockVolumes(popts lsvolumeSvcV2.IListBlockVolumesRequest) (*lsentity.ListVolumes, lserr.IError) + GetBlockVolumeById(popts lsvolumeSvcV2.IGetBlockVolumeByIdRequest) (*lsentity.Volume, lserr.IError) + ResizeBlockVolumeById(popts lsvolumeSvcV2.IResizeBlockVolumeByIdRequest) (*lsentity.Volume, lserr.IError) + GetUnderBlockVolumeId(popts lsvolumeSvcV2.IGetUnderBlockVolumeIdRequest) (*lsentity.Volume, lserr.IError) + MigrateBlockVolumeById(popts lsvolumeSvcV2.IMigrateBlockVolumeByIdRequest) lserr.IError // Snapshot - ListSnapshotsByBlockVolumeId(popts lsvolumeSvcV2.IListSnapshotsByBlockVolumeIdRequest) (*lsentity.ListSnapshots, lserr.ISdkError) - CreateSnapshotByBlockVolumeId(popts lsvolumeSvcV2.ICreateSnapshotByBlockVolumeIdRequest) (*lsentity.Snapshot, lserr.ISdkError) - DeleteSnapshotById(popts lsvolumeSvcV2.IDeleteSnapshotByIdRequest) lserr.ISdkError + ListSnapshotsByBlockVolumeId(popts lsvolumeSvcV2.IListSnapshotsByBlockVolumeIdRequest) (*lsentity.ListSnapshots, lserr.IError) + CreateSnapshotByBlockVolumeId(popts lsvolumeSvcV2.ICreateSnapshotByBlockVolumeIdRequest) (*lsentity.Snapshot, lserr.IError) + DeleteSnapshotById(popts lsvolumeSvcV2.IDeleteSnapshotByIdRequest) lserr.IError } type IVolumeServiceV1 interface { // Volume Type Api group - GetVolumeTypeById(popts lsvolumeSvcV1.IGetVolumeTypeByIdRequest) (*lsentity.VolumeType, lserr.ISdkError) - GetDefaultVolumeType() (*lsentity.VolumeType, lserr.ISdkError) + GetVolumeTypeById(popts lsvolumeSvcV1.IGetVolumeTypeByIdRequest) (*lsentity.VolumeType, lserr.IError) + GetDefaultVolumeType() (*lsentity.VolumeType, lserr.IError) } diff --git a/vngcloud/services/volume/v1/volumetype.go b/vngcloud/services/volume/v1/volumetype.go index fa6d6d0..134eb28 100644 --- a/vngcloud/services/volume/v1/volumetype.go +++ b/vngcloud/services/volume/v1/volumetype.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *VolumeServiceV1) GetVolumeTypeById(popts IGetVolumeTypeByIdRequest) (*lsentity.VolumeType, lserr.ISdkError) { +func (s *VolumeServiceV1) GetVolumeTypeById(popts IGetVolumeTypeByIdRequest) (*lsentity.VolumeType, lserr.IError) { url := getVolumeTypeByIdUrl(s.VServerClient, popts) resp := new(GetVolumeTypeByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -26,7 +26,7 @@ func (s *VolumeServiceV1) GetVolumeTypeById(popts IGetVolumeTypeByIdRequest) (*l return resp.ToEntityVolumeType(), nil } -func (s *VolumeServiceV1) GetDefaultVolumeType() (*lsentity.VolumeType, lserr.ISdkError) { +func (s *VolumeServiceV1) GetDefaultVolumeType() (*lsentity.VolumeType, lserr.IError) { url := getDefaultVolumeTypeUrl(s.VServerClient) resp := new(GetDefaultVolumeTypeResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) diff --git a/vngcloud/services/volume/v2/blockvolume.go b/vngcloud/services/volume/v2/blockvolume.go index 03d6075..c490ba6 100644 --- a/vngcloud/services/volume/v2/blockvolume.go +++ b/vngcloud/services/volume/v2/blockvolume.go @@ -7,7 +7,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *VolumeServiceV2) CreateBlockVolume(popts ICreateBlockVolumeRequest) (*lsentity.Volume, lserr.ISdkError) { +func (s *VolumeServiceV2) CreateBlockVolume(popts ICreateBlockVolumeRequest) (*lsentity.Volume, lserr.IError) { url := createBlockVolumeUrl(s.VServerClient) resp := new(CreateBlockVolumeResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -30,7 +30,7 @@ func (s *VolumeServiceV2) CreateBlockVolume(popts ICreateBlockVolumeRequest) (*l return resp.ToEntityVolume(), nil } -func (s *VolumeServiceV2) DeleteBlockVolumeById(popts IDeleteBlockVolumeByIdRequest) lserr.ISdkError { +func (s *VolumeServiceV2) DeleteBlockVolumeById(popts IDeleteBlockVolumeByIdRequest) lserr.IError { url := deleteBlockVolumeByIdUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest(). @@ -48,7 +48,7 @@ func (s *VolumeServiceV2) DeleteBlockVolumeById(popts IDeleteBlockVolumeByIdRequ return nil } -func (s *VolumeServiceV2) ListBlockVolumes(popts IListBlockVolumesRequest) (*lsentity.ListVolumes, lserr.ISdkError) { +func (s *VolumeServiceV2) ListBlockVolumes(popts IListBlockVolumesRequest) (*lsentity.ListVolumes, lserr.IError) { url := listBlockVolumesUrl(s.VServerClient, popts) resp := new(ListBlockVolumesResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -67,7 +67,7 @@ func (s *VolumeServiceV2) ListBlockVolumes(popts IListBlockVolumesRequest) (*lse return resp.ToEntityListVolumes(), nil } -func (s *VolumeServiceV2) GetBlockVolumeById(popts IGetBlockVolumeByIdRequest) (*lsentity.Volume, lserr.ISdkError) { +func (s *VolumeServiceV2) GetBlockVolumeById(popts IGetBlockVolumeByIdRequest) (*lsentity.Volume, lserr.IError) { url := getBlockVolumeByIdUrl(s.VServerClient, popts) resp := new(GetBlockVolumeByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -87,7 +87,7 @@ func (s *VolumeServiceV2) GetBlockVolumeById(popts IGetBlockVolumeByIdRequest) ( return resp.ToEntityVolume(), nil } -func (s *VolumeServiceV2) ResizeBlockVolumeById(popts IResizeBlockVolumeByIdRequest) (*lsentity.Volume, lserr.ISdkError) { +func (s *VolumeServiceV2) ResizeBlockVolumeById(popts IResizeBlockVolumeByIdRequest) (*lsentity.Volume, lserr.IError) { url := resizeBlockVolumeByIdUrl(s.VServerClient, popts) resp := new(ResizeBlockVolumeByIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -112,7 +112,7 @@ func (s *VolumeServiceV2) ResizeBlockVolumeById(popts IResizeBlockVolumeByIdRequ return resp.ToEntityVolume(), nil } -func (s *VolumeServiceV2) GetUnderBlockVolumeId(popts IGetUnderBlockVolumeIdRequest) (*lsentity.Volume, lserr.ISdkError) { +func (s *VolumeServiceV2) GetUnderBlockVolumeId(popts IGetUnderBlockVolumeIdRequest) (*lsentity.Volume, lserr.IError) { url := getUnderBlockVolumeIdUrl(s.VServerClient, popts) resp := new(GetUnderBlockVolumeIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -132,7 +132,7 @@ func (s *VolumeServiceV2) GetUnderBlockVolumeId(popts IGetUnderBlockVolumeIdRequ return resp.ToEntityVolume(), nil } -func (s *VolumeServiceV2) MigrateBlockVolumeById(popts IMigrateBlockVolumeByIdRequest) lserr.ISdkError { +func (s *VolumeServiceV2) MigrateBlockVolumeById(popts IMigrateBlockVolumeByIdRequest) lserr.IError { url := migrateBlockVolumeByIdUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) resp := map[string]interface{}{} diff --git a/vngcloud/services/volume/v2/snapshot.go b/vngcloud/services/volume/v2/snapshot.go index 573b99f..7541a84 100644 --- a/vngcloud/services/volume/v2/snapshot.go +++ b/vngcloud/services/volume/v2/snapshot.go @@ -6,7 +6,7 @@ import ( lserr "github.com/vngcloud/vngcloud-go-sdk/v2/vngcloud/sdk_error" ) -func (s *VolumeServiceV2) ListSnapshotsByBlockVolumeId(popts IListSnapshotsByBlockVolumeIdRequest) (*lsentity.ListSnapshots, lserr.ISdkError) { +func (s *VolumeServiceV2) ListSnapshotsByBlockVolumeId(popts IListSnapshotsByBlockVolumeIdRequest) (*lsentity.ListSnapshots, lserr.IError) { url := listSnapshotsByBlockVolumeIdUrl(s.VServerClient, popts) resp := new(ListSnapshotsByBlockVolumeIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -25,7 +25,7 @@ func (s *VolumeServiceV2) ListSnapshotsByBlockVolumeId(popts IListSnapshotsByBlo return resp.ToEntityListSnapshots(), nil } -func (s *VolumeServiceV2) CreateSnapshotByBlockVolumeId(popts ICreateSnapshotByBlockVolumeIdRequest) (*lsentity.Snapshot, lserr.ISdkError) { +func (s *VolumeServiceV2) CreateSnapshotByBlockVolumeId(popts ICreateSnapshotByBlockVolumeIdRequest) (*lsentity.Snapshot, lserr.IError) { url := createSnapshotByBlockVolumeIdUrl(s.VServerClient, popts) resp := new(CreateSnapshotByBlockVolumeIdResponse) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) @@ -47,7 +47,7 @@ func (s *VolumeServiceV2) CreateSnapshotByBlockVolumeId(popts ICreateSnapshotByB return resp.ToEntitySnapshot(), nil } -func (s *VolumeServiceV2) DeleteSnapshotById(popts IDeleteSnapshotByIdRequest) lserr.ISdkError { +func (s *VolumeServiceV2) DeleteSnapshotById(popts IDeleteSnapshotByIdRequest) lserr.IError { url := deleteSnapshotByIdUrl(s.VServerClient, popts) errResp := lserr.NewErrorResponse(lserr.NormalErrorType) req := lsclient.NewRequest().