Skip to content
Merged
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
12 changes: 12 additions & 0 deletions api/audit_trail/v1alpha1/audit_trail_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ type ListEventsResponse struct {
type ListProductsRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

// OrganizationID: ID of the Organization containing the Audit Trail events.
OrganizationID string `json:"organization_id"`
}

// ListProductsResponse: list products response.
Expand Down Expand Up @@ -441,13 +444,22 @@ func (s *API) ListProducts(req *ListProductsRequest, opts ...scw.RequestOption)
req.Region = defaultRegion
}

if req.OrganizationID == "" {
defaultOrganizationID, _ := s.client.GetDefaultOrganizationID()
req.OrganizationID = defaultOrganizationID
}

query := url.Values{}
parameter.AddToQuery(query, "organization_id", req.OrganizationID)

if fmt.Sprint(req.Region) == "" {
return nil, errors.New("field Region cannot be empty in request")
}

scwReq := &scw.ScalewayRequest{
Method: "GET",
Path: "/audit-trail/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/products",
Query: query,
}

var resp ListProductsResponse
Expand Down
Loading