Родитель
153d3422c6
Коммит
0960cecac9
|
@ -8,7 +8,7 @@ _obj
|
|||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
# *.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
# CHANGELOG
|
||||
|
||||
## `v11.2.1-beta`
|
||||
|
||||
### Bug Fixes
|
||||
- Commenting out ignore rule that false-positived on the graphrbac package.
|
||||
|
||||
## `v11.2.0-beta`
|
||||
|
||||
### Repository Structure
|
||||
|
|
|
@ -0,0 +1,740 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ApplicationsClient is the the Graph RBAC Management Client
|
||||
type ApplicationsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewApplicationsClient creates an instance of the ApplicationsClient client.
|
||||
func NewApplicationsClient(tenantID string) ApplicationsClient {
|
||||
return NewApplicationsClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client.
|
||||
func NewApplicationsClientWithBaseURI(baseURI string, tenantID string) ApplicationsClient {
|
||||
return ApplicationsClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// Create create a new application.
|
||||
//
|
||||
// parameters is the parameters for creating an application.
|
||||
func (client ApplicationsClient) Create(parameters ApplicationCreateParameters) (result Application, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AvailableToOtherTenants", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.IdentifierUris", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.ApplicationsClient", "Create")
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client ApplicationsClient) CreatePreparer(parameters ApplicationCreateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete delete an application.
|
||||
//
|
||||
// applicationObjectID is application object ID.
|
||||
func (client ApplicationsClient) Delete(applicationObjectID string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(applicationObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client ApplicationsClient) DeletePreparer(applicationObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get get an application by object ID.
|
||||
//
|
||||
// applicationObjectID is application object ID.
|
||||
func (client ApplicationsClient) Get(applicationObjectID string) (result Application, err error) {
|
||||
req, err := client.GetPreparer(applicationObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ApplicationsClient) GetPreparer(applicationObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List lists applications by filter parameters.
|
||||
//
|
||||
// filter is the filters to apply to the operation.
|
||||
func (client ApplicationsClient) List(filter string) (result ApplicationListResult, err error) {
|
||||
req, err := client.ListPreparer(filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client ApplicationsClient) ListPreparer(filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete gets all elements from the list without paging.
|
||||
func (client ApplicationsClient) ListComplete(filter string, cancel <-chan struct{}) (<-chan Application, <-chan error) {
|
||||
resultChan := make(chan Application)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.List(filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.ListNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ListKeyCredentials get the keyCredentials associated with an application.
|
||||
//
|
||||
// applicationObjectID is application object ID.
|
||||
func (client ApplicationsClient) ListKeyCredentials(applicationObjectID string) (result KeyCredentialListResult, err error) {
|
||||
req, err := client.ListKeyCredentialsPreparer(applicationObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListKeyCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListKeyCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListKeyCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListKeyCredentialsPreparer prepares the ListKeyCredentials request.
|
||||
func (client ApplicationsClient) ListKeyCredentialsPreparer(applicationObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNext gets a list of applications from the current tenant.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client ApplicationsClient) ListNext(nextLink string) (result ApplicationListResult, err error) {
|
||||
req, err := client.ListNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextPreparer prepares the ListNext request.
|
||||
func (client ApplicationsClient) ListNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListNextSender sends the ListNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListNextResponder handles the response to the ListNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListPasswordCredentials get the passwordCredentials associated with an application.
|
||||
//
|
||||
// applicationObjectID is application object ID.
|
||||
func (client ApplicationsClient) ListPasswordCredentials(applicationObjectID string) (result PasswordCredentialListResult, err error) {
|
||||
req, err := client.ListPasswordCredentialsPreparer(applicationObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListPasswordCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListPasswordCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListPasswordCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request.
|
||||
func (client ApplicationsClient) ListPasswordCredentialsPreparer(applicationObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Patch update an existing application.
|
||||
//
|
||||
// applicationObjectID is application object ID. parameters is parameters to update an existing application.
|
||||
func (client ApplicationsClient) Patch(applicationObjectID string, parameters ApplicationUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.PatchPreparer(applicationObjectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.PatchSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.PatchResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "Patch", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// PatchPreparer prepares the Patch request.
|
||||
func (client ApplicationsClient) PatchPreparer(applicationObjectID string, parameters ApplicationUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// PatchSender sends the Patch request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// PatchResponder handles the response to the Patch request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateKeyCredentials update the keyCredentials associated with an application.
|
||||
//
|
||||
// applicationObjectID is application object ID. parameters is parameters to update the keyCredentials of an existing
|
||||
// application.
|
||||
func (client ApplicationsClient) UpdateKeyCredentials(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.UpdateKeyCredentialsPreparer(applicationObjectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateKeyCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateKeyCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdateKeyCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request.
|
||||
func (client ApplicationsClient) UpdateKeyCredentialsPreparer(applicationObjectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/keyCredentials", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentials update passwordCredentials associated with an application.
|
||||
//
|
||||
// applicationObjectID is application object ID. parameters is parameters to update passwordCredentials of an existing
|
||||
// application.
|
||||
func (client ApplicationsClient) UpdatePasswordCredentials(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.UpdatePasswordCredentialsPreparer(applicationObjectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdatePasswordCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdatePasswordCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "UpdatePasswordCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request.
|
||||
func (client ApplicationsClient) UpdatePasswordCredentialsPreparer(applicationObjectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationObjectId": autorest.Encode("path", applicationObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/applications/{applicationObjectId}/passwordCredentials", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Package graphrbac implements the Azure ARM Graphrbac service API version 1.6.
|
||||
//
|
||||
// The Graph RBAC Management Client
|
||||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Graphrbac
|
||||
DefaultBaseURI = "https://graph.windows.net"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Graphrbac.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
TenantID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(tenantID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, tenantID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
TenantID: tenantID,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DomainsClient is the the Graph RBAC Management Client
|
||||
type DomainsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewDomainsClient creates an instance of the DomainsClient client.
|
||||
func NewDomainsClient(tenantID string) DomainsClient {
|
||||
return NewDomainsClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewDomainsClientWithBaseURI creates an instance of the DomainsClient client.
|
||||
func NewDomainsClientWithBaseURI(baseURI string, tenantID string) DomainsClient {
|
||||
return DomainsClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// Get gets a specific domain in the current tenant.
|
||||
//
|
||||
// domainName is name of the domain.
|
||||
func (client DomainsClient) Get(domainName string) (result Domain, err error) {
|
||||
req, err := client.GetPreparer(domainName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client DomainsClient) GetPreparer(domainName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"domainName": autorest.Encode("path", domainName),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/domains/{domainName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List gets a list of domains for the current tenant.
|
||||
//
|
||||
// filter is the filter to apply to the operation.
|
||||
func (client DomainsClient) List(filter string) (result DomainListResult, err error) {
|
||||
req, err := client.ListPreparer(filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.DomainsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client DomainsClient) ListPreparer(filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/domains", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DomainsClient) ListResponder(resp *http.Response) (result DomainListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,871 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GroupsClient is the the Graph RBAC Management Client
|
||||
type GroupsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewGroupsClient creates an instance of the GroupsClient client.
|
||||
func NewGroupsClient(tenantID string) GroupsClient {
|
||||
return NewGroupsClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client.
|
||||
func NewGroupsClientWithBaseURI(baseURI string, tenantID string) GroupsClient {
|
||||
return GroupsClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// AddMember add a member to a group.
|
||||
//
|
||||
// groupObjectID is the object ID of the group to which to add the member. parameters is the URL of the member object,
|
||||
// such as
|
||||
// https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
|
||||
func (client GroupsClient) AddMember(groupObjectID string, parameters GroupAddMemberParameters) (result autorest.Response, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "AddMember")
|
||||
}
|
||||
|
||||
req, err := client.AddMemberPreparer(groupObjectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.AddMemberSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.AddMemberResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "AddMember", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// AddMemberPreparer prepares the AddMember request.
|
||||
func (client GroupsClient) AddMemberPreparer(groupObjectID string, parameters GroupAddMemberParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"groupObjectId": autorest.Encode("path", groupObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// AddMemberSender sends the AddMember request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) AddMemberSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// AddMemberResponder handles the response to the AddMember request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) AddMemberResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Create create a group in the directory.
|
||||
//
|
||||
// parameters is the parameters for the group to create.
|
||||
func (client GroupsClient) Create(parameters GroupCreateParameters) (result ADGroup, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.MailEnabled", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.SecurityEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "Create")
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client GroupsClient) CreatePreparer(parameters GroupCreateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) CreateResponder(resp *http.Response) (result ADGroup, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete delete a group from the directory.
|
||||
//
|
||||
// objectID is the object ID of the group to delete.
|
||||
func (client GroupsClient) Delete(objectID string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client GroupsClient) DeletePreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets group information from the directory.
|
||||
//
|
||||
// objectID is the object ID of the user for which to get group information.
|
||||
func (client GroupsClient) Get(objectID string) (result ADGroup, err error) {
|
||||
req, err := client.GetPreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client GroupsClient) GetPreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{objectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) GetResponder(resp *http.Response) (result ADGroup, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetGroupMembers gets the members of a group.
|
||||
//
|
||||
// objectID is the object ID of the group whose members should be retrieved.
|
||||
func (client GroupsClient) GetGroupMembers(objectID string) (result GetObjectsResult, err error) {
|
||||
req, err := client.GetGroupMembersPreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetGroupMembersSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetGroupMembersResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetGroupMembersPreparer prepares the GetGroupMembers request.
|
||||
func (client GroupsClient) GetGroupMembersPreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{objectId}/members", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetGroupMembersSender sends the GetGroupMembers request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) GetGroupMembersSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetGroupMembersResponder handles the response to the GetGroupMembers request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) GetGroupMembersResponder(resp *http.Response) (result GetObjectsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetGroupMembersComplete gets all elements from the list without paging.
|
||||
func (client GroupsClient) GetGroupMembersComplete(objectID string, cancel <-chan struct{}) (<-chan AADObject, <-chan error) {
|
||||
resultChan := make(chan AADObject)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.GetGroupMembers(objectID)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.GetGroupMembersNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// GetGroupMembersNext gets the members of a group.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client GroupsClient) GetGroupMembersNext(nextLink string) (result GetObjectsResult, err error) {
|
||||
req, err := client.GetGroupMembersNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetGroupMembersNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetGroupMembersNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembersNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetGroupMembersNextPreparer prepares the GetGroupMembersNext request.
|
||||
func (client GroupsClient) GetGroupMembersNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetGroupMembersNextSender sends the GetGroupMembersNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) GetGroupMembersNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetGroupMembersNextResponder handles the response to the GetGroupMembersNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) GetGroupMembersNextResponder(resp *http.Response) (result GetObjectsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetMemberGroups gets a collection of object IDs of groups of which the specified group is a member.
|
||||
//
|
||||
// objectID is the object ID of the group for which to get group membership. parameters is group filtering parameters.
|
||||
func (client GroupsClient) GetMemberGroups(objectID string, parameters GroupGetMemberGroupsParameters) (result GroupGetMemberGroupsResult, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "GetMemberGroups")
|
||||
}
|
||||
|
||||
req, err := client.GetMemberGroupsPreparer(objectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetMemberGroupsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetMemberGroupsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetMemberGroups", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetMemberGroupsPreparer prepares the GetMemberGroups request.
|
||||
func (client GroupsClient) GetMemberGroupsPreparer(objectID string, parameters GroupGetMemberGroupsParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{objectId}/getMemberGroups", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) GetMemberGroupsResponder(resp *http.Response) (result GroupGetMemberGroupsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// IsMemberOf checks whether the specified user, group, contact, or service principal is a direct or transitive member
|
||||
// of the specified group.
|
||||
//
|
||||
// parameters is the check group membership parameters.
|
||||
func (client GroupsClient) IsMemberOf(parameters CheckGroupMembershipParameters) (result CheckGroupMembershipResult, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.GroupID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.MemberID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.GroupsClient", "IsMemberOf")
|
||||
}
|
||||
|
||||
req, err := client.IsMemberOfPreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.IsMemberOfSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.IsMemberOfResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "IsMemberOf", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// IsMemberOfPreparer prepares the IsMemberOf request.
|
||||
func (client GroupsClient) IsMemberOfPreparer(parameters CheckGroupMembershipParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/isMemberOf", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// IsMemberOfSender sends the IsMemberOf request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) IsMemberOfSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// IsMemberOfResponder handles the response to the IsMemberOf request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) IsMemberOfResponder(resp *http.Response) (result CheckGroupMembershipResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List gets list of groups for the current tenant.
|
||||
//
|
||||
// filter is the filter to apply to the operation.
|
||||
func (client GroupsClient) List(filter string) (result GroupListResult, err error) {
|
||||
req, err := client.ListPreparer(filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client GroupsClient) ListPreparer(filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete gets all elements from the list without paging.
|
||||
func (client GroupsClient) ListComplete(filter string, cancel <-chan struct{}) (<-chan ADGroup, <-chan error) {
|
||||
resultChan := make(chan ADGroup)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.List(filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.ListNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ListNext gets a list of groups for the current tenant.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client GroupsClient) ListNext(nextLink string) (result GroupListResult, err error) {
|
||||
req, err := client.ListNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextPreparer prepares the ListNext request.
|
||||
func (client GroupsClient) ListNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListNextSender sends the ListNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) ListNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListNextResponder handles the response to the ListNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) ListNextResponder(resp *http.Response) (result GroupListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// RemoveMember remove a member from a group.
|
||||
//
|
||||
// groupObjectID is the object ID of the group from which to remove the member. memberObjectID is member object id
|
||||
func (client GroupsClient) RemoveMember(groupObjectID string, memberObjectID string) (result autorest.Response, err error) {
|
||||
req, err := client.RemoveMemberPreparer(groupObjectID, memberObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.RemoveMemberSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.RemoveMemberResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "RemoveMember", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// RemoveMemberPreparer prepares the RemoveMember request.
|
||||
func (client GroupsClient) RemoveMemberPreparer(groupObjectID string, memberObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"groupObjectId": autorest.Encode("path", groupObjectID),
|
||||
"memberObjectId": autorest.Encode("path", memberObjectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// RemoveMemberSender sends the RemoveMember request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client GroupsClient) RemoveMemberSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// RemoveMemberResponder handles the response to the RemoveMember request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client GroupsClient) RemoveMemberResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
)
|
||||
|
||||
// UserType enumerates the values for user type.
|
||||
type UserType string
|
||||
|
||||
const (
|
||||
// Guest specifies the guest state for user type.
|
||||
Guest UserType = "Guest"
|
||||
// Member specifies the member state for user type.
|
||||
Member UserType = "Member"
|
||||
)
|
||||
|
||||
// AADObject is the properties of an Active Directory object.
|
||||
type AADObject struct {
|
||||
autorest.Response `json:"-"`
|
||||
ObjectID *string `json:"objectId,omitempty"`
|
||||
ObjectType *string `json:"objectType,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
UserPrincipalName *string `json:"userPrincipalName,omitempty"`
|
||||
Mail *string `json:"mail,omitempty"`
|
||||
MailEnabled *bool `json:"mailEnabled,omitempty"`
|
||||
MailNickname *string `json:"mailNickname,omitempty"`
|
||||
SecurityEnabled *bool `json:"securityEnabled,omitempty"`
|
||||
SignInName *string `json:"signInName,omitempty"`
|
||||
ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"`
|
||||
UserType *string `json:"userType,omitempty"`
|
||||
UsageLocation *string `json:"usageLocation,omitempty"`
|
||||
AppID *string `json:"appId,omitempty"`
|
||||
AppPermissions *[]string `json:"appPermissions,omitempty"`
|
||||
AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"`
|
||||
IdentifierUris *[]string `json:"identifierUris,omitempty"`
|
||||
ReplyUrls *[]string `json:"replyUrls,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
}
|
||||
|
||||
// ADGroup is active Directory group information.
|
||||
type ADGroup struct {
|
||||
autorest.Response `json:"-"`
|
||||
ObjectID *string `json:"objectId,omitempty"`
|
||||
ObjectType *string `json:"objectType,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
SecurityEnabled *bool `json:"securityEnabled,omitempty"`
|
||||
Mail *string `json:"mail,omitempty"`
|
||||
}
|
||||
|
||||
// Application is active Directory application information.
|
||||
type Application struct {
|
||||
autorest.Response `json:"-"`
|
||||
ObjectID *string `json:"objectId,omitempty"`
|
||||
ObjectType *string `json:"objectType,omitempty"`
|
||||
AppID *string `json:"appId,omitempty"`
|
||||
AppPermissions *[]string `json:"appPermissions,omitempty"`
|
||||
AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
IdentifierUris *[]string `json:"identifierUris,omitempty"`
|
||||
ReplyUrls *[]string `json:"replyUrls,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationCreateParameters is request parameters for creating a new application.
|
||||
type ApplicationCreateParameters struct {
|
||||
AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
IdentifierUris *[]string `json:"identifierUris,omitempty"`
|
||||
ReplyUrls *[]string `json:"replyUrls,omitempty"`
|
||||
KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"`
|
||||
PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"`
|
||||
Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"`
|
||||
RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationListResult is application list operation result.
|
||||
type ApplicationListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Application `json:"value,omitempty"`
|
||||
OdataNextLink *string `json:"odata.nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationUpdateParameters is request parameters for updating an existing application.
|
||||
type ApplicationUpdateParameters struct {
|
||||
AvailableToOtherTenants *bool `json:"availableToOtherTenants,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
IdentifierUris *[]string `json:"identifierUris,omitempty"`
|
||||
ReplyUrls *[]string `json:"replyUrls,omitempty"`
|
||||
KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"`
|
||||
PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"`
|
||||
Oauth2AllowImplicitFlow *bool `json:"oauth2AllowImplicitFlow,omitempty"`
|
||||
RequiredResourceAccess *[]RequiredResourceAccess `json:"requiredResourceAccess,omitempty"`
|
||||
}
|
||||
|
||||
// CheckGroupMembershipParameters is request parameters for IsMemberOf API call.
|
||||
type CheckGroupMembershipParameters struct {
|
||||
GroupID *string `json:"groupId,omitempty"`
|
||||
MemberID *string `json:"memberId,omitempty"`
|
||||
}
|
||||
|
||||
// CheckGroupMembershipResult is server response for IsMemberOf API call
|
||||
type CheckGroupMembershipResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *bool `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// Domain is active Directory Domain information.
|
||||
type Domain struct {
|
||||
autorest.Response `json:"-"`
|
||||
AuthenticationType *string `json:"authenticationType,omitempty"`
|
||||
IsDefault *bool `json:"isDefault,omitempty"`
|
||||
IsVerified *bool `json:"isVerified,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// DomainListResult is server response for Get tenant domains API call.
|
||||
type DomainListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Domain `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ErrorMessage is active Directory error message.
|
||||
type ErrorMessage struct {
|
||||
Message *string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// GetObjectsParameters is request parameters for the GetObjectsByObjectIds API.
|
||||
type GetObjectsParameters struct {
|
||||
ObjectIds *[]string `json:"objectIds,omitempty"`
|
||||
Types *[]string `json:"types,omitempty"`
|
||||
IncludeDirectoryObjectReferences *bool `json:"includeDirectoryObjectReferences,omitempty"`
|
||||
}
|
||||
|
||||
// GetObjectsResult is the response to an Active Directory object inquiry API request.
|
||||
type GetObjectsResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]AADObject `json:"value,omitempty"`
|
||||
OdataNextLink *string `json:"odata.nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// GraphError is active Directory error information.
|
||||
type GraphError struct {
|
||||
*OdataError `json:"odata.error,omitempty"`
|
||||
}
|
||||
|
||||
// GroupAddMemberParameters is request parameters for adding a member to a group.
|
||||
type GroupAddMemberParameters struct {
|
||||
URL *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// GroupCreateParameters is request parameters for creating a new group.
|
||||
type GroupCreateParameters struct {
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
MailEnabled *bool `json:"mailEnabled,omitempty"`
|
||||
MailNickname *string `json:"mailNickname,omitempty"`
|
||||
SecurityEnabled *bool `json:"securityEnabled,omitempty"`
|
||||
}
|
||||
|
||||
// GroupGetMemberGroupsParameters is request parameters for GetMemberGroups API call.
|
||||
type GroupGetMemberGroupsParameters struct {
|
||||
SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"`
|
||||
}
|
||||
|
||||
// GroupGetMemberGroupsResult is server response for GetMemberGroups API call.
|
||||
type GroupGetMemberGroupsResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// GroupListResult is server response for Get tenant groups API call
|
||||
type GroupListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ADGroup `json:"value,omitempty"`
|
||||
OdataNextLink *string `json:"odata.nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// KeyCredential is active Directory Key Credential information.
|
||||
type KeyCredential struct {
|
||||
StartDate *date.Time `json:"startDate,omitempty"`
|
||||
EndDate *date.Time `json:"endDate,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
KeyID *string `json:"keyId,omitempty"`
|
||||
Usage *string `json:"usage,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// KeyCredentialListResult is keyCredential list operation result.
|
||||
type KeyCredentialListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]KeyCredential `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// KeyCredentialsUpdateParameters is request parameters for a KeyCredentials update operation
|
||||
type KeyCredentialsUpdateParameters struct {
|
||||
Value *[]KeyCredential `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// OdataError is active Directory OData error information.
|
||||
type OdataError struct {
|
||||
Code *string `json:"code,omitempty"`
|
||||
*ErrorMessage `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// PasswordCredential is active Directory Password Credential information.
|
||||
type PasswordCredential struct {
|
||||
StartDate *date.Time `json:"startDate,omitempty"`
|
||||
EndDate *date.Time `json:"endDate,omitempty"`
|
||||
KeyID *string `json:"keyId,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// PasswordCredentialListResult is passwordCredential list operation result.
|
||||
type PasswordCredentialListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]PasswordCredential `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// PasswordCredentialsUpdateParameters is request parameters for a PasswordCredentials update operation.
|
||||
type PasswordCredentialsUpdateParameters struct {
|
||||
Value *[]PasswordCredential `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// PasswordProfile is the password profile associated with a user.
|
||||
type PasswordProfile struct {
|
||||
Password *string `json:"password,omitempty"`
|
||||
ForceChangePasswordNextLogin *bool `json:"forceChangePasswordNextLogin,omitempty"`
|
||||
}
|
||||
|
||||
// RequiredResourceAccess is specifies the set of OAuth 2.0 permission scopes and app roles under the specified
|
||||
// resource that an application requires access to. The specified OAuth 2.0 permission scopes may be requested by
|
||||
// client applications (through the requiredResourceAccess collection) when calling a resource application. The
|
||||
// requiredResourceAccess property of the Application entity is a collection of ReqiredResourceAccess.
|
||||
type RequiredResourceAccess struct {
|
||||
ResourceAccess *[]ResourceAccess `json:"resourceAccess,omitempty"`
|
||||
ResourceAppID *string `json:"resourceAppId,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceAccess is specifies an OAuth 2.0 permission scope or an app role that an application requires. The
|
||||
// resourceAccess property of the RequiredResourceAccess type is a collection of ResourceAccess.
|
||||
type ResourceAccess struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePrincipal is active Directory service principal information.
|
||||
type ServicePrincipal struct {
|
||||
autorest.Response `json:"-"`
|
||||
ObjectID *string `json:"objectId,omitempty"`
|
||||
ObjectType *string `json:"objectType,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
AppID *string `json:"appId,omitempty"`
|
||||
ServicePrincipalNames *[]string `json:"servicePrincipalNames,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePrincipalCreateParameters is request parameters for creating a new service principal.
|
||||
type ServicePrincipalCreateParameters struct {
|
||||
AppID *string `json:"appId,omitempty"`
|
||||
AccountEnabled *bool `json:"accountEnabled,omitempty"`
|
||||
KeyCredentials *[]KeyCredential `json:"keyCredentials,omitempty"`
|
||||
PasswordCredentials *[]PasswordCredential `json:"passwordCredentials,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePrincipalListResult is server response for get tenant service principals API call.
|
||||
type ServicePrincipalListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ServicePrincipal `json:"value,omitempty"`
|
||||
OdataNextLink *string `json:"odata.nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// SignInName is contains information about a sign-in name of a local account user in an Azure Active Directory B2C
|
||||
// tenant.
|
||||
type SignInName struct {
|
||||
Type *string `json:"type,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// User is active Directory user information.
|
||||
type User struct {
|
||||
autorest.Response `json:"-"`
|
||||
ImmutableID *string `json:"immutableId,omitempty"`
|
||||
UsageLocation *string `json:"usageLocation,omitempty"`
|
||||
GivenName *string `json:"givenName,omitempty"`
|
||||
Surname *string `json:"surname,omitempty"`
|
||||
UserType UserType `json:"userType,omitempty"`
|
||||
AccountEnabled *bool `json:"accountEnabled,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
UserPrincipalName *string `json:"userPrincipalName,omitempty"`
|
||||
MailNickname *string `json:"mailNickname,omitempty"`
|
||||
Mail *string `json:"mail,omitempty"`
|
||||
ObjectID *string `json:"objectId,omitempty"`
|
||||
ObjectType *string `json:"objectType,omitempty"`
|
||||
SignInNames *[]SignInName `json:"signInNames,omitempty"`
|
||||
}
|
||||
|
||||
// UserBase is
|
||||
type UserBase struct {
|
||||
ImmutableID *string `json:"immutableId,omitempty"`
|
||||
UsageLocation *string `json:"usageLocation,omitempty"`
|
||||
GivenName *string `json:"givenName,omitempty"`
|
||||
Surname *string `json:"surname,omitempty"`
|
||||
UserType UserType `json:"userType,omitempty"`
|
||||
}
|
||||
|
||||
// UserCreateParameters is request parameters for creating a new work or school account user.
|
||||
type UserCreateParameters struct {
|
||||
ImmutableID *string `json:"immutableId,omitempty"`
|
||||
UsageLocation *string `json:"usageLocation,omitempty"`
|
||||
GivenName *string `json:"givenName,omitempty"`
|
||||
Surname *string `json:"surname,omitempty"`
|
||||
UserType UserType `json:"userType,omitempty"`
|
||||
AccountEnabled *bool `json:"accountEnabled,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"`
|
||||
UserPrincipalName *string `json:"userPrincipalName,omitempty"`
|
||||
MailNickname *string `json:"mailNickname,omitempty"`
|
||||
Mail *string `json:"mail,omitempty"`
|
||||
}
|
||||
|
||||
// UserGetMemberGroupsParameters is request parameters for GetMemberGroups API call.
|
||||
type UserGetMemberGroupsParameters struct {
|
||||
SecurityEnabledOnly *bool `json:"securityEnabledOnly,omitempty"`
|
||||
}
|
||||
|
||||
// UserGetMemberGroupsResult is server response for GetMemberGroups API call.
|
||||
type UserGetMemberGroupsResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// UserListResult is server response for Get tenant users API call.
|
||||
type UserListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]User `json:"value,omitempty"`
|
||||
OdataNextLink *string `json:"odata.nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// UserUpdateParameters is request parameters for updating an existing work or school account user.
|
||||
type UserUpdateParameters struct {
|
||||
ImmutableID *string `json:"immutableId,omitempty"`
|
||||
UsageLocation *string `json:"usageLocation,omitempty"`
|
||||
GivenName *string `json:"givenName,omitempty"`
|
||||
Surname *string `json:"surname,omitempty"`
|
||||
UserType UserType `json:"userType,omitempty"`
|
||||
AccountEnabled *bool `json:"accountEnabled,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"`
|
||||
UserPrincipalName *string `json:"userPrincipalName,omitempty"`
|
||||
MailNickname *string `json:"mailNickname,omitempty"`
|
||||
}
|
|
@ -0,0 +1,281 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ObjectsClient is the the Graph RBAC Management Client
|
||||
type ObjectsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewObjectsClient creates an instance of the ObjectsClient client.
|
||||
func NewObjectsClient(tenantID string) ObjectsClient {
|
||||
return NewObjectsClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewObjectsClientWithBaseURI creates an instance of the ObjectsClient client.
|
||||
func NewObjectsClientWithBaseURI(baseURI string, tenantID string) ObjectsClient {
|
||||
return ObjectsClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// GetCurrentUser gets the details for the currently logged-in user.
|
||||
func (client ObjectsClient) GetCurrentUser() (result AADObject, err error) {
|
||||
req, err := client.GetCurrentUserPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetCurrentUserSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetCurrentUserResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetCurrentUser", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetCurrentUserPreparer prepares the GetCurrentUser request.
|
||||
func (client ObjectsClient) GetCurrentUserPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/me", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetCurrentUserSender sends the GetCurrentUser request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ObjectsClient) GetCurrentUserSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetCurrentUserResponder handles the response to the GetCurrentUser request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ObjectsClient) GetCurrentUserResponder(resp *http.Response) (result AADObject, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIds gets AD group membership for the specified AD object IDs.
|
||||
//
|
||||
// parameters is objects filtering parameters.
|
||||
func (client ObjectsClient) GetObjectsByObjectIds(parameters GetObjectsParameters) (result GetObjectsResult, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.IncludeDirectoryObjectReferences", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds")
|
||||
}
|
||||
|
||||
req, err := client.GetObjectsByObjectIdsPreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetObjectsByObjectIdsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetObjectsByObjectIdsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsPreparer prepares the GetObjectsByObjectIds request.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsPreparer(parameters GetObjectsParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/getObjectsByObjectIds", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsSender sends the GetObjectsByObjectIds request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsResponder handles the response to the GetObjectsByObjectIds request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsResponder(resp *http.Response) (result GetObjectsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsComplete gets all elements from the list without paging.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsComplete(parameters GetObjectsParameters, cancel <-chan struct{}) (<-chan AADObject, <-chan error) {
|
||||
resultChan := make(chan AADObject)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.GetObjectsByObjectIds(parameters)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.GetObjectsByObjectIdsNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsNext gets AD group membership for the specified AD object IDs.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsNext(nextLink string) (result GetObjectsResult, err error) {
|
||||
req, err := client.GetObjectsByObjectIdsNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetObjectsByObjectIdsNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetObjectsByObjectIdsNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIdsNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsNextPreparer prepares the GetObjectsByObjectIdsNext request.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsNextSender sends the GetObjectsByObjectIdsNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetObjectsByObjectIdsNextResponder handles the response to the GetObjectsByObjectIdsNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ObjectsClient) GetObjectsByObjectIdsNextResponder(resp *http.Response) (result GetObjectsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
|
@ -0,0 +1,674 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ServicePrincipalsClient is the the Graph RBAC Management Client
|
||||
type ServicePrincipalsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewServicePrincipalsClient creates an instance of the ServicePrincipalsClient client.
|
||||
func NewServicePrincipalsClient(tenantID string) ServicePrincipalsClient {
|
||||
return NewServicePrincipalsClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewServicePrincipalsClientWithBaseURI creates an instance of the ServicePrincipalsClient client.
|
||||
func NewServicePrincipalsClientWithBaseURI(baseURI string, tenantID string) ServicePrincipalsClient {
|
||||
return ServicePrincipalsClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// Create creates a service principal in the directory.
|
||||
//
|
||||
// parameters is parameters to create a service principal.
|
||||
func (client ServicePrincipalsClient) Create(parameters ServicePrincipalCreateParameters) (result ServicePrincipal, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AppID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.ServicePrincipalsClient", "Create")
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client ServicePrincipalsClient) CreatePreparer(parameters ServicePrincipalCreateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) CreateResponder(resp *http.Response) (result ServicePrincipal, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a service principal from the directory.
|
||||
//
|
||||
// objectID is the object ID of the service principal to delete.
|
||||
func (client ServicePrincipalsClient) Delete(objectID string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client ServicePrincipalsClient) DeletePreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets service principal information from the directory.
|
||||
//
|
||||
// objectID is the object ID of the service principal to get.
|
||||
func (client ServicePrincipalsClient) Get(objectID string) (result ServicePrincipal, err error) {
|
||||
req, err := client.GetPreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ServicePrincipalsClient) GetPreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List gets a list of service principals from the current tenant.
|
||||
//
|
||||
// filter is the filter to apply to the operation.
|
||||
func (client ServicePrincipalsClient) List(filter string) (result ServicePrincipalListResult, err error) {
|
||||
req, err := client.ListPreparer(filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client ServicePrincipalsClient) ListPreparer(filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) ListResponder(resp *http.Response) (result ServicePrincipalListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete gets all elements from the list without paging.
|
||||
func (client ServicePrincipalsClient) ListComplete(filter string, cancel <-chan struct{}) (<-chan ServicePrincipal, <-chan error) {
|
||||
resultChan := make(chan ServicePrincipal)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.List(filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.ListNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ListKeyCredentials get the keyCredentials associated with the specified service principal.
|
||||
//
|
||||
// objectID is the object ID of the service principal for which to get keyCredentials.
|
||||
func (client ServicePrincipalsClient) ListKeyCredentials(objectID string) (result KeyCredentialListResult, err error) {
|
||||
req, err := client.ListKeyCredentialsPreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListKeyCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListKeyCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListKeyCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListKeyCredentialsPreparer prepares the ListKeyCredentials request.
|
||||
func (client ServicePrincipalsClient) ListKeyCredentialsPreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListKeyCredentialsSender sends the ListKeyCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) ListKeyCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListKeyCredentialsResponder handles the response to the ListKeyCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNext gets a list of service principals from the current tenant.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client ServicePrincipalsClient) ListNext(nextLink string) (result ServicePrincipalListResult, err error) {
|
||||
req, err := client.ListNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextPreparer prepares the ListNext request.
|
||||
func (client ServicePrincipalsClient) ListNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListNextSender sends the ListNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) ListNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListNextResponder handles the response to the ListNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) ListNextResponder(resp *http.Response) (result ServicePrincipalListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListPasswordCredentials gets the passwordCredentials associated with a service principal.
|
||||
//
|
||||
// objectID is the object ID of the service principal.
|
||||
func (client ServicePrincipalsClient) ListPasswordCredentials(objectID string) (result PasswordCredentialListResult, err error) {
|
||||
req, err := client.ListPasswordCredentialsPreparer(objectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListPasswordCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListPasswordCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListPasswordCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsPreparer prepares the ListPasswordCredentials request.
|
||||
func (client ServicePrincipalsClient) ListPasswordCredentialsPreparer(objectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsSender sends the ListPasswordCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) ListPasswordCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListPasswordCredentialsResponder handles the response to the ListPasswordCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateKeyCredentials update the keyCredentials associated with a service principal.
|
||||
//
|
||||
// objectID is the object ID for which to get service principal information. parameters is parameters to update the
|
||||
// keyCredentials of an existing service principal.
|
||||
func (client ServicePrincipalsClient) UpdateKeyCredentials(objectID string, parameters KeyCredentialsUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.UpdateKeyCredentialsPreparer(objectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateKeyCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateKeyCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdateKeyCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsPreparer prepares the UpdateKeyCredentials request.
|
||||
func (client ServicePrincipalsClient) UpdateKeyCredentialsPreparer(objectID string, parameters KeyCredentialsUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/keyCredentials", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsSender sends the UpdateKeyCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) UpdateKeyCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateKeyCredentialsResponder handles the response to the UpdateKeyCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentials updates the passwordCredentials associated with a service principal.
|
||||
//
|
||||
// objectID is the object ID of the service principal. parameters is parameters to update the passwordCredentials of an
|
||||
// existing service principal.
|
||||
func (client ServicePrincipalsClient) UpdatePasswordCredentials(objectID string, parameters PasswordCredentialsUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.UpdatePasswordCredentialsPreparer(objectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdatePasswordCredentialsSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdatePasswordCredentialsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "UpdatePasswordCredentials", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsPreparer prepares the UpdatePasswordCredentials request.
|
||||
func (client ServicePrincipalsClient) UpdatePasswordCredentialsPreparer(objectID string, parameters PasswordCredentialsUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/servicePrincipals/{objectId}/passwordCredentials", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsSender sends the UpdatePasswordCredentials request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServicePrincipalsClient) UpdatePasswordCredentialsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdatePasswordCredentialsResponder handles the response to the UpdatePasswordCredentials request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServicePrincipalsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
|
@ -0,0 +1,556 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// UsersClient is the the Graph RBAC Management Client
|
||||
type UsersClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewUsersClient creates an instance of the UsersClient client.
|
||||
func NewUsersClient(tenantID string) UsersClient {
|
||||
return NewUsersClientWithBaseURI(DefaultBaseURI, tenantID)
|
||||
}
|
||||
|
||||
// NewUsersClientWithBaseURI creates an instance of the UsersClient client.
|
||||
func NewUsersClientWithBaseURI(baseURI string, tenantID string) UsersClient {
|
||||
return UsersClient{NewWithBaseURI(baseURI, tenantID)}
|
||||
}
|
||||
|
||||
// Create create a new user.
|
||||
//
|
||||
// parameters is parameters to create a user.
|
||||
func (client UsersClient) Create(parameters UserCreateParameters) (result User, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AccountEnabled", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.DisplayName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.PasswordProfile", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.PasswordProfile.Password", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{Target: "parameters.UserPrincipalName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.MailNickname", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "Create")
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client UsersClient) CreatePreparer(parameters UserCreateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) CreateResponder(resp *http.Response) (result User, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete delete a user.
|
||||
//
|
||||
// upnOrObjectID is the object ID or principal name of the user to delete.
|
||||
func (client UsersClient) Delete(upnOrObjectID string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(upnOrObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client UsersClient) DeletePreparer(upnOrObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
"upnOrObjectId": autorest.Encode("path", upnOrObjectID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets user information from the directory.
|
||||
//
|
||||
// upnOrObjectID is the object ID or principal name of the user for which to get information.
|
||||
func (client UsersClient) Get(upnOrObjectID string) (result User, err error) {
|
||||
req, err := client.GetPreparer(upnOrObjectID)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client UsersClient) GetPreparer(upnOrObjectID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
"upnOrObjectId": autorest.Encode("path", upnOrObjectID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetMemberGroups gets a collection that contains the object IDs of the groups of which the user is a member.
|
||||
//
|
||||
// objectID is the object ID of the user for which to get group membership. parameters is user filtering parameters.
|
||||
func (client UsersClient) GetMemberGroups(objectID string, parameters UserGetMemberGroupsParameters) (result UserGetMemberGroupsResult, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.SecurityEnabledOnly", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "graphrbac.UsersClient", "GetMemberGroups")
|
||||
}
|
||||
|
||||
req, err := client.GetMemberGroupsPreparer(objectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetMemberGroupsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetMemberGroupsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "GetMemberGroups", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetMemberGroupsPreparer prepares the GetMemberGroups request.
|
||||
func (client UsersClient) GetMemberGroupsPreparer(objectID string, parameters UserGetMemberGroupsParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"objectId": autorest.Encode("path", objectID),
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users/{objectId}/getMemberGroups", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetMemberGroupsSender sends the GetMemberGroups request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) GetMemberGroupsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetMemberGroupsResponder handles the response to the GetMemberGroups request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result UserGetMemberGroupsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List gets list of users for the current tenant.
|
||||
//
|
||||
// filter is the filter to apply to the operation.
|
||||
func (client UsersClient) List(filter string) (result UserListResult, err error) {
|
||||
req, err := client.ListPreparer(filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client UsersClient) ListPreparer(filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) ListResponder(resp *http.Response) (result UserListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete gets all elements from the list without paging.
|
||||
func (client UsersClient) ListComplete(filter string, cancel <-chan struct{}) (<-chan User, <-chan error) {
|
||||
resultChan := make(chan User)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.List(filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.OdataNextLink != nil {
|
||||
list, err = client.ListNext(*list.OdataNextLink)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ListNext gets a list of users for the current tenant.
|
||||
//
|
||||
// nextLink is next link for the list operation.
|
||||
func (client UsersClient) ListNext(nextLink string) (result UserListResult, err error) {
|
||||
req, err := client.ListNextPreparer(nextLink)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListNextSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListNextResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "ListNext", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextPreparer prepares the ListNext request.
|
||||
func (client UsersClient) ListNextPreparer(nextLink string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"nextLink": nextLink,
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/{nextLink}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListNextSender sends the ListNext request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) ListNextSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListNextResponder handles the response to the ListNext request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) ListNextResponder(resp *http.Response) (result UserListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Update updates a user.
|
||||
//
|
||||
// upnOrObjectID is the object ID or principal name of the user to update. parameters is parameters to update an
|
||||
// existing user.
|
||||
func (client UsersClient) Update(upnOrObjectID string, parameters UserUpdateParameters) (result autorest.Response, err error) {
|
||||
req, err := client.UpdatePreparer(upnOrObjectID, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client UsersClient) UpdatePreparer(upnOrObjectID string, parameters UserUpdateParameters) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"tenantID": autorest.Encode("path", client.TenantID),
|
||||
"upnOrObjectId": autorest.Encode("path", upnOrObjectID),
|
||||
}
|
||||
|
||||
const APIVersion = "1.6"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{tenantID}/users/{upnOrObjectId}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client UsersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package graphrbac
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return "Azure-SDK-For-Go/0.0.0 arm-graphrbac/1.6"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "0.0.0"
|
||||
}
|
Загрузка…
Ссылка в новой задаче