github.com/yaegashi/msgraph.go@v0.1.4/beta/ActionInformation.go (about)

     1  // Code generated by msgraph.go/gen DO NOT EDIT.
     2  
     3  package msgraph
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"io/ioutil"
     9  	"net/http"
    10  
    11  	"github.com/yaegashi/msgraph.go/jsonx"
    12  )
    13  
    14  // InformationProtectionLabelCollectionExtractLabelRequestParameter undocumented
    15  type InformationProtectionLabelCollectionExtractLabelRequestParameter struct {
    16  	// ContentInfo undocumented
    17  	ContentInfo *ContentInfo `json:"contentInfo,omitempty"`
    18  }
    19  
    20  // InformationProtectionLabelCollectionEvaluateApplicationRequestParameter undocumented
    21  type InformationProtectionLabelCollectionEvaluateApplicationRequestParameter struct {
    22  	// ContentInfo undocumented
    23  	ContentInfo *ContentInfo `json:"contentInfo,omitempty"`
    24  	// LabelingOptions undocumented
    25  	LabelingOptions *LabelingOptions `json:"labelingOptions,omitempty"`
    26  }
    27  
    28  // InformationProtectionLabelCollectionEvaluateRemovalRequestParameter undocumented
    29  type InformationProtectionLabelCollectionEvaluateRemovalRequestParameter struct {
    30  	// ContentInfo undocumented
    31  	ContentInfo *ContentInfo `json:"contentInfo,omitempty"`
    32  	// DowngradeJustification undocumented
    33  	DowngradeJustification *DowngradeJustification `json:"downgradeJustification,omitempty"`
    34  }
    35  
    36  // InformationProtectionLabelCollectionEvaluateClassificationResultsRequestParameter undocumented
    37  type InformationProtectionLabelCollectionEvaluateClassificationResultsRequestParameter struct {
    38  	// ContentInfo undocumented
    39  	ContentInfo *ContentInfo `json:"contentInfo,omitempty"`
    40  	// ClassificationResults undocumented
    41  	ClassificationResults []ClassificationResult `json:"classificationResults,omitempty"`
    42  }
    43  
    44  // InformationProtectionEvaluateLabelsAndPoliciesRequestParameter undocumented
    45  type InformationProtectionEvaluateLabelsAndPoliciesRequestParameter struct {
    46  	// EvaluateSensitivityLabels undocumented
    47  	EvaluateSensitivityLabels *EvaluateSensitivityLabelsRequestObject `json:"evaluateSensitivityLabels,omitempty"`
    48  	// EvaluateDataLossPreventionPolicies undocumented
    49  	EvaluateDataLossPreventionPolicies *DlpEvaluatePoliciesRequestObject `json:"evaluateDataLossPreventionPolicies,omitempty"`
    50  	// ClassifyText undocumented
    51  	ClassifyText *TextClassificationRequestObject `json:"classifyText,omitempty"`
    52  }
    53  
    54  // DataLossPreventionPolicies returns request builder for DataLossPreventionPolicy collection
    55  func (b *InformationProtectionRequestBuilder) DataLossPreventionPolicies() *InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder {
    56  	bb := &InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
    57  	bb.baseURL += "/dataLossPreventionPolicies"
    58  	return bb
    59  }
    60  
    61  // InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder is request builder for DataLossPreventionPolicy collection
    62  type InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder }
    63  
    64  // Request returns request for DataLossPreventionPolicy collection
    65  func (b *InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder) Request() *InformationProtectionDataLossPreventionPoliciesCollectionRequest {
    66  	return &InformationProtectionDataLossPreventionPoliciesCollectionRequest{
    67  		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
    68  	}
    69  }
    70  
    71  // ID returns request builder for DataLossPreventionPolicy item
    72  func (b *InformationProtectionDataLossPreventionPoliciesCollectionRequestBuilder) ID(id string) *DataLossPreventionPolicyRequestBuilder {
    73  	bb := &DataLossPreventionPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
    74  	bb.baseURL += "/" + id
    75  	return bb
    76  }
    77  
    78  // InformationProtectionDataLossPreventionPoliciesCollectionRequest is request for DataLossPreventionPolicy collection
    79  type InformationProtectionDataLossPreventionPoliciesCollectionRequest struct{ BaseRequest }
    80  
    81  // Paging perfoms paging operation for DataLossPreventionPolicy collection
    82  func (r *InformationProtectionDataLossPreventionPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DataLossPreventionPolicy, error) {
    83  	req, err := r.NewJSONRequest(method, path, obj)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	if ctx != nil {
    88  		req = req.WithContext(ctx)
    89  	}
    90  	res, err := r.client.Do(req)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	var values []DataLossPreventionPolicy
    95  	for {
    96  		if res.StatusCode != http.StatusOK {
    97  			b, _ := ioutil.ReadAll(res.Body)
    98  			res.Body.Close()
    99  			errRes := &ErrorResponse{Response: res}
   100  			err := jsonx.Unmarshal(b, errRes)
   101  			if err != nil {
   102  				return nil, fmt.Errorf("%s: %s", res.Status, string(b))
   103  			}
   104  			return nil, errRes
   105  		}
   106  		var (
   107  			paging Paging
   108  			value  []DataLossPreventionPolicy
   109  		)
   110  		err := jsonx.NewDecoder(res.Body).Decode(&paging)
   111  		res.Body.Close()
   112  		if err != nil {
   113  			return nil, err
   114  		}
   115  		err = jsonx.Unmarshal(paging.Value, &value)
   116  		if err != nil {
   117  			return nil, err
   118  		}
   119  		values = append(values, value...)
   120  		if n >= 0 {
   121  			n--
   122  		}
   123  		if n == 0 || len(paging.NextLink) == 0 {
   124  			return values, nil
   125  		}
   126  		req, err = http.NewRequest("GET", paging.NextLink, nil)
   127  		if ctx != nil {
   128  			req = req.WithContext(ctx)
   129  		}
   130  		res, err = r.client.Do(req)
   131  		if err != nil {
   132  			return nil, err
   133  		}
   134  	}
   135  }
   136  
   137  // GetN performs GET request for DataLossPreventionPolicy collection, max N pages
   138  func (r *InformationProtectionDataLossPreventionPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]DataLossPreventionPolicy, error) {
   139  	var query string
   140  	if r.query != nil {
   141  		query = "?" + r.query.Encode()
   142  	}
   143  	return r.Paging(ctx, "GET", query, nil, n)
   144  }
   145  
   146  // Get performs GET request for DataLossPreventionPolicy collection
   147  func (r *InformationProtectionDataLossPreventionPoliciesCollectionRequest) Get(ctx context.Context) ([]DataLossPreventionPolicy, error) {
   148  	return r.GetN(ctx, 0)
   149  }
   150  
   151  // Add performs POST request for DataLossPreventionPolicy collection
   152  func (r *InformationProtectionDataLossPreventionPoliciesCollectionRequest) Add(ctx context.Context, reqObj *DataLossPreventionPolicy) (resObj *DataLossPreventionPolicy, err error) {
   153  	err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
   154  	return
   155  }
   156  
   157  // Policy is navigation property
   158  func (b *InformationProtectionRequestBuilder) Policy() *InformationProtectionPolicyRequestBuilder {
   159  	bb := &InformationProtectionPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   160  	bb.baseURL += "/policy"
   161  	return bb
   162  }
   163  
   164  // SensitivityLabels returns request builder for SensitivityLabel collection
   165  func (b *InformationProtectionRequestBuilder) SensitivityLabels() *InformationProtectionSensitivityLabelsCollectionRequestBuilder {
   166  	bb := &InformationProtectionSensitivityLabelsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   167  	bb.baseURL += "/sensitivityLabels"
   168  	return bb
   169  }
   170  
   171  // InformationProtectionSensitivityLabelsCollectionRequestBuilder is request builder for SensitivityLabel collection
   172  type InformationProtectionSensitivityLabelsCollectionRequestBuilder struct{ BaseRequestBuilder }
   173  
   174  // Request returns request for SensitivityLabel collection
   175  func (b *InformationProtectionSensitivityLabelsCollectionRequestBuilder) Request() *InformationProtectionSensitivityLabelsCollectionRequest {
   176  	return &InformationProtectionSensitivityLabelsCollectionRequest{
   177  		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
   178  	}
   179  }
   180  
   181  // ID returns request builder for SensitivityLabel item
   182  func (b *InformationProtectionSensitivityLabelsCollectionRequestBuilder) ID(id string) *SensitivityLabelRequestBuilder {
   183  	bb := &SensitivityLabelRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   184  	bb.baseURL += "/" + id
   185  	return bb
   186  }
   187  
   188  // InformationProtectionSensitivityLabelsCollectionRequest is request for SensitivityLabel collection
   189  type InformationProtectionSensitivityLabelsCollectionRequest struct{ BaseRequest }
   190  
   191  // Paging perfoms paging operation for SensitivityLabel collection
   192  func (r *InformationProtectionSensitivityLabelsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]SensitivityLabel, error) {
   193  	req, err := r.NewJSONRequest(method, path, obj)
   194  	if err != nil {
   195  		return nil, err
   196  	}
   197  	if ctx != nil {
   198  		req = req.WithContext(ctx)
   199  	}
   200  	res, err := r.client.Do(req)
   201  	if err != nil {
   202  		return nil, err
   203  	}
   204  	var values []SensitivityLabel
   205  	for {
   206  		if res.StatusCode != http.StatusOK {
   207  			b, _ := ioutil.ReadAll(res.Body)
   208  			res.Body.Close()
   209  			errRes := &ErrorResponse{Response: res}
   210  			err := jsonx.Unmarshal(b, errRes)
   211  			if err != nil {
   212  				return nil, fmt.Errorf("%s: %s", res.Status, string(b))
   213  			}
   214  			return nil, errRes
   215  		}
   216  		var (
   217  			paging Paging
   218  			value  []SensitivityLabel
   219  		)
   220  		err := jsonx.NewDecoder(res.Body).Decode(&paging)
   221  		res.Body.Close()
   222  		if err != nil {
   223  			return nil, err
   224  		}
   225  		err = jsonx.Unmarshal(paging.Value, &value)
   226  		if err != nil {
   227  			return nil, err
   228  		}
   229  		values = append(values, value...)
   230  		if n >= 0 {
   231  			n--
   232  		}
   233  		if n == 0 || len(paging.NextLink) == 0 {
   234  			return values, nil
   235  		}
   236  		req, err = http.NewRequest("GET", paging.NextLink, nil)
   237  		if ctx != nil {
   238  			req = req.WithContext(ctx)
   239  		}
   240  		res, err = r.client.Do(req)
   241  		if err != nil {
   242  			return nil, err
   243  		}
   244  	}
   245  }
   246  
   247  // GetN performs GET request for SensitivityLabel collection, max N pages
   248  func (r *InformationProtectionSensitivityLabelsCollectionRequest) GetN(ctx context.Context, n int) ([]SensitivityLabel, error) {
   249  	var query string
   250  	if r.query != nil {
   251  		query = "?" + r.query.Encode()
   252  	}
   253  	return r.Paging(ctx, "GET", query, nil, n)
   254  }
   255  
   256  // Get performs GET request for SensitivityLabel collection
   257  func (r *InformationProtectionSensitivityLabelsCollectionRequest) Get(ctx context.Context) ([]SensitivityLabel, error) {
   258  	return r.GetN(ctx, 0)
   259  }
   260  
   261  // Add performs POST request for SensitivityLabel collection
   262  func (r *InformationProtectionSensitivityLabelsCollectionRequest) Add(ctx context.Context, reqObj *SensitivityLabel) (resObj *SensitivityLabel, err error) {
   263  	err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
   264  	return
   265  }
   266  
   267  // SensitivityPolicySettings is navigation property
   268  func (b *InformationProtectionRequestBuilder) SensitivityPolicySettings() *SensitivityPolicySettingsRequestBuilder {
   269  	bb := &SensitivityPolicySettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   270  	bb.baseURL += "/sensitivityPolicySettings"
   271  	return bb
   272  }
   273  
   274  // ThreatAssessmentRequests returns request builder for ThreatAssessmentRequestObject collection
   275  func (b *InformationProtectionRequestBuilder) ThreatAssessmentRequests() *InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder {
   276  	bb := &InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   277  	bb.baseURL += "/threatAssessmentRequests"
   278  	return bb
   279  }
   280  
   281  // InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder is request builder for ThreatAssessmentRequestObject collection
   282  type InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder struct{ BaseRequestBuilder }
   283  
   284  // Request returns request for ThreatAssessmentRequestObject collection
   285  func (b *InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder) Request() *InformationProtectionThreatAssessmentRequestsCollectionRequest {
   286  	return &InformationProtectionThreatAssessmentRequestsCollectionRequest{
   287  		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
   288  	}
   289  }
   290  
   291  // ID returns request builder for ThreatAssessmentRequestObject item
   292  func (b *InformationProtectionThreatAssessmentRequestsCollectionRequestBuilder) ID(id string) *ThreatAssessmentRequestObjectRequestBuilder {
   293  	bb := &ThreatAssessmentRequestObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   294  	bb.baseURL += "/" + id
   295  	return bb
   296  }
   297  
   298  // InformationProtectionThreatAssessmentRequestsCollectionRequest is request for ThreatAssessmentRequestObject collection
   299  type InformationProtectionThreatAssessmentRequestsCollectionRequest struct{ BaseRequest }
   300  
   301  // Paging perfoms paging operation for ThreatAssessmentRequestObject collection
   302  func (r *InformationProtectionThreatAssessmentRequestsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ThreatAssessmentRequestObject, error) {
   303  	req, err := r.NewJSONRequest(method, path, obj)
   304  	if err != nil {
   305  		return nil, err
   306  	}
   307  	if ctx != nil {
   308  		req = req.WithContext(ctx)
   309  	}
   310  	res, err := r.client.Do(req)
   311  	if err != nil {
   312  		return nil, err
   313  	}
   314  	var values []ThreatAssessmentRequestObject
   315  	for {
   316  		if res.StatusCode != http.StatusOK {
   317  			b, _ := ioutil.ReadAll(res.Body)
   318  			res.Body.Close()
   319  			errRes := &ErrorResponse{Response: res}
   320  			err := jsonx.Unmarshal(b, errRes)
   321  			if err != nil {
   322  				return nil, fmt.Errorf("%s: %s", res.Status, string(b))
   323  			}
   324  			return nil, errRes
   325  		}
   326  		var (
   327  			paging Paging
   328  			value  []ThreatAssessmentRequestObject
   329  		)
   330  		err := jsonx.NewDecoder(res.Body).Decode(&paging)
   331  		res.Body.Close()
   332  		if err != nil {
   333  			return nil, err
   334  		}
   335  		err = jsonx.Unmarshal(paging.Value, &value)
   336  		if err != nil {
   337  			return nil, err
   338  		}
   339  		values = append(values, value...)
   340  		if n >= 0 {
   341  			n--
   342  		}
   343  		if n == 0 || len(paging.NextLink) == 0 {
   344  			return values, nil
   345  		}
   346  		req, err = http.NewRequest("GET", paging.NextLink, nil)
   347  		if ctx != nil {
   348  			req = req.WithContext(ctx)
   349  		}
   350  		res, err = r.client.Do(req)
   351  		if err != nil {
   352  			return nil, err
   353  		}
   354  	}
   355  }
   356  
   357  // GetN performs GET request for ThreatAssessmentRequestObject collection, max N pages
   358  func (r *InformationProtectionThreatAssessmentRequestsCollectionRequest) GetN(ctx context.Context, n int) ([]ThreatAssessmentRequestObject, error) {
   359  	var query string
   360  	if r.query != nil {
   361  		query = "?" + r.query.Encode()
   362  	}
   363  	return r.Paging(ctx, "GET", query, nil, n)
   364  }
   365  
   366  // Get performs GET request for ThreatAssessmentRequestObject collection
   367  func (r *InformationProtectionThreatAssessmentRequestsCollectionRequest) Get(ctx context.Context) ([]ThreatAssessmentRequestObject, error) {
   368  	return r.GetN(ctx, 0)
   369  }
   370  
   371  // Add performs POST request for ThreatAssessmentRequestObject collection
   372  func (r *InformationProtectionThreatAssessmentRequestsCollectionRequest) Add(ctx context.Context, reqObj *ThreatAssessmentRequestObject) (resObj *ThreatAssessmentRequestObject, err error) {
   373  	err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
   374  	return
   375  }
   376  
   377  // Labels returns request builder for InformationProtectionLabel collection
   378  func (b *InformationProtectionPolicyRequestBuilder) Labels() *InformationProtectionPolicyLabelsCollectionRequestBuilder {
   379  	bb := &InformationProtectionPolicyLabelsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   380  	bb.baseURL += "/labels"
   381  	return bb
   382  }
   383  
   384  // InformationProtectionPolicyLabelsCollectionRequestBuilder is request builder for InformationProtectionLabel collection
   385  type InformationProtectionPolicyLabelsCollectionRequestBuilder struct{ BaseRequestBuilder }
   386  
   387  // Request returns request for InformationProtectionLabel collection
   388  func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) Request() *InformationProtectionPolicyLabelsCollectionRequest {
   389  	return &InformationProtectionPolicyLabelsCollectionRequest{
   390  		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
   391  	}
   392  }
   393  
   394  // ID returns request builder for InformationProtectionLabel item
   395  func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) ID(id string) *InformationProtectionLabelRequestBuilder {
   396  	bb := &InformationProtectionLabelRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
   397  	bb.baseURL += "/" + id
   398  	return bb
   399  }
   400  
   401  // InformationProtectionPolicyLabelsCollectionRequest is request for InformationProtectionLabel collection
   402  type InformationProtectionPolicyLabelsCollectionRequest struct{ BaseRequest }
   403  
   404  // Paging perfoms paging operation for InformationProtectionLabel collection
   405  func (r *InformationProtectionPolicyLabelsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]InformationProtectionLabel, error) {
   406  	req, err := r.NewJSONRequest(method, path, obj)
   407  	if err != nil {
   408  		return nil, err
   409  	}
   410  	if ctx != nil {
   411  		req = req.WithContext(ctx)
   412  	}
   413  	res, err := r.client.Do(req)
   414  	if err != nil {
   415  		return nil, err
   416  	}
   417  	var values []InformationProtectionLabel
   418  	for {
   419  		if res.StatusCode != http.StatusOK {
   420  			b, _ := ioutil.ReadAll(res.Body)
   421  			res.Body.Close()
   422  			errRes := &ErrorResponse{Response: res}
   423  			err := jsonx.Unmarshal(b, errRes)
   424  			if err != nil {
   425  				return nil, fmt.Errorf("%s: %s", res.Status, string(b))
   426  			}
   427  			return nil, errRes
   428  		}
   429  		var (
   430  			paging Paging
   431  			value  []InformationProtectionLabel
   432  		)
   433  		err := jsonx.NewDecoder(res.Body).Decode(&paging)
   434  		res.Body.Close()
   435  		if err != nil {
   436  			return nil, err
   437  		}
   438  		err = jsonx.Unmarshal(paging.Value, &value)
   439  		if err != nil {
   440  			return nil, err
   441  		}
   442  		values = append(values, value...)
   443  		if n >= 0 {
   444  			n--
   445  		}
   446  		if n == 0 || len(paging.NextLink) == 0 {
   447  			return values, nil
   448  		}
   449  		req, err = http.NewRequest("GET", paging.NextLink, nil)
   450  		if ctx != nil {
   451  			req = req.WithContext(ctx)
   452  		}
   453  		res, err = r.client.Do(req)
   454  		if err != nil {
   455  			return nil, err
   456  		}
   457  	}
   458  }
   459  
   460  // GetN performs GET request for InformationProtectionLabel collection, max N pages
   461  func (r *InformationProtectionPolicyLabelsCollectionRequest) GetN(ctx context.Context, n int) ([]InformationProtectionLabel, error) {
   462  	var query string
   463  	if r.query != nil {
   464  		query = "?" + r.query.Encode()
   465  	}
   466  	return r.Paging(ctx, "GET", query, nil, n)
   467  }
   468  
   469  // Get performs GET request for InformationProtectionLabel collection
   470  func (r *InformationProtectionPolicyLabelsCollectionRequest) Get(ctx context.Context) ([]InformationProtectionLabel, error) {
   471  	return r.GetN(ctx, 0)
   472  }
   473  
   474  // Add performs POST request for InformationProtectionLabel collection
   475  func (r *InformationProtectionPolicyLabelsCollectionRequest) Add(ctx context.Context, reqObj *InformationProtectionLabel) (resObj *InformationProtectionLabel, err error) {
   476  	err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
   477  	return
   478  }