Skip to content

Commit 059dc1e

Browse files
feat(api): api update
1 parent e38600c commit 059dc1e

File tree

6 files changed

+18
-76
lines changed

6 files changed

+18
-76
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1777
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9b887cd7c10651d6035399ac0cac40f37b53b4c9b2e287a23ea7352eca49c052.yml
3-
openapi_spec_hash: 3882002006ca3245b0bfc9dbcc66d0e0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-395fd6e5cc7e27dbdb13689d4d35df1ab79a1341ff126182164b06c91cdd5c37.yml
3+
openapi_spec_hash: 0f73e4a572d51862942a5c0342121887
44
config_hash: bafeb7666d2b7868c9d4ab8f0cc686e1

src/resources/accounts/tokens/tokens.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class Tokens extends APIResource {
3838
* { id: 'c8fed203ed3043cba015a93ad1616f1f' },
3939
* { id: '82e64a83756745bbbb1c9c2701bf816b' },
4040
* ],
41-
* resources: {},
41+
* resources: { foo: 'string' },
4242
* },
4343
* ],
4444
* });
@@ -70,7 +70,7 @@ export class Tokens extends APIResource {
7070
* { id: 'c8fed203ed3043cba015a93ad1616f1f' },
7171
* { id: '82e64a83756745bbbb1c9c2701bf816b' },
7272
* ],
73-
* resources: {},
73+
* resources: { foo: 'string' },
7474
* },
7575
* ],
7676
* },

src/resources/shared.ts

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,9 @@ export interface TokenPolicy {
888888
permission_groups: Array<TokenPolicy.PermissionGroup>;
889889

890890
/**
891-
* Resource permissions for the policy. Use either simple or nested permissions.
891+
* A list of resource names that the policy applies to.
892892
*/
893-
resources: TokenPolicy.Resources;
893+
resources: { [key: string]: string | { [key: string]: string } };
894894
}
895895

896896
export namespace TokenPolicy {
@@ -925,21 +925,6 @@ export namespace TokenPolicy {
925925
value?: string;
926926
}
927927
}
928-
929-
/**
930-
* Resource permissions for the policy. Use either simple or nested permissions.
931-
*/
932-
export interface Resources {
933-
/**
934-
* Nested resource permissions for hierarchical scoping.
935-
*/
936-
nested?: { [key: string]: { [key: string]: string } };
937-
938-
/**
939-
* Simple resource permissions where each resource maps to a permission string.
940-
*/
941-
simple?: { [key: string]: string };
942-
}
943928
}
944929

945930
export interface TokenPolicyParam {
@@ -954,9 +939,9 @@ export interface TokenPolicyParam {
954939
permission_groups: Array<TokenPolicyParam.PermissionGroup>;
955940

956941
/**
957-
* Resource permissions for the policy. Use either simple or nested permissions.
942+
* A list of resource names that the policy applies to.
958943
*/
959-
resources: TokenPolicyParam.Resources;
944+
resources: { [key: string]: string | { [key: string]: string } };
960945
}
961946

962947
export namespace TokenPolicyParam {
@@ -986,21 +971,6 @@ export namespace TokenPolicyParam {
986971
value?: string;
987972
}
988973
}
989-
990-
/**
991-
* Resource permissions for the policy. Use either simple or nested permissions.
992-
*/
993-
export interface Resources {
994-
/**
995-
* Nested resource permissions for hierarchical scoping.
996-
*/
997-
nested?: { [key: string]: { [key: string]: string } };
998-
999-
/**
1000-
* Simple resource permissions where each resource maps to a permission string.
1001-
*/
1002-
simple?: { [key: string]: string };
1003-
}
1004974
}
1005975

