Skip to content

Commit

Permalink
Merge pull request #167 from JoostvDoorn/synchronizationJob-rule
Browse files Browse the repository at this point in the history
Add Synchronization client
  • Loading branch information
manicminer authored Aug 25, 2022
2 parents 82c4c5a + 064d17c commit eeafeed
Show file tree
Hide file tree
Showing 6 changed files with 603 additions and 3 deletions.
6 changes: 6 additions & 0 deletions internal/test/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type Test struct {
ServicePrincipalsAppRoleAssignmentsClient *msgraph.AppRoleAssignmentsClient
ServicePrincipalsClient *msgraph.ServicePrincipalsClient
SignInReportsClient *msgraph.SignInReportsClient
SynchronizationJobClient *msgraph.SynchronizationJobClient
UsersAppRoleAssignmentsClient *msgraph.AppRoleAssignmentsClient
UsersClient *msgraph.UsersClient
}
Expand Down Expand Up @@ -319,6 +320,11 @@ func NewTest(t *testing.T) (c *Test) {
c.SignInReportsClient.BaseClient.Endpoint = c.Connection.AuthConfig.Environment.MsGraph.Endpoint
c.SignInReportsClient.BaseClient.RetryableClient.RetryMax = retry

c.SynchronizationJobClient = msgraph.NewSynchronizationJobClient(c.Connection.AuthConfig.TenantID)
c.SynchronizationJobClient.BaseClient.Authorizer = c.Connection.Authorizer
c.SynchronizationJobClient.BaseClient.Endpoint = c.Connection.AuthConfig.Environment.MsGraph.Endpoint
c.SynchronizationJobClient.BaseClient.RetryableClient.RetryMax = retry

c.UsersAppRoleAssignmentsClient = msgraph.NewUsersAppRoleAssignmentsClient(c.Connection.AuthConfig.TenantID)
c.UsersAppRoleAssignmentsClient.BaseClient.Authorizer = c.Connection.Authorizer
c.UsersAppRoleAssignmentsClient.BaseClient.Endpoint = c.Connection.AuthConfig.Environment.MsGraph.Endpoint
Expand Down
91 changes: 91 additions & 0 deletions msgraph/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,97 @@ func (s *ServicePrincipal) UnmarshalJSON(data []byte) error {
return nil
}

type SynchronizationSchedule struct {
Expiration *time.Time `json:"expiration,omitempty"`
Interval *string `json:"interval,omitempty"`
State *string `json:"state,omitempty"`
}

type SynchronizationTaskExecution struct {
ActivityIdentifier *string `json:"activityIdentifier,omitempty"`
CountEntitled *string `json:"countEntitled,omitempty"`
State *string `json:"state,omitempty"`
}

type SynchronizationProgress struct {
CompletedUnits *int32 `json:"completedUnits,omitempty"`
ProgressObservationDateTime *time.Time `json:"progressObservationDateTime,omitempty"`
TotalUnits *int32 `json:"totalUnits,omitempty"`
Units *string `json:"units,omitempty"`
}

type SynchronizationQuarantine struct {
CurrentBegan *time.Time `json:"currentBegan,omitempty"`
NextAttempt *time.Time `json:"nextAttempt,omitempty"`
Reason *string `json:"reason,omitempty"`
SeriesBegan *time.Time `json:"seriesBegan,omitempty"`
SeriesCount *int64 `json:"seriesCount,omitempty"`
}

type StringKeyLongValuePair struct {
Key *string `json:"key,omitempty"`
Value *int64 `json:"value,omitempty"`
}

type SynchronizationStatus struct {
Code *string `json:"code,omitempty"`
CountSuccssiveCompleteFailure *int64 `json:"countSuccessiveCompleteFailures,omitempty"`
EscrowsPruned *bool `json:"escrowsPruned,omitempty"`
LastExecution *SynchronizationTaskExecution `json:"lastExecution,omitempty"`
LastSuccessfulExecution *SynchronizationTaskExecution `json:"lastSuccessfulExecution,omitempty"`
LastSuccessfulExecutionWithExports *SynchronizationTaskExecution `json:"lastSuccessfulExecutionWithExports,omitempty"`
Progress *[]SynchronizationProgress `json:"progress,omitempty"`
Quarantine *SynchronizationQuarantine `json:"quarantine,omitempty"`
SteadyStateFirstAchievedTime *time.Time `json:"steadyStateFirstAchievedTime,omitempty"`
SteadyStateLastAchievedTime *time.Time `json:"steadyStateLastAchievedTime,omitempty"`
SynchronizedEntryCountByType *[]StringKeyLongValuePair `json:"synchronizedEntryCountByType,omitempty"`
}

type SynchronizationJobRestartCriteria struct {
ResetScope *string `json:"resetScope,omitempty"`
}

type SynchronizationJobKeyValue struct {
Name *string `json:"name,omitempty"`
Value *string `json:"value,omitempty"`
}

type SynchronizationSecretKeyStringValuePair struct {
Key *string `json:"key,omitempty"`
Value *string `json:"value,omitempty"`
}

type SynchronizationJobSubject struct {
ObjectId *string `json:"objectId,omitempty"`
ObjectTypeName *string `json:"objectTypeName,omitempty"`
}

type SynchronizationJobApplicationParameters struct {
RuleId *string `json:"ruleId,omitempty"`
Subjects *[]SynchronizationJobSubject `json:"subjects,omitempty"`
}

type SynchronizationJobProvisionOnDemand struct {
Parameters *[]SynchronizationJobApplicationParameters `json:"parameters,omitempty"`
}

type SynchronizationJobValidateCredentials struct {
UseSavedCredentials *bool `json:"useSavedCredentials,omitempty"`
Credentials *[]SynchronizationSecretKeyStringValuePair `json:"credentials,omitempty"`
}

type SynchronizationSecret struct {
Credentials *[]SynchronizationSecretKeyStringValuePair `json:"value,omitempty"`
}

type SynchronizationJob struct {
ID *string `json:"id,omitempty"`
Schedule *SynchronizationSchedule `json:"schedule,omitempty"`
Status *SynchronizationStatus `json:"status,omitempty"`
SynchronizationJobSettings *[]SynchronizationJobKeyValue `json:"synchronizationJobSettings,omitempty"`
TemplateId *string `json:"templateId,omitempty"`
}

type SignInActivity struct {
LastSignInDateTime *time.Time `json:"lastSignInDateTime,omitempty"`
LastSignInRequestId *string `json:"lastSignInRequestId,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions msgraph/serviceprincipals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func testServicePrincipalsClient_RemoveOwners(t *testing.T, c *test.Test, spId s
}
}

func testServicePrincipalsClient_AssignClaimsMappingPolicy(t *testing.T, c *test.Test, sp *msgraph.ServicePrincipal){
func testServicePrincipalsClient_AssignClaimsMappingPolicy(t *testing.T, c *test.Test, sp *msgraph.ServicePrincipal) {
status, err := c.ServicePrincipalsClient.AssignClaimsMappingPolicy(c.Context, sp)
if err != nil {
t.Fatalf("ServicePrincipalsClient.AssignClaimsMappingPolicy(): %v", err)
Expand All @@ -411,7 +411,7 @@ func testServicePrincipalsClient_AssignClaimsMappingPolicy(t *testing.T, c *test
}
}

func testServicePrincipalsClient_RemoveClaimsMappingPolicy(t *testing.T, c *test.Test, sp *msgraph.ServicePrincipal, policyIds []string){
func testServicePrincipalsClient_RemoveClaimsMappingPolicy(t *testing.T, c *test.Test, sp *msgraph.ServicePrincipal, policyIds []string) {
status, err := c.ServicePrincipalsClient.RemoveClaimsMappingPolicy(c.Context, sp, &policyIds)
if err != nil {
t.Fatalf("ServicePrincipalsClient.RemoveClaimsMappingPolicy(): %v", err)
Expand Down
Loading

0 comments on commit eeafeed

Please sign in to comment.