Files
teleport/lib/msgraph/odata.go
T
Justinas Stankevičius c5a5f8e7a2 Replace MS Graph SDK with an in-house client (#44069)
* Add MS Graph client skeleton

* Complete retry logic

* Add GetID() to GroupMember

* Parse MS Graph API error responses

* Pull out page size into config

* Add missing "patch" methods to client interface

* Move code around

* Factor out roundtrip()

* Fill out remaining methods

* Add godocs and solve lints

* Run gci

* Move godocs to the interface

* Add missing method

* Finish errors_test

* close body in test

* nit

* Add license headers

* Move azureoidc onboarding code to msgraph.Client

* Make AzureTokenProvider public

* Use cmp.Or to shorten config defaults handling

* Address review nits

* Parallelize tests

* nit

* Respect context cancellation in retry logic

* Utilize BlockUntil in tests

* Remove Client interface, make client struct public

* Prefer defaults.HTTPClient to http.DefaultClient

* Iterate entra apps, do not buffer all in memory

* nit

* Set additional timeouts on default HTTP client

* Escape path segments when constructing URLs

* Add a general timeout for default HTTP client
2024-07-17 15:51:39 +00:00

33 lines
1.3 KiB
Go

// Teleport
// Copyright (C) 2024 Gravitational, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package msgraph
import "encoding/json"
// oDataPage defines the structure of a response to a paginated MS Graph endpoint.
// Value is an abstract `json.RawMessage` type to offer flexibility for the consumer,
// e.g. [client.IterateGroupMembers] will deserialize each of the array elements into potentially different concrete types.
type oDataPage struct {
NextLink string `json:"@odata.nextLink,omitempty"`
Value json.RawMessage `json:"value,omitempty"`
}
// oDataListResponse defines the structure of a simple "list" response from the MS Graph API.
type oDataListResponse[T any] struct {
Value []T `json:"value,omitempty"`
}