Skip to content

Commit 00513ed

Browse files
authored
fix: restore Policy as request body for createPolicy/replacePolicy (#883)
1 parent 15e2cb1 commit 00513ed

6 files changed

Lines changed: 38 additions & 38 deletions

File tree

docs/PolicyApi.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Name | Type | Description | Notes
267267

268268
<a name="createpolicy"></a>
269269
# **CreatePolicy**
270-
> Policy CreatePolicy (CreateOrUpdatePolicy policy, bool? activate = null)
270+
> Policy CreatePolicy (Policy policy, bool? activate = null)
271271
272272
Create a policy
273273

@@ -295,7 +295,7 @@ namespace Example
295295
config.AccessToken = "YOUR_ACCESS_TOKEN";
296296

297297
var apiInstance = new PolicyApi(config);
298-
var policy = new CreateOrUpdatePolicy(); // CreateOrUpdatePolicy |
298+
var policy = new Policy(); // Policy |
299299
var activate = true; // bool? | This query parameter is only valid for Classic Engine orgs. (optional) (default to true)
300300
301301
try
@@ -319,7 +319,7 @@ namespace Example
319319

320320
Name | Type | Description | Notes
321321
------------- | ------------- | ------------- | -------------
322-
**policy** | [**CreateOrUpdatePolicy**](CreateOrUpdatePolicy.md)| |
322+
**policy** | [**Policy**](Policy.md)| |
323323
**activate** | **bool?**| This query parameter is only valid for Classic Engine orgs. | [optional] [default to true]
324324

325325
### Return type
@@ -1567,7 +1567,7 @@ Name | Type | Description | Notes
15671567

15681568
<a name="replacepolicy"></a>
15691569
# **ReplacePolicy**
1570-
> Policy ReplacePolicy (string policyId, CreateOrUpdatePolicy policy)
1570+
> Policy ReplacePolicy (string policyId, Policy policy)
15711571
15721572
Replace a policy
15731573

@@ -1596,7 +1596,7 @@ namespace Example
15961596

15971597
var apiInstance = new PolicyApi(config);
15981598
var policyId = 00plrilJ7jZ66Gn0X0g3; // string | `id` of the Policy
1599-
var policy = new CreateOrUpdatePolicy(); // CreateOrUpdatePolicy |
1599+
var policy = new Policy(); // Policy |
16001600
16011601
try
16021602
{
@@ -1620,7 +1620,7 @@ namespace Example
16201620
Name | Type | Description | Notes
16211621
------------- | ------------- | ------------- | -------------
16221622
**policyId** | **string**| &#x60;id&#x60; of the Policy |
1623-
**policy** | [**CreateOrUpdatePolicy**](CreateOrUpdatePolicy.md)| |
1623+
**policy** | [**Policy**](Policy.md)| |
16241624

16251625
### Return type
16261626

openapi3/management.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19589,7 +19589,7 @@ paths:
1958919589
content:
1959019590
application/json:
1959119591
schema:
19592-
$ref: '#/components/schemas/CreateOrUpdatePolicy'
19592+
$ref: '#/components/schemas/Policy'
1959319593
required: true
1959419594
responses:
1959519595
'200':
@@ -19743,7 +19743,7 @@ paths:
1974319743
content:
1974419744
application/json:
1974519745
schema:
19746-
$ref: '#/components/schemas/CreateOrUpdatePolicy'
19746+
$ref: '#/components/schemas/Policy'
1974719747
required: true
1974819748
responses:
1974919749
'200':

src/Okta.Sdk.IntegrationTest/ApplicationPoliciesApiTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public async Task InitializeAsync()
6666
_testAppId = createdApp.Id;
6767

6868
// Create a test authentication policy
69-
var testPolicy = new CreateOrUpdatePolicy
69+
var testPolicy = new Policy
7070
{
7171
Type = PolicyType.ACCESSPOLICY,
7272
Status = LifecycleStatus.ACTIVE,
@@ -146,7 +146,7 @@ public async Task GivenApplicationAndPolicy_WhenAssigningWithHttpInfo_ThenHttpRe
146146
public async Task GivenExistingPolicy_WhenAssigningNewPolicy_ThenExistingPolicyIsReplaced()
147147
{
148148
// Arrange - Create second policy
149-
var secondPolicy = new CreateOrUpdatePolicy
149+
var secondPolicy = new Policy
150150
{
151151
Type = PolicyType.ACCESSPOLICY,
152152
Status = LifecycleStatus.ACTIVE,

src/Okta.Sdk.IntegrationTest/PolicyApiTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task GivenPolicyApi_WhenPerformingAllOperations_ThenAllEndpointsAnd
4141
#region Create Policy - POST /api/v1/policies
4242

4343
// Test CreatePolicyAsync()
44-
var policy = new CreateOrUpdatePolicy()
44+
var policy = new Policy()
4545
{
4646
Name = $"SDK-Test-Policy-{guid}".Substring(0, 50),
4747
Type = PolicyType.OKTASIGNON,
@@ -123,7 +123,7 @@ public async Task GivenPolicyApi_WhenPerformingAllOperations_ThenAllEndpointsAnd
123123
#region Replace Policy - PUT /api/v1/policies/{policyId}
124124

125125
// Test ReplacePolicyAsync()
126-
var updatedPolicyData = new CreateOrUpdatePolicy()
126+
var updatedPolicyData = new Policy()
127127
{
128128
Name = $"SDK-Test-Policy-Updated-{guid}".Substring(0, 50),
129129
Description = "Updated description for comprehensive test",
@@ -416,7 +416,7 @@ public async Task GivenPolicyApi_WhenPerformingAllOperations_ThenAllEndpointsAnd
416416

417417
#region Test Password Policy
418418

419-
var passwordPolicy = new CreateOrUpdatePolicy()
419+
var passwordPolicy = new Policy()
420420
{
421421
Name = $"SDK-Test-PasswordPolicy-{guid}".Substring(0, 50),
422422
Type = PolicyType.PASSWORD,
@@ -435,7 +435,7 @@ public async Task GivenPolicyApi_WhenPerformingAllOperations_ThenAllEndpointsAnd
435435

436436
#region Test Profile Enrollment Policy
437437

438-
var profilePolicy = new CreateOrUpdatePolicy()
438+
var profilePolicy = new Policy()
439439
{
440440
Name = $"SDK-Test-ProfilePolicy-{guid}".Substring(0, 50),
441441
Type = PolicyType.PROFILEENROLLMENT,
@@ -756,7 +756,7 @@ public async Task GivenQueryParameters_WhenListingPolicies_ThenFilteringWorksCor
756756
try
757757
{
758758
// Create a test policy with a unique name for searching
759-
var policy = new CreateOrUpdatePolicy()
759+
var policy = new Policy()
760760
{
761761
Name = $"SDK-QueryTest-{guid}".Substring(0, 50),
762762
Type = PolicyType.OKTASIGNON,
@@ -839,7 +839,7 @@ public async Task GivenPasswordPolicyWithRules_WhenManagingPolicy_ThenAllScenari
839839
try
840840
{
841841
// Create password policy
842-
var policy = new CreateOrUpdatePolicy()
842+
var policy = new Policy()
843843
{
844844
Name = $"SDK-PasswordPolicy-{guid}".Substring(0, 50),
845845
Type = PolicyType.PASSWORD,
@@ -1006,7 +1006,7 @@ public async Task GivenPolicyRules_WhenManaging_ThenPriorityOrderIsMaintained()
10061006
try
10071007
{
10081008
// Create a test policy
1009-
var policy = new CreateOrUpdatePolicy()
1009+
var policy = new Policy()
10101010
{
10111011
Name = $"SDK-PriorityTest-{guid}".Substring(0, 50),
10121012
Type = PolicyType.OKTASIGNON,
@@ -1120,7 +1120,7 @@ public async Task GivenNetworkConditions_WhenConfiguringPolicyRule_ThenRuleIsCon
11201120
try
11211121
{
11221122
// Create test policy
1123-
var policy = new CreateOrUpdatePolicy()
1123+
var policy = new Policy()
11241124
{
11251125
Name = $"SDK-NetworkTest-{guid}".Substring(0, 50),
11261126
Type = PolicyType.OKTASIGNON,
@@ -1205,7 +1205,7 @@ public async Task GivenSessionSettings_WhenConfiguringSignOnPolicyRule_ThenRuleI
12051205
try
12061206
{
12071207
// Create test policy
1208-
var policy = new CreateOrUpdatePolicy()
1208+
var policy = new Policy()
12091209
{
12101210
Name = $"SDK-SessionTest-{guid}".Substring(0, 50),
12111211
Type = PolicyType.OKTASIGNON,
@@ -1351,7 +1351,7 @@ await _policyApi.DeletePolicyRuleAsync(invalidPolicyId, invalidRuleId)
13511351
try
13521352
{
13531353
// Create a valid policy for testing invalid operations
1354-
var policy = new CreateOrUpdatePolicy()
1354+
var policy = new Policy()
13551355
{
13561356
Name = $"SDK-ErrorTest-{guid}".Substring(0, 50),
13571357
Type = PolicyType.OKTASIGNON,
@@ -1399,7 +1399,7 @@ public async Task GivenBoundaryNameLength_WhenCreatingPolicy_ThenPolicyIsHandled
13991399
{
14001400
// Test 49 characters (should work)
14011401
var name49 = new string('A', 49);
1402-
var policy1 = new CreateOrUpdatePolicy()
1402+
var policy1 = new Policy()
14031403
{
14041404
Name = name49,
14051405
Type = PolicyType.OKTASIGNON,
@@ -1414,7 +1414,7 @@ public async Task GivenBoundaryNameLength_WhenCreatingPolicy_ThenPolicyIsHandled
14141414

14151415
// Test exactly 50 characters (should work)
14161416
var name50 = new string('B', 50);
1417-
var policy2 = new CreateOrUpdatePolicy()
1417+
var policy2 = new Policy()
14181418
{
14191419
Name = name50,
14201420
Type = PolicyType.OKTASIGNON,
@@ -1429,7 +1429,7 @@ public async Task GivenBoundaryNameLength_WhenCreatingPolicy_ThenPolicyIsHandled
14291429

14301430
// Test 51 characters (API doesn't enforce a strict 50-char limit, it accepts 51+)
14311431
var name51 = new string('C', 51);
1432-
var policy3 = new CreateOrUpdatePolicy()
1432+
var policy3 = new Policy()
14331433
{
14341434
Name = name51,
14351435
Type = PolicyType.OKTASIGNON,
@@ -1483,7 +1483,7 @@ public async Task GivenValidScenario_WhenCreatingPolicySimulation_ThenResultsAre
14831483
try
14841484
{
14851485
// Create a test policy for simulation
1486-
var policy = new CreateOrUpdatePolicy()
1486+
var policy = new Policy()
14871487
{
14881488
Name = $"SDK-Test-Simulation-Policy-{guid}".Substring(0, 50),
14891489
Type = PolicyType.OKTASIGNON,
@@ -1617,7 +1617,7 @@ public async Task GivenHttpInfoMethods_WhenCallingApi_ThenApiResponseWithDetails
16171617
try
16181618
{
16191619
// CreatePolicyWithHttpInfo
1620-
var policy = new CreateOrUpdatePolicy()
1620+
var policy = new Policy()
16211621
{
16221622
Name = $"SDK-HttpInfo-Test-{guid}".Substring(0, 50),
16231623
Type = PolicyType.OKTASIGNON,
@@ -1654,7 +1654,7 @@ public async Task GivenHttpInfoMethods_WhenCallingApi_ThenApiResponseWithDetails
16541654
listResponse.Data.Should().Contain(p => p.Id == policy1.Id);
16551655

16561656
// ReplacePolicyWithHttpInfo
1657-
var updatePolicy = new CreateOrUpdatePolicy()
1657+
var updatePolicy = new Policy()
16581658
{
16591659
Name = createdPolicy.Name,
16601660
Type = PolicyType.OKTASIGNON,

src/Okta.Sdk.UnitTest/Api/PolicyApiTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task CreatePolicy_WithValidData_ReturnsPolicy()
5757
var mockClient = new MockAsyncClient(responseJson);
5858
var policyApi = new PolicyApi(mockClient, new Configuration { BasePath = BaseUrl });
5959

60-
var policy = new CreateOrUpdatePolicy
60+
var policy = new OktaSignOnPolicy
6161
{
6262
Name = policyName,
6363
Type = PolicyType.OKTASIGNON,
@@ -96,7 +96,7 @@ public async Task CreatePolicyWithHttpInfo_ReturnsApiResponse()
9696
var mockClient = new MockAsyncClient(responseJson);
9797
var policyApi = new PolicyApi(mockClient, new Configuration { BasePath = BaseUrl });
9898

99-
var policy = new CreateOrUpdatePolicy
99+
var policy = new PasswordPolicy
100100
{
101101
Name = "Password Policy",
102102
Type = PolicyType.PASSWORD
@@ -274,7 +274,7 @@ public async Task ReplacePolicy_WithValidData_ReturnsUpdatedPolicy()
274274
var mockClient = new MockAsyncClient(responseJson);
275275
var policyApi = new PolicyApi(mockClient, new Configuration { BasePath = BaseUrl });
276276

277-
var policy = new CreateOrUpdatePolicy
277+
var policy = new OktaSignOnPolicy
278278
{
279279
Name = updatedName,
280280
Type = PolicyType.OKTASIGNON,
@@ -308,7 +308,7 @@ public async Task ReplacePolicyWithHttpInfo_ReturnsApiResponse()
308308
var mockClient = new MockAsyncClient(responseJson);
309309
var policyApi = new PolicyApi(mockClient, new Configuration { BasePath = BaseUrl });
310310

311-
var policy = new CreateOrUpdatePolicy { Name = "Replaced Policy", Type = PolicyType.PASSWORD };
311+
var policy = new PasswordPolicy { Name = "Replaced Policy", Type = PolicyType.PASSWORD };
312312

313313
// Act
314314
var response = await policyApi.ReplacePolicyWithHttpInfoAsync(_policyId, policy);

src/Okta.Sdk/Api/PolicyApi.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public partial interface IPolicyApiAsync : IApiAccessor
112112
/// <param name="activate">This query parameter is only valid for Classic Engine orgs. (optional, default to true)</param>
113113
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
114114
/// <returns>Task of Policy</returns>
115-
System.Threading.Tasks.Task<Policy> CreatePolicyAsync( CreateOrUpdatePolicy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
115+
System.Threading.Tasks.Task<Policy> CreatePolicyAsync( Policy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
116116
/// <summary>
117117
/// Create a policy
118118
/// </summary>
@@ -124,7 +124,7 @@ public partial interface IPolicyApiAsync : IApiAccessor
124124
/// <param name="activate">This query parameter is only valid for Classic Engine orgs. (optional, default to true)</param>
125125
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
126126
/// <returns>Task of ApiResponse (Policy)</returns>
127-
System.Threading.Tasks.Task<ApiResponse<Policy>> CreatePolicyWithHttpInfoAsync( CreateOrUpdatePolicy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
127+
System.Threading.Tasks.Task<ApiResponse<Policy>> CreatePolicyWithHttpInfoAsync( Policy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
128128
/// <summary>
129129
/// Create a policy rule
130130
/// </summary>
@@ -506,7 +506,7 @@ public partial interface IPolicyApiAsync : IApiAccessor
506506
/// <param name="policy"></param>
507507
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
508508
/// <returns>Task of Policy</returns>
509-
System.Threading.Tasks.Task<Policy> ReplacePolicyAsync( string policyId , CreateOrUpdatePolicy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
509+
System.Threading.Tasks.Task<Policy> ReplacePolicyAsync( string policyId , Policy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
510510
/// <summary>
511511
/// Replace a policy
512512
/// </summary>
@@ -518,7 +518,7 @@ public partial interface IPolicyApiAsync : IApiAccessor
518518
/// <param name="policy"></param>
519519
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
520520
/// <returns>Task of ApiResponse (Policy)</returns>
521-
System.Threading.Tasks.Task<ApiResponse<Policy>> ReplacePolicyWithHttpInfoAsync( string policyId , CreateOrUpdatePolicy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
521+
System.Threading.Tasks.Task<ApiResponse<Policy>> ReplacePolicyWithHttpInfoAsync( string policyId , Policy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
522522
/// <summary>
523523
/// Replace a policy rule
524524
/// </summary>
@@ -927,7 +927,7 @@ public Okta.Sdk.Client.ExceptionFactory ExceptionFactory
927927
/// <param name="activate">This query parameter is only valid for Classic Engine orgs. (optional, default to true)</param>
928928
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
929929
/// <returns>Task of Policy</returns>
930-
public async System.Threading.Tasks.Task<Policy> CreatePolicyAsync( CreateOrUpdatePolicy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
930+
public async System.Threading.Tasks.Task<Policy> CreatePolicyAsync( Policy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
931931
{
932932
Okta.Sdk.Client.ApiResponse<Policy> localVarResponse = await CreatePolicyWithHttpInfoAsync(policy, activate, cancellationToken).ConfigureAwait(false);
933933
return localVarResponse.Data;
@@ -940,7 +940,7 @@ public Okta.Sdk.Client.ExceptionFactory ExceptionFactory
940940
/// <param name="activate">This query parameter is only valid for Classic Engine orgs. (optional, default to true)</param>
941941
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
942942
/// <returns>Task of ApiResponse (Policy)</returns>
943-
public async System.Threading.Tasks.Task<Okta.Sdk.Client.ApiResponse<Policy>> CreatePolicyWithHttpInfoAsync( CreateOrUpdatePolicy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
943+
public async System.Threading.Tasks.Task<Okta.Sdk.Client.ApiResponse<Policy>> CreatePolicyWithHttpInfoAsync( Policy policy , bool? activate = default(bool?) , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
944944
{
945945
// verify the required parameter 'policy' is set
946946
if (policy == null)
@@ -2648,7 +2648,7 @@ public Okta.Sdk.Client.ExceptionFactory ExceptionFactory
26482648
/// <param name="policy"></param>
26492649
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
26502650
/// <returns>Task of Policy</returns>
2651-
public async System.Threading.Tasks.Task<Policy> ReplacePolicyAsync( string policyId , CreateOrUpdatePolicy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
2651+
public async System.Threading.Tasks.Task<Policy> ReplacePolicyAsync( string policyId , Policy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
26522652
{
26532653
Okta.Sdk.Client.ApiResponse<Policy> localVarResponse = await ReplacePolicyWithHttpInfoAsync(policyId, policy, cancellationToken).ConfigureAwait(false);
26542654
return localVarResponse.Data;
@@ -2661,7 +2661,7 @@ public Okta.Sdk.Client.ExceptionFactory ExceptionFactory
26612661
/// <param name="policy"></param>
26622662
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
26632663
/// <returns>Task of ApiResponse (Policy)</returns>
2664-
public async System.Threading.Tasks.Task<Okta.Sdk.Client.ApiResponse<Policy>> ReplacePolicyWithHttpInfoAsync( string policyId , CreateOrUpdatePolicy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
2664+
public async System.Threading.Tasks.Task<Okta.Sdk.Client.ApiResponse<Policy>> ReplacePolicyWithHttpInfoAsync( string policyId , Policy policy , System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
26652665
{
26662666
// verify the required parameter 'policyId' is set
26672667
if (policyId == null)

0 commit comments

Comments
 (0)