Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): api update #2366

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1504
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ee0fe6ded1f6eb6dfeee8aa4341555587ceed6fdce971e87b56809c6dbf2d64a.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8973dde42d42a39c8fbc5f3f1eb1328e6ac0c805ca4d3e5920796749ed58eb0a.yml
17 changes: 11 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4749,7 +4749,7 @@ Types:

Methods:

- <code title="get /accounts/{account_id}/access/policy-tests/{policy_test_id}/users">client.zeroTrust.access.applications.policyTests.users.<a href="./src/resources/zero-trust/access/applications/policy-tests/users.ts">list</a>(policyTestId, { ...params }) -> UserListResponse</code>
- <code title="get /accounts/{account_id}/access/policy-tests/{policy_test_id}/users">client.zeroTrust.access.applications.policyTests.users.<a href="./src/resources/zero-trust/access/applications/policy-tests/users.ts">list</a>(policyTestId, { ...params }) -> UserListResponsesSinglePage</code>

### Certificates

Expand Down Expand Up @@ -4785,15 +4785,19 @@ Methods:
Types:

- <code><a href="./src/resources/zero-trust/access/groups.ts">ZeroTrustGroup</a></code>
- <code><a href="./src/resources/zero-trust/access/groups.ts">GroupCreateResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/groups.ts">GroupUpdateResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/groups.ts">GroupListResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/groups.ts">GroupDeleteResponse</a></code>
- <code><a href="./src/resources/zero-trust/access/groups.ts">GroupGetResponse</a></code>

Methods:

- <code title="post /{account_or_zone}/{account_or_zone_id}/access/groups">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">create</a>({ ...params }) -> ZeroTrustGroup</code>
- <code title="put /{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">update</a>(groupId, { ...params }) -> ZeroTrustGroup</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/groups">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">list</a>({ ...params }) -> ZeroTrustGroupsSinglePage</code>
- <code title="post /{account_or_zone}/{account_or_zone_id}/access/groups">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">create</a>({ ...params }) -> GroupCreateResponse</code>
- <code title="put /{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">update</a>(groupId, { ...params }) -> GroupUpdateResponse</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/groups">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">list</a>({ ...params }) -> GroupListResponsesSinglePage</code>
- <code title="delete /{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">delete</a>(groupId, { ...params }) -> GroupDeleteResponse</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">get</a>(groupId, { ...params }) -> ZeroTrustGroup</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}">client.zeroTrust.access.groups.<a href="./src/resources/zero-trust/access/groups.ts">get</a>(groupId, { ...params }) -> GroupGetResponse</code>

### ServiceTokens

Expand Down Expand Up @@ -4860,10 +4864,11 @@ Methods:
Types:

- <code><a href="./src/resources/zero-trust/access/users/users.ts">AccessUser</a></code>
- <code><a href="./src/resources/zero-trust/access/users/users.ts">UserListResponse</a></code>

Methods:

- <code title="get /accounts/{account_id}/access/users">client.zeroTrust.access.users.<a href="./src/resources/zero-trust/access/users/users.ts">list</a>({ ...params }) -> AccessUsersSinglePage</code>
- <code title="get /accounts/{account_id}/access/users">client.zeroTrust.access.users.<a href="./src/resources/zero-trust/access/users/users.ts">list</a>({ ...params }) -> UserListResponsesSinglePage</code>

#### ActiveSessions