1006976
/**

src/resources/user/tokens/tokens.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class Tokens extends APIResource {
3636
* { id: 'c8fed203ed3043cba015a93ad1616f1f' },
3737
* { id: '82e64a83756745bbbb1c9c2701bf816b' },
3838
* ],
39-
* resources: {},
39+
* resources: { foo: 'string' },
4040
* },
4141
* ],
4242
* });
@@ -66,7 +66,7 @@ export class Tokens extends APIResource {
6666
* { id: 'c8fed203ed3043cba015a93ad1616f1f' },
6767
* { id: '82e64a83756745bbbb1c9c2701bf816b' },
6868
* ],
69-
* resources: {},
69+
* resources: { foo: 'string' },
7070
* },
7171
* ],
7272
* },

tests/api-resources/accounts/tokens/tokens.test.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('resource tokens', () => {
2222
{ id: 'c8fed203ed3043cba015a93ad1616f1f' },
2323
{ id: '82e64a83756745bbbb1c9c2701bf816b' },
2424
],
25-
resources: {},
25+
resources: { foo: 'string' },
2626
},
2727
],
2828
});
@@ -47,14 +47,7 @@ describe('resource tokens', () => {
4747
{ id: 'c8fed203ed3043cba015a93ad1616f1f', meta: { key: 'key', value: 'value' } },
4848
{ id: '82e64a83756745bbbb1c9c2701bf816b', meta: { key: 'key', value: 'value' } },
4949
],
50-
resources: {
51-
nested: {
52-
'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': {
53-
'com.cloudflare.api.account.zone.*': '*',
54-
},
55-
},
56-
simple: { 'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': '*' },
57-
},
50+
resources: { foo: 'string' },
5851
},
5952
],
6053
condition: {
@@ -80,7 +73,7 @@ describe('resource tokens', () => {
8073
{ id: 'c8fed203ed3043cba015a93ad1616f1f' },
8174
{ id: '82e64a83756745bbbb1c9c2701bf816b' },
8275
],
83-
resources: {},
76+
resources: { foo: 'string' },
8477
},
8578
],
8679
});
@@ -105,14 +98,7 @@ describe('resource tokens', () => {
10598
{ id: 'c8fed203ed3043cba015a93ad1616f1f', meta: { key: 'key', value: 'value' } },
10699
{ id: '82e64a83756745bbbb1c9c2701bf816b', meta: { key: 'key', value: 'value' } },
107100
],
108-
resources: {
109-
nested: {
110-
'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': {
111-
'com.cloudflare.api.account.zone.*': '*',
112-
},
113-
},
114-
simple: { 'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': '*' },
115-
},
101+
resources: { foo: 'string' },
116102
},
117103
],
118104
condition: {

tests/api-resources/user/tokens/tokens.test.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('resource tokens', () => {
2121
{ id: 'c8fed203ed3043cba015a93ad1616f1f' },
2222
{ id: '82e64a83756745bbbb1c9c2701bf816b' },
2323
],
24-
resources: {},
24+
resources: { foo: 'string' },
2525
},
2626
],
2727
});
@@ -45,14 +45,7 @@ describe('resource tokens', () => {
4545
{ id: 'c8fed203ed3043cba015a93ad1616f1f', meta: { key: 'key', value: 'value' } },
4646
{ id: '82e64a83756745bbbb1c9c2701bf816b', meta: { key: 'key', value: 'value' } },
4747
],
48-
resources: {
49-
nested: {
50-
'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': {
51-
'com.cloudflare.api.account.zone.*': '*',
52-
},
53-
},
54-
simple: { 'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': '*' },
55-
},
48+
resources: { foo: 'string' },
5649
},
5750
],
5851
condition: {
@@ -77,7 +70,7 @@ describe('resource tokens', () => {
7770
{ id: 'c8fed203ed3043cba015a93ad1616f1f' },
7871
{ id: '82e64a83756745bbbb1c9c2701bf816b' },
7972
],
80-
resources: {},
73+
resources: { foo: 'string' },
8174
},
8275
],
8376
});
@@ -101,14 +94,7 @@ describe('resource tokens', () => {
10194
{ id: 'c8fed203ed3043cba015a93ad1616f1f', meta: { key: 'key', value: 'value' } },
10295
{ id: '82e64a83756745bbbb1c9c2701bf816b', meta: { key: 'key', value: 'value' } },
10396
],
104-
resources: {
105-
nested: {
106-
'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': {
107-
'com.cloudflare.api.account.zone.*': '*',
108-
},
109-
},
110-
simple: { 'com.cloudflare.api.account.472e41d66440f10635de39c7ffaf6080': '*' },
111-
},
97+
resources: { foo: 'string' },
11298
},
11399
],
114100
condition: {

0 commit comments

Comments
 (0)