Documentation
¶
Index ¶
- type APIToken
- type APITokenClientUser
- type APITokenClientUserRole
- type APITokenCreated
- type APITokenDeleteParams
- type APITokenGetParams
- type APITokenList
- type APITokenListParams
- type APITokenNewParams
- type APITokenNewParamsClientUser
- type APITokenService
- func (r *APITokenService) Delete(ctx context.Context, tokenID int64, body APITokenDeleteParams, ...) (err error)
- func (r *APITokenService) Get(ctx context.Context, tokenID int64, query APITokenGetParams, ...) (res *APIToken, err error)
- func (r *APITokenService) List(ctx context.Context, clientID int64, query APITokenListParams, ...) (res *APITokenList, err error)
- func (r *APITokenService) New(ctx context.Context, clientID int64, body APITokenNewParams, ...) (res *APITokenCreated, err error)
- type AccountOverview
- type AccountOverviewFreeFeatures
- type AccountOverviewFreeFeaturesCDN
- type AccountOverviewFreeFeaturesCloud
- type AccountOverviewFreeFeaturesDDOS
- type AccountOverviewFreeFeaturesDNS
- type AccountOverviewFreeFeaturesStorage
- type AccountOverviewFreeFeaturesStreaming
- type AccountOverviewPaidFeatures
- type AccountOverviewPaidFeaturesCDN
- type AccountOverviewPaidFeaturesCloud
- type AccountOverviewPaidFeaturesDDOS
- type AccountOverviewPaidFeaturesDNS
- type AccountOverviewPaidFeaturesStorage
- type AccountOverviewPaidFeaturesStreaming
- type AccountOverviewServiceStatuses
- type AccountOverviewServiceStatusesCDN
- type AccountOverviewServiceStatusesCloud
- type AccountOverviewServiceStatusesDDOS
- type AccountOverviewServiceStatusesDNS
- type AccountOverviewServiceStatusesStorage
- type AccountOverviewServiceStatusesStreaming
- type AccountOverviewSignupProcess
- type AccountOverviewStatus
- type AccountOverviewUser
- type AuthType
- type Error
- type IamService
- type User
- type UserClientAndRole
- type UserDeleteParams
- type UserGetResponse
- type UserGroup
- type UserGroupName
- type UserGroupParam
- type UserInviteParams
- type UserInvited
- type UserLanguage
- type UserListParams
- type UserService
- func (r *UserService) Delete(ctx context.Context, userID int64, body UserDeleteParams, ...) (err error)
- func (r *UserService) Get(ctx context.Context, userID int64, opts ...option.RequestOption) (res *UserGetResponse, err error)
- func (r *UserService) Invite(ctx context.Context, body UserInviteParams, opts ...option.RequestOption) (res *UserInvited, err error)
- func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[User], err error)
- func (r *UserService) ListAutoPaging(ctx context.Context, query UserListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[User]
- func (r *UserService) Update(ctx context.Context, userID int64, body UserUpdateParams, ...) (res *User, err error)
- type UserType
- type UserUpdateParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIToken ¶
type APIToken struct {
// API token ID.
ID int64 `json:"id" api:"required"`
ClientUser APITokenClientUser `json:"client_user" api:"required"`
// Date when the API token was issued (ISO 8086/RFC 3339 format), UTC.
Created string `json:"created" api:"required"`
// Deletion flag. If true, then the API token was deleted.
Deleted bool `json:"deleted" api:"required"`
// Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If
// null, then the API token will never expire.
ExpDate string `json:"exp_date" api:"required"`
// Expiration flag. If true, then the API token has expired. When an API token
// expires it will be automatically deleted.
Expired bool `json:"expired" api:"required"`
// Date when the API token was last used (ISO 8086/RFC 3339 format), UTC.
LastUsage string `json:"last_usage" api:"required"`
// API token name.
Name string `json:"name" api:"required"`
// API token description.
Description string `json:"description"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ClientUser respjson.Field
Created respjson.Field
Deleted respjson.Field
ExpDate respjson.Field
Expired respjson.Field
LastUsage respjson.Field
Name respjson.Field
Description respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*APIToken) UnmarshalJSON ¶
type APITokenClientUser ¶
type APITokenClientUser struct {
// Account's ID.
ClientID int64 `json:"client_id" api:"required"`
// Deletion flag. If true, then the API token was deleted.
Deleted bool `json:"deleted" api:"required"`
Role APITokenClientUserRole `json:"role" api:"required"`
// User's email who issued the API token.
UserEmail string `json:"user_email" api:"required"`
// User's ID who issued the API token.
UserID int64 `json:"user_id" api:"required"`
// User's name who issued the API token.
UserName string `json:"user_name" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClientID respjson.Field
Deleted respjson.Field
Role respjson.Field
UserEmail respjson.Field
UserID respjson.Field
UserName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (APITokenClientUser) RawJSON ¶
func (r APITokenClientUser) RawJSON() string
Returns the unmodified JSON received from the API
func (*APITokenClientUser) UnmarshalJSON ¶
func (r *APITokenClientUser) UnmarshalJSON(data []byte) error
type APITokenClientUserRole ¶
type APITokenClientUserRole struct {
// Group's ID: Possible values are:
//
// - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
// (API+Web)* 3022 - Purge and Prefetch only (API)
ID int64 `json:"id"`
// Group's name.
//
// Any of "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)",
// "Purge and Prefetch only (API+Web)".
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (APITokenClientUserRole) RawJSON ¶
func (r APITokenClientUserRole) RawJSON() string
Returns the unmodified JSON received from the API
func (*APITokenClientUserRole) UnmarshalJSON ¶
func (r *APITokenClientUserRole) UnmarshalJSON(data []byte) error
type APITokenCreated ¶ added in v0.28.0
type APITokenCreated struct {
// API token with `_` separator. Copy it, because you will not be able to get it
// again. We do not store tokens. All responsibility for token storage and usage is
// on the issuer.
Token string `json:"token"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Token respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
APIToken
}
func (APITokenCreated) RawJSON ¶ added in v0.28.0
func (r APITokenCreated) RawJSON() string
Returns the unmodified JSON received from the API
func (*APITokenCreated) UnmarshalJSON ¶ added in v0.28.0
func (r *APITokenCreated) UnmarshalJSON(data []byte) error
type APITokenDeleteParams ¶
type APITokenDeleteParams struct {
ClientID int64 `path:"clientId" api:"required" json:"-"`
// contains filtered or unexported fields
}
type APITokenGetParams ¶
type APITokenGetParams struct {
ClientID int64 `path:"clientId" api:"required" json:"-"`
// contains filtered or unexported fields
}
type APITokenList ¶
type APITokenList []APIToken
type APITokenListParams ¶
type APITokenListParams struct {
// The state of API tokens included in the response.
//
// Two possible values:
//
// - True - API token was not deleted.\* False - API token was deleted.
//
// Example, _&deleted=True_
Deleted param.Opt[bool] `query:"deleted,omitzero" json:"-"`
// User's ID. Use to get API tokens issued by a particular user.
//
// Example, _&`issued_by`=1234_
IssuedBy param.Opt[int64] `query:"issued_by,omitzero" json:"-"`
// User's ID. Use to get API tokens issued by anyone except a particular user.
//
// Example, _¬_issued_by=1234_
NotIssuedBy param.Opt[int64] `query:"not_issued_by,omitzero" json:"-"`
// Group's ID. Possible values are:
//
// - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
// (API+Web)* 3022 - Purge and Prefetch only (API)
//
// Example, _&role=Engineers_
Role param.Opt[string] `query:"role,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (APITokenListParams) URLQuery ¶
func (r APITokenListParams) URLQuery() (v url.Values, err error)
URLQuery serializes APITokenListParams's query parameters as `url.Values`.
type APITokenNewParams ¶
type APITokenNewParams struct {
// Date when the API token becomes expired (ISO 8086/RFC 3339 format), UTC. If
// null, then the API token will never expire.
ExpDate param.Opt[string] `json:"exp_date,omitzero" api:"required"`
// API token role.
ClientUser APITokenNewParamsClientUser `json:"client_user,omitzero" api:"required"`
// API token name.
Name string `json:"name" api:"required"`
// API token description.
Description param.Opt[string] `json:"description,omitzero"`
// contains filtered or unexported fields
}
func (APITokenNewParams) MarshalJSON ¶
func (r APITokenNewParams) MarshalJSON() (data []byte, err error)
func (*APITokenNewParams) UnmarshalJSON ¶
func (r *APITokenNewParams) UnmarshalJSON(data []byte) error
type APITokenNewParamsClientUser ¶
type APITokenNewParamsClientUser struct {
Role UserGroupParam `json:"role,omitzero"`
// contains filtered or unexported fields
}
API token role.
func (APITokenNewParamsClientUser) MarshalJSON ¶
func (r APITokenNewParamsClientUser) MarshalJSON() (data []byte, err error)
func (*APITokenNewParamsClientUser) UnmarshalJSON ¶
func (r *APITokenNewParamsClientUser) UnmarshalJSON(data []byte) error
type APITokenService ¶
type APITokenService struct {
Options []option.RequestOption
}
Use permanent API tokens for regular automated requests to services. You can either set its validity period when creating it or issue a token for an unlimited time. Please address the API documentation of the specific product in order to check if it supports API tokens.
Newer endpoints under `/v2/…` issue tokens using `_` (underscore) as the separator (for example `42_a1b2c3d4e5f6...`) and are the recommended way to create new tokens. Legacy endpoints that issue `$`-separated tokens are marked deprecated and will be removed on **2026-07-17**; tokens that were already issued keep authenticating.
Provide your APIKey in the Authorization header.
Example: `curl -H "Authorization: APIKey 42_a1b2c3d4e5f6..." https://api.gcore.com/iam/users/me`
Please note: When authorizing via SAML SSO, our system does not have any information about permissions given to the user by the identity provider. Even if the provider revokes the user's access rights, their tokens remain active. Therefore, if necessary, the token will need to be deleted manually.
APITokenService contains methods and other services that help with interacting with the gcore API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPITokenService method instead.
func NewAPITokenService ¶
func NewAPITokenService(opts ...option.RequestOption) (r APITokenService)
NewAPITokenService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*APITokenService) Delete ¶
func (r *APITokenService) Delete(ctx context.Context, tokenID int64, body APITokenDeleteParams, opts ...option.RequestOption) (err error)
Delete API token from current account. Ensure that the API token is not being used by an active application. After deleting the token, all applications that use this token will not be able to get access to your account via API. The action cannot be reversed.
This endpoint is identical to the V1 endpoint.
func (*APITokenService) Get ¶
func (r *APITokenService) Get(ctx context.Context, tokenID int64, query APITokenGetParams, opts ...option.RequestOption) (res *APIToken, err error)
Get information about a specific API token.
This endpoint is identical to the V1 endpoint.
func (*APITokenService) List ¶
func (r *APITokenService) List(ctx context.Context, clientID int64, query APITokenListParams, opts ...option.RequestOption) (res *APITokenList, err error)
Get information about your permanent API tokens in the account. A user with the Administrators role gets information about all API tokens in the account.
This endpoint is identical to the V1 endpoint.
func (*APITokenService) New ¶
func (r *APITokenService) New(ctx context.Context, clientID int64, body APITokenNewParams, opts ...option.RequestOption) (res *APITokenCreated, err error)
Create an API token in the current account.
This V2 endpoint generates tokens that use `_` (underscore) as the separator between the token ID and the secret string, instead of the `$` separator used by the V1 endpoint. For example: `42_a1b2c3d4...`
Tokens created via this endpoint are fully compatible with all existing authentication mechanisms.
type AccountOverview ¶
type AccountOverview struct {
// The account ID.
ID int64 `json:"id" api:"required"`
// System field. Billing type of the account.
BillType string `json:"bill_type" api:"required"`
// System field. List of services available for the account.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Capabilities []string `json:"capabilities" api:"required"`
// The company name.
CompanyName string `json:"companyName" api:"required"`
// ID of the current user.
CurrentUser int64 `json:"currentUser" api:"required"`
// The field shows the status of the account:
//
// - `true` – the account has been deleted
// - `false` – the account is not deleted
Deleted bool `json:"deleted" api:"required"`
// The account email.
Email string `json:"email" api:"required" format:"email"`
// System field. Control panel domain.
EntryBaseDomain string `json:"entryBaseDomain" api:"required"`
// An object of arrays which contains information about free features available for
// the requested account.
FreeFeatures AccountOverviewFreeFeatures `json:"freeFeatures" api:"required"`
// System field.
HasActiveAdmin bool `json:"has_active_admin" api:"required"`
// System field:
//
// - `true` — a test account;
// - `false` — a production account.
IsTest bool `json:"is_test" api:"required"`
// Name of a user who registered the requested account.
Name string `json:"name" api:"required"`
// An object of arrays which contains information about paid features available for
// the requested account.
PaidFeatures AccountOverviewPaidFeatures `json:"paidFeatures" api:"required"`
// An object of arrays which contains information about all services available for
// the requested account.
ServiceStatuses AccountOverviewServiceStatuses `json:"serviceStatuses" api:"required"`
// Status of the account.
//
// Any of "new", "trial", "trialend", "active", "integration", "paused",
// "preparation", "ready".
Status AccountOverviewStatus `json:"status" api:"required"`
// System field. The company country (ISO 3166-1 alpha-2 format).
CountryCode string `json:"country_code"`
// The account custom ID.
CustomID string `json:"custom_id" api:"nullable"`
// Phone of a user who registered the requested account.
Phone string `json:"phone" api:"nullable"`
// System field. Type of the account registration process.
//
// Any of "sign_up_full", "sign_up_simple".
SignupProcess AccountOverviewSignupProcess `json:"signup_process" api:"nullable"`
// List of account users.
Users []AccountOverviewUser `json:"users"`
// The company website.
Website string `json:"website"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BillType respjson.Field
Capabilities respjson.Field
CompanyName respjson.Field
CurrentUser respjson.Field
Deleted respjson.Field
Email respjson.Field
EntryBaseDomain respjson.Field
FreeFeatures respjson.Field
HasActiveAdmin respjson.Field
IsTest respjson.Field
Name respjson.Field
PaidFeatures respjson.Field
ServiceStatuses respjson.Field
Status respjson.Field
CountryCode respjson.Field
CustomID respjson.Field
Phone respjson.Field
SignupProcess respjson.Field
Users respjson.Field
Website respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverview) RawJSON ¶
func (r AccountOverview) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverview) UnmarshalJSON ¶
func (r *AccountOverview) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeatures ¶
type AccountOverviewFreeFeatures struct {
CDN []AccountOverviewFreeFeaturesCDN `json:"CDN"`
Cloud []AccountOverviewFreeFeaturesCloud `json:"CLOUD"`
DDOS []AccountOverviewFreeFeaturesDDOS `json:"DDOS"`
DNS []AccountOverviewFreeFeaturesDNS `json:"DNS"`
Storage []AccountOverviewFreeFeaturesStorage `json:"STORAGE"`
Streaming []AccountOverviewFreeFeaturesStreaming `json:"STREAMING"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CDN respjson.Field
Cloud respjson.Field
DDOS respjson.Field
DNS respjson.Field
Storage respjson.Field
Streaming respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An object of arrays which contains information about free features available for the requested account.
func (AccountOverviewFreeFeatures) RawJSON ¶
func (r AccountOverviewFreeFeatures) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeatures) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeatures) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesCDN ¶ added in v0.31.0
type AccountOverviewFreeFeaturesCDN struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesCDN) RawJSON ¶ added in v0.31.0
func (r AccountOverviewFreeFeaturesCDN) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesCDN) UnmarshalJSON ¶ added in v0.31.0
func (r *AccountOverviewFreeFeaturesCDN) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesCloud ¶
type AccountOverviewFreeFeaturesCloud struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesCloud) RawJSON ¶
func (r AccountOverviewFreeFeaturesCloud) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesCloud) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeaturesCloud) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesDDOS ¶
type AccountOverviewFreeFeaturesDDOS struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesDDOS) RawJSON ¶
func (r AccountOverviewFreeFeaturesDDOS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesDDOS) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeaturesDDOS) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesDNS ¶
type AccountOverviewFreeFeaturesDNS struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesDNS) RawJSON ¶
func (r AccountOverviewFreeFeaturesDNS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesDNS) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeaturesDNS) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesStorage ¶
type AccountOverviewFreeFeaturesStorage struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesStorage) RawJSON ¶
func (r AccountOverviewFreeFeaturesStorage) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesStorage) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeaturesStorage) UnmarshalJSON(data []byte) error
type AccountOverviewFreeFeaturesStreaming ¶
type AccountOverviewFreeFeaturesStreaming struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Internal feature activation ID.
FreeFeatureID int64 `json:"free_feature_id"`
// Name of the feature.
Name string `json:"name"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
FreeFeatureID respjson.Field
Name respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewFreeFeaturesStreaming) RawJSON ¶
func (r AccountOverviewFreeFeaturesStreaming) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewFreeFeaturesStreaming) UnmarshalJSON ¶
func (r *AccountOverviewFreeFeaturesStreaming) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeatures ¶
type AccountOverviewPaidFeatures struct {
CDN []AccountOverviewPaidFeaturesCDN `json:"CDN"`
Cloud []AccountOverviewPaidFeaturesCloud `json:"CLOUD"`
DDOS []AccountOverviewPaidFeaturesDDOS `json:"DDOS"`
DNS []AccountOverviewPaidFeaturesDNS `json:"DNS"`
Storage []AccountOverviewPaidFeaturesStorage `json:"STORAGE"`
Streaming []AccountOverviewPaidFeaturesStreaming `json:"STREAMING"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CDN respjson.Field
Cloud respjson.Field
DDOS respjson.Field
DNS respjson.Field
Storage respjson.Field
Streaming respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An object of arrays which contains information about paid features available for the requested account.
func (AccountOverviewPaidFeatures) RawJSON ¶
func (r AccountOverviewPaidFeatures) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeatures) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeatures) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesCDN ¶ added in v0.31.0
type AccountOverviewPaidFeaturesCDN struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesCDN) RawJSON ¶ added in v0.31.0
func (r AccountOverviewPaidFeaturesCDN) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesCDN) UnmarshalJSON ¶ added in v0.31.0
func (r *AccountOverviewPaidFeaturesCDN) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesCloud ¶
type AccountOverviewPaidFeaturesCloud struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesCloud) RawJSON ¶
func (r AccountOverviewPaidFeaturesCloud) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesCloud) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeaturesCloud) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesDDOS ¶
type AccountOverviewPaidFeaturesDDOS struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesDDOS) RawJSON ¶
func (r AccountOverviewPaidFeaturesDDOS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesDDOS) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeaturesDDOS) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesDNS ¶
type AccountOverviewPaidFeaturesDNS struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesDNS) RawJSON ¶
func (r AccountOverviewPaidFeaturesDNS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesDNS) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeaturesDNS) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesStorage ¶
type AccountOverviewPaidFeaturesStorage struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesStorage) RawJSON ¶
func (r AccountOverviewPaidFeaturesStorage) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesStorage) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeaturesStorage) UnmarshalJSON(data []byte) error
type AccountOverviewPaidFeaturesStreaming ¶
type AccountOverviewPaidFeaturesStreaming struct {
// Date and time when the feature was activated (ISO 8086/RFC 3339 format).
CreateDate string `json:"create_date"`
// Feature ID.
FeatureID int64 `json:"feature_id"`
// Name of the feature.
Name string `json:"name"`
// Internal feature activation ID.
PaidFeatureID int64 `json:"paid_feature_id"`
// Service's name.
//
// Any of "CDN", "STORAGE", "STREAMING", "DNS", "DDOS", "CLOUD".
Service string `json:"service"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreateDate respjson.Field
FeatureID respjson.Field
Name respjson.Field
PaidFeatureID respjson.Field
Service respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Feature object.
func (AccountOverviewPaidFeaturesStreaming) RawJSON ¶
func (r AccountOverviewPaidFeaturesStreaming) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewPaidFeaturesStreaming) UnmarshalJSON ¶
func (r *AccountOverviewPaidFeaturesStreaming) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatuses ¶
type AccountOverviewServiceStatuses struct {
CDN AccountOverviewServiceStatusesCDN `json:"CDN"`
Cloud AccountOverviewServiceStatusesCloud `json:"CLOUD"`
DDOS AccountOverviewServiceStatusesDDOS `json:"DDOS"`
DNS AccountOverviewServiceStatusesDNS `json:"DNS"`
Storage AccountOverviewServiceStatusesStorage `json:"STORAGE"`
Streaming AccountOverviewServiceStatusesStreaming `json:"STREAMING"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CDN respjson.Field
Cloud respjson.Field
DDOS respjson.Field
DNS respjson.Field
Storage respjson.Field
Streaming respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
An object of arrays which contains information about all services available for the requested account.
func (AccountOverviewServiceStatuses) RawJSON ¶
func (r AccountOverviewServiceStatuses) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatuses) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatuses) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesCDN ¶ added in v0.31.0
type AccountOverviewServiceStatusesCDN struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesCDN) RawJSON ¶ added in v0.31.0
func (r AccountOverviewServiceStatusesCDN) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesCDN) UnmarshalJSON ¶ added in v0.31.0
func (r *AccountOverviewServiceStatusesCDN) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesCloud ¶
type AccountOverviewServiceStatusesCloud struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesCloud) RawJSON ¶
func (r AccountOverviewServiceStatusesCloud) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesCloud) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatusesCloud) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesDDOS ¶
type AccountOverviewServiceStatusesDDOS struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesDDOS) RawJSON ¶
func (r AccountOverviewServiceStatusesDDOS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesDDOS) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatusesDDOS) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesDNS ¶
type AccountOverviewServiceStatusesDNS struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesDNS) RawJSON ¶
func (r AccountOverviewServiceStatusesDNS) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesDNS) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatusesDNS) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesStorage ¶
type AccountOverviewServiceStatusesStorage struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesStorage) RawJSON ¶
func (r AccountOverviewServiceStatusesStorage) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesStorage) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatusesStorage) UnmarshalJSON(data []byte) error
type AccountOverviewServiceStatusesStreaming ¶
type AccountOverviewServiceStatusesStreaming struct {
// `true` - service is available in the Control Panel.
Enabled bool `json:"enabled"`
// Status of the service.
//
// Any of "new", "trial", "trialend", "active", "paused", "activating", "deleted".
Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewServiceStatusesStreaming) RawJSON ¶
func (r AccountOverviewServiceStatusesStreaming) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewServiceStatusesStreaming) UnmarshalJSON ¶
func (r *AccountOverviewServiceStatusesStreaming) UnmarshalJSON(data []byte) error
type AccountOverviewSignupProcess ¶
type AccountOverviewSignupProcess string
System field. Type of the account registration process.
const ( AccountOverviewSignupProcessSignUpFull AccountOverviewSignupProcess = "sign_up_full" AccountOverviewSignupProcessSignUpSimple AccountOverviewSignupProcess = "sign_up_simple" )
type AccountOverviewStatus ¶
type AccountOverviewStatus string
Status of the account.
const ( AccountOverviewStatusNew AccountOverviewStatus = "new" AccountOverviewStatusTrial AccountOverviewStatus = "trial" AccountOverviewStatusTrialend AccountOverviewStatus = "trialend" AccountOverviewStatusActive AccountOverviewStatus = "active" AccountOverviewStatusIntegration AccountOverviewStatus = "integration" AccountOverviewStatusPaused AccountOverviewStatus = "paused" AccountOverviewStatusPreparation AccountOverviewStatus = "preparation" AccountOverviewStatusReady AccountOverviewStatus = "ready" )
type AccountOverviewUser ¶
type AccountOverviewUser struct {
// User's ID.
ID int64 `json:"id"`
// Email confirmation:
//
// - `true` – user confirmed the email;
// - `false` – user did not confirm the email.
Activated bool `json:"activated"`
// System field. List of auth types available for the account.
AuthTypes []AuthType `json:"auth_types"`
// User's account ID.
Client float64 `json:"client"`
// User's company.
Company string `json:"company"`
// Deletion flag. If `true` then user was deleted.
Deleted bool `json:"deleted"`
// User's email address.
Email string `json:"email" format:"email"`
// User's group in the current account.
//
// IAM supports 5 groups:
//
// - Users
// - Administrators
// - Engineers
// - Purge and Prefetch only (API)
// - Purge and Prefetch only (API+Web)
Groups []UserGroup `json:"groups"`
// User's language.
//
// Defines language of the control panel and email messages.
//
// Any of "de", "en", "ru", "zh", "az".
Lang UserLanguage `json:"lang"`
// User's name.
Name string `json:"name" api:"nullable"`
// User's phone.
Phone string `json:"phone" api:"nullable"`
// Services provider ID.
Reseller int64 `json:"reseller"`
// SSO authentication flag. If `true` then user can login via SAML SSO.
SSOAuth bool `json:"sso_auth"`
// Two-step verification:
//
// - `true` – user enabled two-step verification;
// - `false` – user disabled two-step verification.
TwoFa bool `json:"two_fa"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Activated respjson.Field
AuthTypes respjson.Field
Client respjson.Field
Company respjson.Field
Deleted respjson.Field
Email respjson.Field
Groups respjson.Field
Lang respjson.Field
Name respjson.Field
Phone respjson.Field
Reseller respjson.Field
SSOAuth respjson.Field
TwoFa respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AccountOverviewUser) RawJSON ¶
func (r AccountOverviewUser) RawJSON() string
Returns the unmodified JSON received from the API
func (*AccountOverviewUser) UnmarshalJSON ¶
func (r *AccountOverviewUser) UnmarshalJSON(data []byte) error
type IamService ¶
type IamService struct {
Options []option.RequestOption
// Use permanent API tokens for regular automated requests to services. You can
// either set its validity period when creating it or issue a token for an
// unlimited time. Please address the API documentation of the specific product in
// order to check if it supports API tokens.
//
// Newer endpoints under `/v2/…` issue tokens using `_` (underscore) as the
// separator (for example `42_a1b2c3d4e5f6...`) and are the recommended way to
// create new tokens. Legacy endpoints that issue `$`-separated tokens are marked
// deprecated and will be removed on **2026-07-17**; tokens that were already
// issued keep authenticating.
//
// Provide your APIKey in the Authorization header.
//
// Example:
// `curl -H "Authorization: APIKey 42_a1b2c3d4e5f6..." https://api.gcore.com/iam/users/me`
//
// Please note: When authorizing via SAML SSO, our system does not have any
// information about permissions given to the user by the identity provider. Even
// if the provider revokes the user's access rights, their tokens remain active.
// Therefore, if necessary, the token will need to be deleted manually.
APITokens APITokenService
Users UserService
}
Account management operations including authentication, password management, and account details.
IamService contains methods and other services that help with interacting with the gcore API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIamService method instead.
func NewIamService ¶
func NewIamService(opts ...option.RequestOption) (r IamService)
NewIamService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*IamService) GetAccountOverview ¶
func (r *IamService) GetAccountOverview(ctx context.Context, opts ...option.RequestOption) (res *AccountOverview, err error)
Get information about your profile, users and other account details.
type User ¶
type User struct {
// User's ID.
ID int64 `json:"id" api:"required"`
// Email confirmation:
//
// - `true` – user confirmed the email;
// - `false` – user did not confirm the email.
Activated bool `json:"activated" api:"required"`
// System field. List of auth types available for the account.
AuthTypes []AuthType `json:"auth_types" api:"required"`
// User's account ID.
Client float64 `json:"client" api:"required"`
// List of user's clients. User can access to one or more clients.
ClientAndRoles []UserClientAndRole `json:"client_and_roles" api:"required"`
// User's company.
Company string `json:"company" api:"required"`
// Deletion flag. If `true` then user was deleted.
Deleted bool `json:"deleted" api:"required"`
// User's email address.
Email string `json:"email" api:"required" format:"email"`
// User's group in the current account.
//
// IAM supports 5 groups:
//
// - Users
// - Administrators
// - Engineers
// - Purge and Prefetch only (API)
// - Purge and Prefetch only (API+Web)
Groups []UserGroup `json:"groups" api:"required"`
// User activity flag.
IsActive bool `json:"is_active" api:"required"`
// User's language.
//
// Defines language of the control panel and email messages.
//
// Any of "de", "en", "ru", "zh", "az".
Lang UserLanguage `json:"lang" api:"required"`
// User's name.
Name string `json:"name" api:"required"`
// User's phone.
Phone string `json:"phone" api:"required"`
// Services provider ID.
Reseller int64 `json:"reseller" api:"required"`
// SSO authentication flag. If `true` then user can login via SAML SSO.
SSOAuth bool `json:"sso_auth" api:"required"`
// Two-step verification:
//
// - `true` – user enabled two-step verification;
// - `false` – user disabled two-step verification.
TwoFa bool `json:"two_fa" api:"required"`
// User's type.
//
// Any of "common", "reseller", "seller".
UserType UserType `json:"user_type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Activated respjson.Field
AuthTypes respjson.Field
Client respjson.Field
ClientAndRoles respjson.Field
Company respjson.Field
Deleted respjson.Field
Email respjson.Field
Groups respjson.Field
IsActive respjson.Field
Lang respjson.Field
Name respjson.Field
Phone respjson.Field
Reseller respjson.Field
SSOAuth respjson.Field
TwoFa respjson.Field
UserType respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*User) UnmarshalJSON ¶
type UserClientAndRole ¶ added in v0.29.0
type UserClientAndRole struct {
ClientCompanyName string `json:"client_company_name" api:"required"`
ClientID int64 `json:"client_id" api:"required"`
// User's ID.
UserID int64 `json:"user_id" api:"required"`
// User role in this client.
UserRoles []string `json:"user_roles" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ClientCompanyName respjson.Field
ClientID respjson.Field
UserID respjson.Field
UserRoles respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UserClientAndRole) RawJSON ¶ added in v0.29.0
func (r UserClientAndRole) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserClientAndRole) UnmarshalJSON ¶ added in v0.29.0
func (r *UserClientAndRole) UnmarshalJSON(data []byte) error
type UserDeleteParams ¶
type UserDeleteParams struct {
ClientID int64 `path:"clientId" api:"required" json:"-"`
// contains filtered or unexported fields
}
type UserGetResponse ¶ added in v0.40.0
type UserGetResponse struct {
// User's ID.
ID int64 `json:"id" api:"required"`
// Email confirmation:
//
// - `true` – user confirmed the email;
// - `false` – user did not confirm the email.
Activated bool `json:"activated" api:"required"`
// System field. List of auth types available for the account.
AuthTypes []AuthType `json:"auth_types" api:"required"`
// User's account ID.
Client float64 `json:"client" api:"required"`
// User's company.
Company string `json:"company" api:"required"`
// Deletion flag. If `true` then user was deleted.
Deleted bool `json:"deleted" api:"required"`
// User's email address.
Email string `json:"email" api:"required" format:"email"`
// User's group in the current account.
//
// IAM supports 5 groups:
//
// - Users
// - Administrators
// - Engineers
// - Purge and Prefetch only (API)
// - Purge and Prefetch only (API+Web)
Groups []UserGroup `json:"groups" api:"required"`
// User activity flag.
IsActive bool `json:"is_active" api:"required"`
// User's language.
//
// Defines language of the control panel and email messages.
//
// Any of "de", "en", "ru", "zh", "az".
Lang UserLanguage `json:"lang" api:"required"`
// User's name.
Name string `json:"name" api:"required"`
// User's phone.
Phone string `json:"phone" api:"required"`
// Services provider ID.
Reseller int64 `json:"reseller" api:"required"`
// SSO authentication flag. If `true` then user can login via SAML SSO.
SSOAuth bool `json:"sso_auth" api:"required"`
// Two-step verification:
//
// - `true` – user enabled two-step verification;
// - `false` – user disabled two-step verification.
TwoFa bool `json:"two_fa" api:"required"`
// User's type.
//
// Any of "common", "reseller", "seller".
UserType UserType `json:"user_type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Activated respjson.Field
AuthTypes respjson.Field
Client respjson.Field
Company respjson.Field
Deleted respjson.Field
Email respjson.Field
Groups respjson.Field
IsActive respjson.Field
Lang respjson.Field
Name respjson.Field
Phone respjson.Field
Reseller respjson.Field
SSOAuth respjson.Field
TwoFa respjson.Field
UserType respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UserGetResponse) RawJSON ¶ added in v0.40.0
func (r UserGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserGetResponse) UnmarshalJSON ¶ added in v0.40.0
func (r *UserGetResponse) UnmarshalJSON(data []byte) error
type UserGroup ¶
type UserGroup struct {
// Group's ID: Possible values are:
//
// - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
// (API+Web)* 3022 - Purge and Prefetch only (API)
ID int64 `json:"id"`
// Group's name.
//
// Any of "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)",
// "Purge and Prefetch only (API+Web)".
Name UserGroupName `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UserGroup) ToParam ¶ added in v0.34.0
func (r UserGroup) ToParam() UserGroupParam
ToParam converts this UserGroup to a UserGroupParam.
Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with UserGroupParam.Overrides()
func (*UserGroup) UnmarshalJSON ¶
type UserGroupName ¶ added in v0.34.0
type UserGroupName string
Group's name.
const ( UserGroupNameUsers UserGroupName = "Users" UserGroupNameAdministrators UserGroupName = "Administrators" UserGroupNameEngineers UserGroupName = "Engineers" UserGroupNamePurgeAndPrefetchOnlyAPI UserGroupName = "Purge and Prefetch only (API)" UserGroupNamePurgeAndPrefetchOnlyAPIWeb UserGroupName = "Purge and Prefetch only (API+Web)" )
type UserGroupParam ¶ added in v0.34.0
type UserGroupParam struct {
// Group's ID: Possible values are:
//
// - 1 - Administrators* 2 - Users* 5 - Engineers* 3009 - Purge and Prefetch only
// (API+Web)* 3022 - Purge and Prefetch only (API)
ID param.Opt[int64] `json:"id,omitzero"`
// Group's name.
//
// Any of "Users", "Administrators", "Engineers", "Purge and Prefetch only (API)",
// "Purge and Prefetch only (API+Web)".
Name UserGroupName `json:"name,omitzero"`
// contains filtered or unexported fields
}
func (UserGroupParam) MarshalJSON ¶ added in v0.34.0
func (r UserGroupParam) MarshalJSON() (data []byte, err error)
func (*UserGroupParam) UnmarshalJSON ¶ added in v0.34.0
func (r *UserGroupParam) UnmarshalJSON(data []byte) error
type UserInviteParams ¶
type UserInviteParams struct {
// ID of account.
ClientID int64 `json:"client_id" api:"required"`
// User email.
Email string `json:"email" api:"required" format:"email"`
UserRole UserGroupParam `json:"user_role,omitzero" api:"required"`
// User name.
Name param.Opt[string] `json:"name,omitzero"`
// User's language.
//
// Defines language of the control panel and email messages.
//
// Any of "de", "en", "ru", "zh", "az".
Lang UserLanguage `json:"lang,omitzero"`
// contains filtered or unexported fields
}
func (UserInviteParams) MarshalJSON ¶
func (r UserInviteParams) MarshalJSON() (data []byte, err error)
func (*UserInviteParams) UnmarshalJSON ¶
func (r *UserInviteParams) UnmarshalJSON(data []byte) error
type UserInvited ¶ added in v0.34.0
type UserInvited struct {
// Status of the invitation.
Status string `json:"status" api:"required"`
// Invited user ID.
UserID int64 `json:"user_id" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
UserID respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UserInvited) RawJSON ¶ added in v0.34.0
func (r UserInvited) RawJSON() string
Returns the unmodified JSON received from the API
func (*UserInvited) UnmarshalJSON ¶ added in v0.34.0
func (r *UserInvited) UnmarshalJSON(data []byte) error
type UserLanguage ¶ added in v0.34.0
type UserLanguage string
User's language.
Defines language of the control panel and email messages.
const ( UserLanguageDe UserLanguage = "de" UserLanguageEn UserLanguage = "en" UserLanguageRu UserLanguage = "ru" UserLanguageZh UserLanguage = "zh" UserLanguageAz UserLanguage = "az" )
type UserListParams ¶
type UserListParams struct {
// The maximum number of items.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// Offset relative to the beginning of list.
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (UserListParams) URLQuery ¶
func (r UserListParams) URLQuery() (v url.Values, err error)
URLQuery serializes UserListParams's query parameters as `url.Values`.
type UserService ¶
type UserService struct {
Options []option.RequestOption
}
UserService contains methods and other services that help with interacting with the gcore API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUserService method instead.
func NewUserService ¶
func NewUserService(opts ...option.RequestOption) (r UserService)
NewUserService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*UserService) Delete ¶
func (r *UserService) Delete(ctx context.Context, userID int64, body UserDeleteParams, opts ...option.RequestOption) (err error)
Revokes user's access to the specified account. If the specified user doesn't have access to multiple accounts, the user is deleted.
func (*UserService) Get ¶
func (r *UserService) Get(ctx context.Context, userID int64, opts ...option.RequestOption) (res *UserGetResponse, err error)
Get user's details
func (*UserService) Invite ¶
func (r *UserService) Invite(ctx context.Context, body UserInviteParams, opts ...option.RequestOption) (res *UserInvited, err error)
Invite a user to the account.
User will receive an email. The new user will receive an invitation email with a link to create an account password, the existing user will be notified about the invitation to the account.
func (*UserService) List ¶
func (r *UserService) List(ctx context.Context, query UserListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[User], err error)
Get a list of users.
Pass a value for the `limit` parameter in your request if you want retrieve a paginated result. Otherwise API returns a list with all users without pagination.
func (*UserService) ListAutoPaging ¶
func (r *UserService) ListAutoPaging(ctx context.Context, query UserListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[User]
Get a list of users.
Pass a value for the `limit` parameter in your request if you want retrieve a paginated result. Otherwise API returns a list with all users without pagination.
func (*UserService) Update ¶
func (r *UserService) Update(ctx context.Context, userID int64, body UserUpdateParams, opts ...option.RequestOption) (res *User, err error)
This method updates user's details.
type UserUpdateParams ¶
type UserUpdateParams struct {
// User's name.
Name param.Opt[string] `json:"name,omitzero"`
// User's phone.
Phone param.Opt[string] `json:"phone,omitzero"`
// User's email address.
Email param.Opt[string] `json:"email,omitzero" format:"email"`
// System field. List of auth types available for the account.
AuthTypes []AuthType `json:"auth_types,omitzero"`
// User's language.
//
// Defines language of the control panel and email messages.
//
// Any of "de", "en", "ru", "zh", "az".
Lang UserLanguage `json:"lang,omitzero"`
// contains filtered or unexported fields
}
func (UserUpdateParams) MarshalJSON ¶
func (r UserUpdateParams) MarshalJSON() (data []byte, err error)
func (*UserUpdateParams) UnmarshalJSON ¶
func (r *UserUpdateParams) UnmarshalJSON(data []byte) error