mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-10 15:40:30 +00:00
1689 lines
61 KiB
Go
1689 lines
61 KiB
Go
|
// Code generated by msgraph-generate.go DO NOT EDIT.
|
||
|
|
||
|
package msgraph
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/yaegashi/msgraph.go/jsonx"
|
||
|
)
|
||
|
|
||
|
// AccessPackageAssignmentRequestObjectCancelRequestParameter undocumented
|
||
|
type AccessPackageAssignmentRequestObjectCancelRequestParameter struct {
|
||
|
}
|
||
|
|
||
|
// AccessReviewStopRequestParameter undocumented
|
||
|
type AccessReviewStopRequestParameter struct {
|
||
|
}
|
||
|
|
||
|
// AccessReviewSendReminderRequestParameter undocumented
|
||
|
type AccessReviewSendReminderRequestParameter struct {
|
||
|
}
|
||
|
|
||
|
// AccessReviewResetDecisionsRequestParameter undocumented
|
||
|
type AccessReviewResetDecisionsRequestParameter struct {
|
||
|
}
|
||
|
|
||
|
// AccessReviewApplyDecisionsRequestParameter undocumented
|
||
|
type AccessReviewApplyDecisionsRequestParameter struct {
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentPolicies returns request builder for AccessPackageAssignmentPolicy collection
|
||
|
func (b *AccessPackageRequestBuilder) AccessPackageAssignmentPolicies() *AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignmentPolicies"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder is request builder for AccessPackageAssignmentPolicy collection
|
||
|
type AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageAssignmentPolicy collection
|
||
|
func (b *AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder) Request() *AccessPackageAccessPackageAssignmentPoliciesCollectionRequest {
|
||
|
return &AccessPackageAccessPackageAssignmentPoliciesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageAssignmentPolicy item
|
||
|
func (b *AccessPackageAccessPackageAssignmentPoliciesCollectionRequestBuilder) ID(id string) *AccessPackageAssignmentPolicyRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAccessPackageAssignmentPoliciesCollectionRequest is request for AccessPackageAssignmentPolicy collection
|
||
|
type AccessPackageAccessPackageAssignmentPoliciesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageAssignmentPolicy collection
|
||
|
func (r *AccessPackageAccessPackageAssignmentPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageAssignmentPolicy, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageAssignmentPolicy
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageAssignmentPolicy
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageAssignmentPolicy collection, max N pages
|
||
|
func (r *AccessPackageAccessPackageAssignmentPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageAssignmentPolicy, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageAssignmentPolicy collection
|
||
|
func (r *AccessPackageAccessPackageAssignmentPoliciesCollectionRequest) Get(ctx context.Context) ([]AccessPackageAssignmentPolicy, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageAssignmentPolicy collection
|
||
|
func (r *AccessPackageAccessPackageAssignmentPoliciesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageAssignmentPolicy) (resObj *AccessPackageAssignmentPolicy, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalog is navigation property
|
||
|
func (b *AccessPackageRequestBuilder) AccessPackageCatalog() *AccessPackageCatalogRequestBuilder {
|
||
|
bb := &AccessPackageCatalogRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageCatalog"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceRoleScopes returns request builder for AccessPackageResourceRoleScope collection
|
||
|
func (b *AccessPackageRequestBuilder) AccessPackageResourceRoleScopes() *AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceRoleScopes"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder is request builder for AccessPackageResourceRoleScope collection
|
||
|
type AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResourceRoleScope collection
|
||
|
func (b *AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder) Request() *AccessPackageAccessPackageResourceRoleScopesCollectionRequest {
|
||
|
return &AccessPackageAccessPackageResourceRoleScopesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResourceRoleScope item
|
||
|
func (b *AccessPackageAccessPackageResourceRoleScopesCollectionRequestBuilder) ID(id string) *AccessPackageResourceRoleScopeRequestBuilder {
|
||
|
bb := &AccessPackageResourceRoleScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAccessPackageResourceRoleScopesCollectionRequest is request for AccessPackageResourceRoleScope collection
|
||
|
type AccessPackageAccessPackageResourceRoleScopesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResourceRoleScope collection
|
||
|
func (r *AccessPackageAccessPackageResourceRoleScopesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResourceRoleScope, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResourceRoleScope
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResourceRoleScope
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResourceRoleScope collection, max N pages
|
||
|
func (r *AccessPackageAccessPackageResourceRoleScopesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResourceRoleScope, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResourceRoleScope collection
|
||
|
func (r *AccessPackageAccessPackageResourceRoleScopesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResourceRoleScope, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResourceRoleScope collection
|
||
|
func (r *AccessPackageAccessPackageResourceRoleScopesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResourceRoleScope) (resObj *AccessPackageResourceRoleScope, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackage is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestBuilder) AccessPackage() *AccessPackageRequestBuilder {
|
||
|
bb := &AccessPackageRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackage"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentPolicy is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestBuilder) AccessPackageAssignmentPolicy() *AccessPackageAssignmentPolicyRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignmentPolicy"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentRequests returns request builder for AccessPackageAssignmentRequestObject collection
|
||
|
func (b *AccessPackageAssignmentRequestBuilder) AccessPackageAssignmentRequests() *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignmentRequests"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder is request builder for AccessPackageAssignmentRequestObject collection
|
||
|
type AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageAssignmentRequestObject collection
|
||
|
func (b *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder) Request() *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest {
|
||
|
return &AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageAssignmentRequestObject item
|
||
|
func (b *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequestBuilder) ID(id string) *AccessPackageAssignmentRequestObjectRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentRequestObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest is request for AccessPackageAssignmentRequestObject collection
|
||
|
type AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageAssignmentRequestObject collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageAssignmentRequestObject, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageAssignmentRequestObject
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageAssignmentRequestObject
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageAssignmentRequestObject collection, max N pages
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageAssignmentRequestObject, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageAssignmentRequestObject collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest) Get(ctx context.Context) ([]AccessPackageAssignmentRequestObject, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageAssignmentRequestObject collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentRequestsCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageAssignmentRequestObject) (resObj *AccessPackageAssignmentRequestObject, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentResourceRoles returns request builder for AccessPackageAssignmentResourceRole collection
|
||
|
func (b *AccessPackageAssignmentRequestBuilder) AccessPackageAssignmentResourceRoles() *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignmentResourceRoles"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder is request builder for AccessPackageAssignmentResourceRole collection
|
||
|
type AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageAssignmentResourceRole collection
|
||
|
func (b *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder) Request() *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest {
|
||
|
return &AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageAssignmentResourceRole item
|
||
|
func (b *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequestBuilder) ID(id string) *AccessPackageAssignmentResourceRoleRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest is request for AccessPackageAssignmentResourceRole collection
|
||
|
type AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageAssignmentResourceRole collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageAssignmentResourceRole, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageAssignmentResourceRole
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageAssignmentResourceRole
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageAssignmentResourceRole collection, max N pages
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageAssignmentResourceRole, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageAssignmentResourceRole collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest) Get(ctx context.Context) ([]AccessPackageAssignmentResourceRole, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageAssignmentResourceRole collection
|
||
|
func (r *AccessPackageAssignmentAccessPackageAssignmentResourceRolesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageAssignmentResourceRole) (resObj *AccessPackageAssignmentResourceRole, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// Target is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestBuilder) Target() *AccessPackageSubjectRequestBuilder {
|
||
|
bb := &AccessPackageSubjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/target"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackage is navigation property
|
||
|
func (b *AccessPackageAssignmentPolicyRequestBuilder) AccessPackage() *AccessPackageRequestBuilder {
|
||
|
bb := &AccessPackageRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackage"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalog is navigation property
|
||
|
func (b *AccessPackageAssignmentPolicyRequestBuilder) AccessPackageCatalog() *AccessPackageCatalogRequestBuilder {
|
||
|
bb := &AccessPackageCatalogRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageCatalog"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackage is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestObjectRequestBuilder) AccessPackage() *AccessPackageRequestBuilder {
|
||
|
bb := &AccessPackageRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackage"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignment is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestObjectRequestBuilder) AccessPackageAssignment() *AccessPackageAssignmentRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignment"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// Requestor is navigation property
|
||
|
func (b *AccessPackageAssignmentRequestObjectRequestBuilder) Requestor() *AccessPackageSubjectRequestBuilder {
|
||
|
bb := &AccessPackageSubjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/requestor"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignments returns request builder for AccessPackageAssignment collection
|
||
|
func (b *AccessPackageAssignmentResourceRoleRequestBuilder) AccessPackageAssignments() *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageAssignments"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder is request builder for AccessPackageAssignment collection
|
||
|
type AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageAssignment collection
|
||
|
func (b *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder) Request() *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest {
|
||
|
return &AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageAssignment item
|
||
|
func (b *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequestBuilder) ID(id string) *AccessPackageAssignmentRequestBuilder {
|
||
|
bb := &AccessPackageAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest is request for AccessPackageAssignment collection
|
||
|
type AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageAssignment collection
|
||
|
func (r *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageAssignment, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageAssignment
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageAssignment
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageAssignment collection, max N pages
|
||
|
func (r *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageAssignment, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageAssignment collection
|
||
|
func (r *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest) Get(ctx context.Context) ([]AccessPackageAssignment, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageAssignment collection
|
||
|
func (r *AccessPackageAssignmentResourceRoleAccessPackageAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageAssignment) (resObj *AccessPackageAssignment, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceRole is navigation property
|
||
|
func (b *AccessPackageAssignmentResourceRoleRequestBuilder) AccessPackageResourceRole() *AccessPackageResourceRoleRequestBuilder {
|
||
|
bb := &AccessPackageResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceRole"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceScope is navigation property
|
||
|
func (b *AccessPackageAssignmentResourceRoleRequestBuilder) AccessPackageResourceScope() *AccessPackageResourceScopeRequestBuilder {
|
||
|
bb := &AccessPackageResourceScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceScope"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageSubject is navigation property
|
||
|
func (b *AccessPackageAssignmentResourceRoleRequestBuilder) AccessPackageSubject() *AccessPackageSubjectRequestBuilder {
|
||
|
bb := &AccessPackageSubjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageSubject"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceRoles returns request builder for AccessPackageResourceRole collection
|
||
|
func (b *AccessPackageCatalogRequestBuilder) AccessPackageResourceRoles() *AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceRoles"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder is request builder for AccessPackageResourceRole collection
|
||
|
type AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResourceRole collection
|
||
|
func (b *AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder) Request() *AccessPackageCatalogAccessPackageResourceRolesCollectionRequest {
|
||
|
return &AccessPackageCatalogAccessPackageResourceRolesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResourceRole item
|
||
|
func (b *AccessPackageCatalogAccessPackageResourceRolesCollectionRequestBuilder) ID(id string) *AccessPackageResourceRoleRequestBuilder {
|
||
|
bb := &AccessPackageResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourceRolesCollectionRequest is request for AccessPackageResourceRole collection
|
||
|
type AccessPackageCatalogAccessPackageResourceRolesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceRolesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResourceRole, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResourceRole
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResourceRole
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResourceRole collection, max N pages
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceRolesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResourceRole, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceRolesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResourceRole, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceRolesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResourceRole) (resObj *AccessPackageResourceRole, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceScopes returns request builder for AccessPackageResourceScope collection
|
||
|
func (b *AccessPackageCatalogRequestBuilder) AccessPackageResourceScopes() *AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceScopes"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder is request builder for AccessPackageResourceScope collection
|
||
|
type AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResourceScope collection
|
||
|
func (b *AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder) Request() *AccessPackageCatalogAccessPackageResourceScopesCollectionRequest {
|
||
|
return &AccessPackageCatalogAccessPackageResourceScopesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResourceScope item
|
||
|
func (b *AccessPackageCatalogAccessPackageResourceScopesCollectionRequestBuilder) ID(id string) *AccessPackageResourceScopeRequestBuilder {
|
||
|
bb := &AccessPackageResourceScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourceScopesCollectionRequest is request for AccessPackageResourceScope collection
|
||
|
type AccessPackageCatalogAccessPackageResourceScopesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceScopesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResourceScope, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResourceScope
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResourceScope
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResourceScope collection, max N pages
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceScopesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResourceScope, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceScopesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResourceScope, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourceScopesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResourceScope) (resObj *AccessPackageResourceScope, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResources returns request builder for AccessPackageResource collection
|
||
|
func (b *AccessPackageCatalogRequestBuilder) AccessPackageResources() *AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResources"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder is request builder for AccessPackageResource collection
|
||
|
type AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResource collection
|
||
|
func (b *AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder) Request() *AccessPackageCatalogAccessPackageResourcesCollectionRequest {
|
||
|
return &AccessPackageCatalogAccessPackageResourcesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResource item
|
||
|
func (b *AccessPackageCatalogAccessPackageResourcesCollectionRequestBuilder) ID(id string) *AccessPackageResourceRequestBuilder {
|
||
|
bb := &AccessPackageResourceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackageResourcesCollectionRequest is request for AccessPackageResource collection
|
||
|
type AccessPackageCatalogAccessPackageResourcesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResource collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourcesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResource, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResource
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResource
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResource collection, max N pages
|
||
|
func (r *AccessPackageCatalogAccessPackageResourcesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResource, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResource collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourcesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResource, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResource collection
|
||
|
func (r *AccessPackageCatalogAccessPackageResourcesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResource) (resObj *AccessPackageResource, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackages returns request builder for AccessPackage collection
|
||
|
func (b *AccessPackageCatalogRequestBuilder) AccessPackages() *AccessPackageCatalogAccessPackagesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageCatalogAccessPackagesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackages"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackagesCollectionRequestBuilder is request builder for AccessPackage collection
|
||
|
type AccessPackageCatalogAccessPackagesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackage collection
|
||
|
func (b *AccessPackageCatalogAccessPackagesCollectionRequestBuilder) Request() *AccessPackageCatalogAccessPackagesCollectionRequest {
|
||
|
return &AccessPackageCatalogAccessPackagesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackage item
|
||
|
func (b *AccessPackageCatalogAccessPackagesCollectionRequestBuilder) ID(id string) *AccessPackageRequestBuilder {
|
||
|
bb := &AccessPackageRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageCatalogAccessPackagesCollectionRequest is request for AccessPackage collection
|
||
|
type AccessPackageCatalogAccessPackagesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackage collection
|
||
|
func (r *AccessPackageCatalogAccessPackagesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackage, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackage
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackage
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackage collection, max N pages
|
||
|
func (r *AccessPackageCatalogAccessPackagesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackage, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackage collection
|
||
|
func (r *AccessPackageCatalogAccessPackagesCollectionRequest) Get(ctx context.Context) ([]AccessPackage, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackage collection
|
||
|
func (r *AccessPackageCatalogAccessPackagesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackage) (resObj *AccessPackage, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceRoles returns request builder for AccessPackageResourceRole collection
|
||
|
func (b *AccessPackageResourceRequestBuilder) AccessPackageResourceRoles() *AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceRoles"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder is request builder for AccessPackageResourceRole collection
|
||
|
type AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResourceRole collection
|
||
|
func (b *AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder) Request() *AccessPackageResourceAccessPackageResourceRolesCollectionRequest {
|
||
|
return &AccessPackageResourceAccessPackageResourceRolesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResourceRole item
|
||
|
func (b *AccessPackageResourceAccessPackageResourceRolesCollectionRequestBuilder) ID(id string) *AccessPackageResourceRoleRequestBuilder {
|
||
|
bb := &AccessPackageResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceAccessPackageResourceRolesCollectionRequest is request for AccessPackageResourceRole collection
|
||
|
type AccessPackageResourceAccessPackageResourceRolesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceRolesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResourceRole, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResourceRole
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResourceRole
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResourceRole collection, max N pages
|
||
|
func (r *AccessPackageResourceAccessPackageResourceRolesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResourceRole, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceRolesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResourceRole, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResourceRole collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceRolesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResourceRole) (resObj *AccessPackageResourceRole, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceScopes returns request builder for AccessPackageResourceScope collection
|
||
|
func (b *AccessPackageResourceRequestBuilder) AccessPackageResourceScopes() *AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder {
|
||
|
bb := &AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceScopes"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder is request builder for AccessPackageResourceScope collection
|
||
|
type AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessPackageResourceScope collection
|
||
|
func (b *AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder) Request() *AccessPackageResourceAccessPackageResourceScopesCollectionRequest {
|
||
|
return &AccessPackageResourceAccessPackageResourceScopesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessPackageResourceScope item
|
||
|
func (b *AccessPackageResourceAccessPackageResourceScopesCollectionRequestBuilder) ID(id string) *AccessPackageResourceScopeRequestBuilder {
|
||
|
bb := &AccessPackageResourceScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceAccessPackageResourceScopesCollectionRequest is request for AccessPackageResourceScope collection
|
||
|
type AccessPackageResourceAccessPackageResourceScopesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceScopesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessPackageResourceScope, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessPackageResourceScope
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessPackageResourceScope
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessPackageResourceScope collection, max N pages
|
||
|
func (r *AccessPackageResourceAccessPackageResourceScopesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessPackageResourceScope, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceScopesCollectionRequest) Get(ctx context.Context) ([]AccessPackageResourceScope, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessPackageResourceScope collection
|
||
|
func (r *AccessPackageResourceAccessPackageResourceScopesCollectionRequest) Add(ctx context.Context, reqObj *AccessPackageResourceScope) (resObj *AccessPackageResourceScope, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// AccessPackageResource is navigation property
|
||
|
func (b *AccessPackageResourceRequestObjectRequestBuilder) AccessPackageResource() *AccessPackageResourceRequestBuilder {
|
||
|
bb := &AccessPackageResourceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResource"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// Requestor is navigation property
|
||
|
func (b *AccessPackageResourceRequestObjectRequestBuilder) Requestor() *AccessPackageSubjectRequestBuilder {
|
||
|
bb := &AccessPackageSubjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/requestor"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResource is navigation property
|
||
|
func (b *AccessPackageResourceRoleRequestBuilder) AccessPackageResource() *AccessPackageResourceRequestBuilder {
|
||
|
bb := &AccessPackageResourceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResource"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceRole is navigation property
|
||
|
func (b *AccessPackageResourceRoleScopeRequestBuilder) AccessPackageResourceRole() *AccessPackageResourceRoleRequestBuilder {
|
||
|
bb := &AccessPackageResourceRoleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceRole"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResourceScope is navigation property
|
||
|
func (b *AccessPackageResourceRoleScopeRequestBuilder) AccessPackageResourceScope() *AccessPackageResourceScopeRequestBuilder {
|
||
|
bb := &AccessPackageResourceScopeRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResourceScope"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessPackageResource is navigation property
|
||
|
func (b *AccessPackageResourceScopeRequestBuilder) AccessPackageResource() *AccessPackageResourceRequestBuilder {
|
||
|
bb := &AccessPackageResourceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/accessPackageResource"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// Decisions returns request builder for AccessReviewDecision collection
|
||
|
func (b *AccessReviewRequestBuilder) Decisions() *AccessReviewDecisionsCollectionRequestBuilder {
|
||
|
bb := &AccessReviewDecisionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/decisions"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewDecisionsCollectionRequestBuilder is request builder for AccessReviewDecision collection
|
||
|
type AccessReviewDecisionsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessReviewDecision collection
|
||
|
func (b *AccessReviewDecisionsCollectionRequestBuilder) Request() *AccessReviewDecisionsCollectionRequest {
|
||
|
return &AccessReviewDecisionsCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessReviewDecision item
|
||
|
func (b *AccessReviewDecisionsCollectionRequestBuilder) ID(id string) *AccessReviewDecisionRequestBuilder {
|
||
|
bb := &AccessReviewDecisionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewDecisionsCollectionRequest is request for AccessReviewDecision collection
|
||
|
type AccessReviewDecisionsCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessReviewDecision collection
|
||
|
func (r *AccessReviewDecisionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessReviewDecision, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessReviewDecision
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessReviewDecision
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessReviewDecision collection, max N pages
|
||
|
func (r *AccessReviewDecisionsCollectionRequest) GetN(ctx context.Context, n int) ([]AccessReviewDecision, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessReviewDecision collection
|
||
|
func (r *AccessReviewDecisionsCollectionRequest) Get(ctx context.Context) ([]AccessReviewDecision, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessReviewDecision collection
|
||
|
func (r *AccessReviewDecisionsCollectionRequest) Add(ctx context.Context, reqObj *AccessReviewDecision) (resObj *AccessReviewDecision, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// Instances returns request builder for AccessReview collection
|
||
|
func (b *AccessReviewRequestBuilder) Instances() *AccessReviewInstancesCollectionRequestBuilder {
|
||
|
bb := &AccessReviewInstancesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/instances"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewInstancesCollectionRequestBuilder is request builder for AccessReview collection
|
||
|
type AccessReviewInstancesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessReview collection
|
||
|
func (b *AccessReviewInstancesCollectionRequestBuilder) Request() *AccessReviewInstancesCollectionRequest {
|
||
|
return &AccessReviewInstancesCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessReview item
|
||
|
func (b *AccessReviewInstancesCollectionRequestBuilder) ID(id string) *AccessReviewRequestBuilder {
|
||
|
bb := &AccessReviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewInstancesCollectionRequest is request for AccessReview collection
|
||
|
type AccessReviewInstancesCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessReview collection
|
||
|
func (r *AccessReviewInstancesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessReview, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessReview
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessReview
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessReview collection, max N pages
|
||
|
func (r *AccessReviewInstancesCollectionRequest) GetN(ctx context.Context, n int) ([]AccessReview, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessReview collection
|
||
|
func (r *AccessReviewInstancesCollectionRequest) Get(ctx context.Context) ([]AccessReview, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessReview collection
|
||
|
func (r *AccessReviewInstancesCollectionRequest) Add(ctx context.Context, reqObj *AccessReview) (resObj *AccessReview, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// MyDecisions returns request builder for AccessReviewDecision collection
|
||
|
func (b *AccessReviewRequestBuilder) MyDecisions() *AccessReviewMyDecisionsCollectionRequestBuilder {
|
||
|
bb := &AccessReviewMyDecisionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/myDecisions"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewMyDecisionsCollectionRequestBuilder is request builder for AccessReviewDecision collection
|
||
|
type AccessReviewMyDecisionsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessReviewDecision collection
|
||
|
func (b *AccessReviewMyDecisionsCollectionRequestBuilder) Request() *AccessReviewMyDecisionsCollectionRequest {
|
||
|
return &AccessReviewMyDecisionsCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessReviewDecision item
|
||
|
func (b *AccessReviewMyDecisionsCollectionRequestBuilder) ID(id string) *AccessReviewDecisionRequestBuilder {
|
||
|
bb := &AccessReviewDecisionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewMyDecisionsCollectionRequest is request for AccessReviewDecision collection
|
||
|
type AccessReviewMyDecisionsCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessReviewDecision collection
|
||
|
func (r *AccessReviewMyDecisionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessReviewDecision, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessReviewDecision
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessReviewDecision
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessReviewDecision collection, max N pages
|
||
|
func (r *AccessReviewMyDecisionsCollectionRequest) GetN(ctx context.Context, n int) ([]AccessReviewDecision, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessReviewDecision collection
|
||
|
func (r *AccessReviewMyDecisionsCollectionRequest) Get(ctx context.Context) ([]AccessReviewDecision, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessReviewDecision collection
|
||
|
func (r *AccessReviewMyDecisionsCollectionRequest) Add(ctx context.Context, reqObj *AccessReviewDecision) (resObj *AccessReviewDecision, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// Reviewers returns request builder for AccessReviewReviewer collection
|
||
|
func (b *AccessReviewRequestBuilder) Reviewers() *AccessReviewReviewersCollectionRequestBuilder {
|
||
|
bb := &AccessReviewReviewersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/reviewers"
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewReviewersCollectionRequestBuilder is request builder for AccessReviewReviewer collection
|
||
|
type AccessReviewReviewersCollectionRequestBuilder struct{ BaseRequestBuilder }
|
||
|
|
||
|
// Request returns request for AccessReviewReviewer collection
|
||
|
func (b *AccessReviewReviewersCollectionRequestBuilder) Request() *AccessReviewReviewersCollectionRequest {
|
||
|
return &AccessReviewReviewersCollectionRequest{
|
||
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ID returns request builder for AccessReviewReviewer item
|
||
|
func (b *AccessReviewReviewersCollectionRequestBuilder) ID(id string) *AccessReviewReviewerRequestBuilder {
|
||
|
bb := &AccessReviewReviewerRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
||
|
bb.baseURL += "/" + id
|
||
|
return bb
|
||
|
}
|
||
|
|
||
|
// AccessReviewReviewersCollectionRequest is request for AccessReviewReviewer collection
|
||
|
type AccessReviewReviewersCollectionRequest struct{ BaseRequest }
|
||
|
|
||
|
// Paging perfoms paging operation for AccessReviewReviewer collection
|
||
|
func (r *AccessReviewReviewersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AccessReviewReviewer, error) {
|
||
|
req, err := r.NewJSONRequest(method, path, obj)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err := r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
var values []AccessReviewReviewer
|
||
|
for {
|
||
|
defer res.Body.Close()
|
||
|
if res.StatusCode != http.StatusOK {
|
||
|
b, _ := ioutil.ReadAll(res.Body)
|
||
|
errRes := &ErrorResponse{Response: res}
|
||
|
err := jsonx.Unmarshal(b, errRes)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
||
|
}
|
||
|
return nil, errRes
|
||
|
}
|
||
|
var (
|
||
|
paging Paging
|
||
|
value []AccessReviewReviewer
|
||
|
)
|
||
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
err = jsonx.Unmarshal(paging.Value, &value)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
values = append(values, value...)
|
||
|
if n >= 0 {
|
||
|
n--
|
||
|
}
|
||
|
if n == 0 || len(paging.NextLink) == 0 {
|
||
|
return values, nil
|
||
|
}
|
||
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
||
|
if ctx != nil {
|
||
|
req = req.WithContext(ctx)
|
||
|
}
|
||
|
res, err = r.client.Do(req)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// GetN performs GET request for AccessReviewReviewer collection, max N pages
|
||
|
func (r *AccessReviewReviewersCollectionRequest) GetN(ctx context.Context, n int) ([]AccessReviewReviewer, error) {
|
||
|
var query string
|
||
|
if r.query != nil {
|
||
|
query = "?" + r.query.Encode()
|
||
|
}
|
||
|
return r.Paging(ctx, "GET", query, nil, n)
|
||
|
}
|
||
|
|
||
|
// Get performs GET request for AccessReviewReviewer collection
|
||
|
func (r *AccessReviewReviewersCollectionRequest) Get(ctx context.Context) ([]AccessReviewReviewer, error) {
|
||
|
return r.GetN(ctx, 0)
|
||
|
}
|
||
|
|
||
|
// Add performs POST request for AccessReviewReviewer collection
|
||
|
func (r *AccessReviewReviewersCollectionRequest) Add(ctx context.Context, reqObj *AccessReviewReviewer) (resObj *AccessReviewReviewer, err error) {
|
||
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
||
|
return
|
||
|
}
|