Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #1623

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ type MemberListResponse struct {
// Member Name.
Name string `json:"name,required,nullable"`
// Roles assigned to this Member.
Roles []IamSchemasRole `json:"roles,required"`
Roles []Role `json:"roles,required"`
// A member's status in the organization.
Status MemberListResponseStatus `json:"status,required"`
JSON memberListResponseJSON `json:"-"`
Expand Down
18 changes: 9 additions & 9 deletions accounts/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewRoleService(opts ...option.RequestOption) (r *RoleService) {
}

// Get all available roles for an account.
func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...option.RequestOption) (res *[]IamSchemasRole, err error) {
func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...option.RequestOption) (res *[]Role, err error) {
opts = append(r.Options[:], opts...)
var env RoleListResponseEnvelope
path := fmt.Sprintf("accounts/%v/roles", query.AccountID)
Expand All @@ -59,20 +59,20 @@ func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGet
return
}

type IamSchemasRole struct {
type Role struct {
// Role identifier tag.
ID string `json:"id,required"`
// Description of role's permissions.
Description string `json:"description,required"`
// Role Name.
Name string `json:"name,required"`
// Access permissions for this User.
Permissions []string `json:"permissions,required"`
JSON iamSchemasRoleJSON `json:"-"`
Permissions []string `json:"permissions,required"`
JSON roleJSON `json:"-"`
}

// iamSchemasRoleJSON contains the JSON metadata for the struct [IamSchemasRole]
type iamSchemasRoleJSON struct {
// roleJSON contains the JSON metadata for the struct [Role]
type roleJSON struct {
ID apijson.Field
Description apijson.Field
Name apijson.Field
Expand All @@ -81,11 +81,11 @@ type iamSchemasRoleJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *IamSchemasRole) UnmarshalJSON(data []byte) (err error) {
func (r *Role) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r iamSchemasRoleJSON) RawJSON() string {
func (r roleJSON) RawJSON() string {
return r.raw
}

Expand All @@ -112,7 +112,7 @@ type RoleListParams struct {
type RoleListResponseEnvelope struct {
Errors []RoleListResponseEnvelopeErrors `json:"errors,required"`
Messages []RoleListResponseEnvelopeMessages `json:"messages,required"`
Result []IamSchemasRole `json:"result,required,nullable"`
Result []Role `json:"result,required,nullable"`
// Whether the API call was successful
Success RoleListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo RoleListResponseEnvelopeResultInfo `json:"result_info"`
Expand Down
19 changes: 10 additions & 9 deletions alerting/destinationpagerduty.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (r *DestinationPagerdutyService) Delete(ctx context.Context, body Destinati
}

// Get a list of all configured PagerDuty services.
func (r *DestinationPagerdutyService) Get(ctx context.Context, query DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]AaaPagerduty, err error) {
func (r *DestinationPagerdutyService) Get(ctx context.Context, query DestinationPagerdutyGetParams, opts ...option.RequestOption) (res *[]AlertingPagerduty, err error) {
opts = append(r.Options[:], opts...)
var env DestinationPagerdutyGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/pagerduty", query.AccountID)
Expand All @@ -86,27 +86,28 @@ func (r *DestinationPagerdutyService) Link(ctx context.Context, tokenID string,
return
}

type AaaPagerduty struct {
type AlertingPagerduty struct {
// UUID
ID string `json:"id"`
// The name of the pagerduty service.
Name string `json:"name"`
JSON aaaPagerdutyJSON `json:"-"`
Name string `json:"name"`
JSON alertingPagerdutyJSON `json:"-"`
}

// aaaPagerdutyJSON contains the JSON metadata for the struct [AaaPagerduty]
type aaaPagerdutyJSON struct {
// alertingPagerdutyJSON contains the JSON metadata for the struct
// [AlertingPagerduty]
type alertingPagerdutyJSON struct {
ID apijson.Field
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AaaPagerduty) UnmarshalJSON(data []byte) (err error) {
func (r *AlertingPagerduty) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r aaaPagerdutyJSON) RawJSON() string {
func (r alertingPagerdutyJSON) RawJSON() string {
return r.raw
}

Expand Down Expand Up @@ -409,7 +410,7 @@ type DestinationPagerdutyGetParams struct {
type DestinationPagerdutyGetResponseEnvelope struct {
Errors []DestinationPagerdutyGetResponseEnvelopeErrors `json:"errors,required"`
Messages []DestinationPagerdutyGetResponseEnvelopeMessages `json:"messages,required"`
Result []AaaPagerduty `json:"result,required,nullable"`
Result []AlertingPagerduty `json:"result,required,nullable"`
// Whether the API call was successful
Success DestinationPagerdutyGetResponseEnvelopeSuccess `json:"success,required"`
ResultInfo DestinationPagerdutyGetResponseEnvelopeResultInfo `json:"result_info"`
Expand Down
37 changes: 19 additions & 18 deletions alerting/destinationwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *DestinationWebhookService) Update(ctx context.Context, webhookID string
}

// Gets a list of all configured webhook destinations.
func (r *DestinationWebhookService) List(ctx context.Context, query DestinationWebhookListParams, opts ...option.RequestOption) (res *[]AaaWebhooks, err error) {
func (r *DestinationWebhookService) List(ctx context.Context, query DestinationWebhookListParams, opts ...option.RequestOption) (res *[]AlertingWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env DestinationWebhookListResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", query.AccountID)
Expand All @@ -88,7 +88,7 @@ func (r *DestinationWebhookService) Delete(ctx context.Context, webhookID string
}

// Get details for a single webhooks destination.
func (r *DestinationWebhookService) Get(ctx context.Context, webhookID string, query DestinationWebhookGetParams, opts ...option.RequestOption) (res *AaaWebhooks, err error) {
func (r *DestinationWebhookService) Get(ctx context.Context, webhookID string, query DestinationWebhookGetParams, opts ...option.RequestOption) (res *AlertingWebhooks, err error) {
opts = append(r.Options[:], opts...)
var env DestinationWebhookGetResponseEnvelope
path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks/%s", query.AccountID, webhookID)
Expand All @@ -100,7 +100,7 @@ func (r *DestinationWebhookService) Get(ctx context.Context, webhookID string, q
return
}

type AaaWebhooks struct {
type AlertingWebhooks struct {
// The unique identifier of a webhook
ID string `json:"id"`
// Timestamp of when the webhook destination was created.
Expand All @@ -119,14 +119,15 @@ type AaaWebhooks struct {
// destinations. Secrets are not returned in any API response body.
Secret string `json:"secret"`
// Type of webhook endpoint.
Type AaaWebhooksType `json:"type"`
Type AlertingWebhooksType `json:"type"`
// The POST endpoint to call when dispatching a notification.
URL string `json:"url"`
JSON aaaWebhooksJSON `json:"-"`
URL string `json:"url"`
JSON alertingWebhooksJSON `json:"-"`
}

// aaaWebhooksJSON contains the JSON metadata for the struct [AaaWebhooks]
type aaaWebhooksJSON struct {
// alertingWebhooksJSON contains the JSON metadata for the struct
// [AlertingWebhooks]
type alertingWebhooksJSON struct {
ID apijson.Field
CreatedAt apijson.Field
LastFailure apijson.Field
Expand All @@ -139,26 +140,26 @@ type aaaWebhooksJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *AaaWebhooks) UnmarshalJSON(data []byte) (err error) {
func (r *AlertingWebhooks) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r aaaWebhooksJSON) RawJSON() string {
func (r alertingWebhooksJSON) RawJSON() string {
return r.raw
}

// Type of webhook endpoint.
type AaaWebhooksType string
type AlertingWebhooksType string

const (
AaaWebhooksTypeSlack AaaWebhooksType = "slack"
AaaWebhooksTypeGeneric AaaWebhooksType = "generic"
AaaWebhooksTypeGchat AaaWebhooksType = "gchat"
AlertingWebhooksTypeSlack AlertingWebhooksType = "slack"
AlertingWebhooksTypeGeneric AlertingWebhooksType = "generic"
AlertingWebhooksTypeGchat AlertingWebhooksType = "gchat"
)

func (r AaaWebhooksType) IsKnown() bool {
func (r AlertingWebhooksType) IsKnown() bool {
switch r {
case AaaWebhooksTypeSlack, AaaWebhooksTypeGeneric, AaaWebhooksTypeGchat:
case AlertingWebhooksTypeSlack, AlertingWebhooksTypeGeneric, AlertingWebhooksTypeGchat:
return true
}
return false
Expand Down Expand Up @@ -455,7 +456,7 @@ type DestinationWebhookListParams struct {
type DestinationWebhookListResponseEnvelope struct {
Errors []DestinationWebhookListResponseEnvelopeErrors `json:"errors,required"`
Messages []DestinationWebhookListResponseEnvelopeMessages `json:"messages,required"`
Result []AaaWebhooks `json:"result,required,nullable"`
Result []AlertingWebhooks `json:"result,required,nullable"`
// Whether the API call was successful
Success DestinationWebhookListResponseEnvelopeSuccess `json:"success,required"`
ResultInfo DestinationWebhookListResponseEnvelopeResultInfo `json:"result_info"`
Expand Down Expand Up @@ -709,7 +710,7 @@ type DestinationWebhookGetParams struct {
type DestinationWebhookGetResponseEnvelope struct {
Errors []DestinationWebhookGetResponseEnvelopeErrors `json:"errors,required"`
Messages []DestinationWebhookGetResponseEnvelopeMessages `json:"messages,required"`
Result AaaWebhooks `json:"result,required"`
Result AlertingWebhooks `json:"result,required"`
// Whether the API call was successful
Success DestinationWebhookGetResponseEnvelopeSuccess `json:"success,required"`
JSON destinationWebhookGetResponseEnvelopeJSON `json:"-"`
Expand Down
32 changes: 16 additions & 16 deletions alerting/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewHistoryService(opts ...option.RequestOption) (r *HistoryService) {
// Gets a list of history records for notifications sent to an account. The records
// are displayed for last `x` number of days based on the zone plan (free = 30, pro
// = 30, biz = 30, ent = 90).
func (r *HistoryService) List(ctx context.Context, params HistoryListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[AaaHistory], err error) {
func (r *HistoryService) List(ctx context.Context, params HistoryListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[AlertingHistory], err error) {
var raw *http.Response
opts = append(r.Options, opts...)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
Expand All @@ -57,11 +57,11 @@ func (r *HistoryService) List(ctx context.Context, params HistoryListParams, opt
// Gets a list of history records for notifications sent to an account. The records
// are displayed for last `x` number of days based on the zone plan (free = 30, pro
// = 30, biz = 30, ent = 90).
func (r *HistoryService) ListAutoPaging(ctx context.Context, params HistoryListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[AaaHistory] {
func (r *HistoryService) ListAutoPaging(ctx context.Context, params HistoryListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[AlertingHistory] {
return shared.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...))
}

type AaaHistory struct {
type AlertingHistory struct {
// UUID
ID string `json:"id"`
// Message body included in the notification sent.
Expand All @@ -74,18 +74,18 @@ type AaaHistory struct {
Mechanism string `json:"mechanism"`
// The type of mechanism to which the notification has been dispatched. This can be
// email/pagerduty/webhook based on the mechanism configured.
MechanismType AaaHistoryMechanismType `json:"mechanism_type"`
MechanismType AlertingHistoryMechanismType `json:"mechanism_type"`
// Name of the policy.
Name string `json:"name"`
// The unique identifier of a notification policy
PolicyID string `json:"policy_id"`
// Timestamp of when the notification was dispatched in ISO 8601 format.
Sent time.Time `json:"sent" format:"date-time"`
JSON aaaHistoryJSON `json:"-"`
Sent time.Time `json:"sent" format:"date-time"`
JSON alertingHistoryJSON `json:"-"`
}

// aaaHistoryJSON contains the JSON metadata for the struct [AaaHistory]
type aaaHistoryJSON struct {
// alertingHistoryJSON contains the JSON metadata for the struct [AlertingHistory]
type alertingHistoryJSON struct {
ID apijson.Field
AlertBody apijson.Field
AlertType apijson.Field
Expand All @@ -99,27 +99,27 @@ type aaaHistoryJSON struct {
ExtraFields map[string]apijson.Field
}

func (r *AaaHistory) UnmarshalJSON(data []byte) (err error) {
func (r *AlertingHistory) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r aaaHistoryJSON) RawJSON() string {
func (r alertingHistoryJSON) RawJSON() string {
return r.raw
}

// The type of mechanism to which the notification has been dispatched. This can be
// email/pagerduty/webhook based on the mechanism configured.
type AaaHistoryMechanismType string
type AlertingHistoryMechanismType string

const (
AaaHistoryMechanismTypeEmail AaaHistoryMechanismType = "email"
AaaHistoryMechanismTypePagerduty AaaHistoryMechanismType = "pagerduty"
AaaHistoryMechanismTypeWebhook AaaHistoryMechanismType = "webhook"
AlertingHistoryMechanismTypeEmail AlertingHistoryMechanismType = "email"
AlertingHistoryMechanismTypePagerduty AlertingHistoryMechanismType = "pagerduty"
AlertingHistoryMechanismTypeWebhook AlertingHistoryMechanismType = "webhook"
)

func (r AaaHistoryMechanismType) IsKnown() bool {
func (r AlertingHistoryMechanismType) IsKnown() bool {
switch r {
case AaaHistoryMechanismTypeEmail, AaaHistoryMechanismTypePagerduty, AaaHistoryMechanismTypeWebhook:
case AlertingHistoryMechanismTypeEmail, AlertingHistoryMechanismTypePagerduty, AlertingHistoryMechanismTypeWebhook:
return true
}
return false
Expand Down
Loading