Expand Down
27 changes: 21 additions & 6 deletions src/resources/zero-trust/access/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ import {
import * as GroupsAPI from './groups';
import {
GroupCreateParams,
GroupCreateResponse,
GroupDeleteParams,
GroupDeleteResponse,
GroupGetParams,
GroupGetResponse,
GroupListParams,
GroupListResponse,
GroupListResponsesSinglePage,
GroupUpdateParams,
GroupUpdateResponse,
Groups,
ZeroTrustGroup,
ZeroTrustGroupsSinglePage,
} from './groups';
import * as KeysAPI from './keys';
import {
Expand Down Expand Up @@ -157,7 +161,13 @@ import { Infrastructure } from './infrastructure/infrastructure';
import * as LogsAPI from './logs/logs';
import { Logs } from './logs/logs';
import * as UsersAPI from './users/users';
import { AccessUser, AccessUsersSinglePage, UserListParams, Users } from './users/users';
import {
AccessUser,
UserListParams,
UserListResponse,
UserListResponsesSinglePage,
Users,
} from './users/users';

export class Access extends APIResource {
gatewayCA: GatewayCAAPI.GatewayCA = new GatewayCAAPI.GatewayCA(this._client);
Expand Down Expand Up @@ -1011,15 +1021,15 @@ Access.ApplicationListResponsesSinglePage = ApplicationListResponsesSinglePage;
Access.Certificates = Certificates;
Access.CertificatesSinglePage = CertificatesSinglePage;
Access.Groups = Groups;
Access.ZeroTrustGroupsSinglePage = ZeroTrustGroupsSinglePage;
Access.GroupListResponsesSinglePage = GroupListResponsesSinglePage;
Access.ServiceTokens = ServiceTokens;
Access.ServiceTokensSinglePage = ServiceTokensSinglePage;
Access.Bookmarks = Bookmarks;
Access.BookmarksSinglePage = BookmarksSinglePage;
Access.Keys = Keys;
Access.Logs = Logs;
Access.Users = Users;
Access.AccessUsersSinglePage = AccessUsersSinglePage;
Access.UserListResponsesSinglePage = UserListResponsesSinglePage;
Access.CustomPages = CustomPages;
Access.CustomPageWithoutHTMLsSinglePage = CustomPageWithoutHTMLsSinglePage;
Access.Tags = Tags;
Expand Down Expand Up @@ -1116,8 +1126,12 @@ export declare namespace Access {
export {
Groups as Groups,
type ZeroTrustGroup as ZeroTrustGroup,
type GroupCreateResponse as GroupCreateResponse,
type GroupUpdateResponse as GroupUpdateResponse,
type GroupListResponse as GroupListResponse,
type GroupDeleteResponse as GroupDeleteResponse,
ZeroTrustGroupsSinglePage as ZeroTrustGroupsSinglePage,
type GroupGetResponse as GroupGetResponse,
GroupListResponsesSinglePage as GroupListResponsesSinglePage,
type GroupCreateParams as GroupCreateParams,
type GroupUpdateParams as GroupUpdateParams,
type GroupListParams as GroupListParams,
Expand Down Expand Up @@ -1167,7 +1181,8 @@ export declare namespace Access {
export {
Users as Users,
type AccessUser as AccessUser,
AccessUsersSinglePage as AccessUsersSinglePage,
type UserListResponse as UserListResponse,
UserListResponsesSinglePage as UserListResponsesSinglePage,
type UserListParams as UserListParams,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export {
type PolicyTestCreateParams,
type PolicyTestGetParams,
} from './policy-tests';
export { Users, type UserListResponse, type UserListParams } from './users';
export { UserListResponsesSinglePage, Users, type UserListResponse, type UserListParams } from './users';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as AccessAPI from '../../access';
import * as PoliciesAPI from '../../policies';
import * as ApplicationsAPI from '../applications';
import * as UsersAPI from './users';
import { UserListParams, UserListResponse, Users } from './users';
import { UserListParams, UserListResponse, UserListResponsesSinglePage, Users } from './users';

export class PolicyTests extends APIResource {
users: UsersAPI.Users = new UsersAPI.Users(this._client);
Expand All @@ -19,7 +19,12 @@ export class PolicyTests extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise<PolicyTestCreateResponse> {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/access/policy-tests`, { body, ...options });
return (
this._client.post(`/accounts/${account_id}/access/policy-tests`, {
body,
...options,
}) as Core.APIPromise<{ result: PolicyTestCreateResponse }>
)._thenUnwrap((obj) => obj.result);
}

/**
Expand All @@ -30,8 +35,13 @@ export class PolicyTests extends APIResource {
params: PolicyTestGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<PolicyTestGetResponse> {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/access/policy-tests/${policyTestId}`, options);
const { account_id, ...query } = params;
return (
this._client.get(`/accounts/${account_id}/access/policy-tests/${policyTestId}`, {
query,
...options,
}) as Core.APIPromise<{ result: PolicyTestGetResponse }>
)._thenUnwrap((obj) => obj.result);
}
}

Expand Down Expand Up @@ -101,85 +111,93 @@ export interface PolicyTestCreateParams {
account_id: string;

/**
* Body param: The UUID of the policy
* Body param:
*/
id?: string;

/**
* Body param: Administrators who can approve a temporary authentication request.
*/
approval_groups?: Array<PoliciesAPI.ApprovalGroupParam>;

/**
* Body param: Requires the user to request access from an administrator at the
* start of each session.
*/
approval_required?: boolean;

/**
* Body param: The action Access will take if a user matches this policy.
* Infrastructure application policies can only use the Allow action.
*/
decision?: ApplicationsAPI.DecisionParam;

/**
* Body param: Rules evaluated with a NOT logical operator. To match the policy, a
* user cannot meet any of the Exclude rules.
*/
exclude?: Array<AccessAPI.AccessRuleParam>;

/**
* Body param: Rules evaluated with an OR logical operator. A user needs to meet
* only one of the Include rules.
*/
include?: Array<AccessAPI.AccessRuleParam>;

/**
* Body param: Require this application to be served in an isolated browser for
* users matching this policy. 'Client Web Isolation' must be on for the account in
* order to use this feature.
*/
isolation_required?: boolean;

/**
* Body param: The name of the Access policy.
*/
name?: string;

/**
* Body param: A custom message that will appear on the purpose justification
* screen.
*/
purpose_justification_prompt?: string;

/**
* Body param: Require users to enter a justification when they log in to the
* application.
*/
purpose_justification_required?: boolean;

/**
* Body param: Rules evaluated with an AND logical operator. To match the policy, a
* user must meet all of the Require rules.
*/
require?: Array<AccessAPI.AccessRuleParam>;
policies?: Array<PolicyTestCreateParams.Policy>;
}

/**
* Body param: The amount of time that tokens issued for the application will be
* valid. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us
* (or µs), ms, s, m, h.
*/
session_duration?: string;
export namespace PolicyTestCreateParams {
export interface Policy {
/**
* The action Access will take if a user matches this policy. Infrastructure
* application policies can only use the Allow action.
*/
decision: ApplicationsAPI.DecisionParam;

/**
* Rules evaluated with an OR logical operator. A user needs to meet only one of
* the Include rules.
*/
include: Array<AccessAPI.AccessRuleParam>;

/**
* The name of the Access policy.
*/
name: string;

/**
* Administrators who can approve a temporary authentication request.
*/
approval_groups?: Array<PoliciesAPI.ApprovalGroupParam>;

/**
* Requires the user to request access from an administrator at the start of each
* session.
*/
approval_required?: boolean;

/**
* Rules evaluated with a NOT logical operator. To match the policy, a user cannot
* meet any of the Exclude rules.
*/
exclude?: Array<AccessAPI.AccessRuleParam>;

/**
* Require this application to be served in an isolated browser for users matching
* this policy. 'Client Web Isolation' must be on for the account in order to use
* this feature.
*/
isolation_required?: boolean;

/**
* A custom message that will appear on the purpose justification screen.
*/
purpose_justification_prompt?: string;

/**
* Require users to enter a justification when they log in to the application.
*/
purpose_justification_required?: boolean;

/**
* Rules evaluated with an AND logical operator. To match the policy, a user must
* meet all of the Require rules.
*/
require?: Array<AccessAPI.AccessRuleParam>;

/**
* The amount of time that tokens issued for the application will be valid. Must be
* in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s,
* m, h.
*/
session_duration?: string;
}
}

export interface PolicyTestGetParams {
/**
* Identifier
* Path param: Identifier
*/
account_id: string;

/**
* Query param:
*/
page?: number;
}

PolicyTests.Users = Users;
PolicyTests.UserListResponsesSinglePage = UserListResponsesSinglePage;

export declare namespace PolicyTests {
export {
Expand All @@ -189,5 +207,10 @@ export declare namespace PolicyTests {
type PolicyTestGetParams as PolicyTestGetParams,
};

export { Users as Users, type UserListResponse as UserListResponse, type UserListParams as UserListParams };
export {
Users as Users,
type UserListResponse as UserListResponse,
UserListResponsesSinglePage as UserListResponsesSinglePage,
type UserListParams as UserListParams,
};
}
Loading