Skip to content

Commit 47cd9ee

Browse files
committed
feat: add sponsorship
1 parent be7b663 commit 47cd9ee

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Unofficial Terraform provider for OpenAI.
66

77
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
88

9-
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L3L71DQEL)
9+
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)
10+
[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)
1011

1112
## Requirements
1213

docs/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ page_title: "openai Provider"
44
subcategory: ""
55
description: |-
66
The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official Administration API https://platform.openai.com/docs/api-reference/administration to interact with the OpenAI platform.
7+
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
8+
Github-sponsors https://github.com/sponsors/jianyuan
9+
Ko-Fi https://ko-fi.com/L3L71DQEL
710
---
811

912
# openai Provider
1013

1114
The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.
1215

16+
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
17+
18+
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)
19+
[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)
20+
1321
## Example Usage
1422

1523
```terraform

internal/provider/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (p *OpenAIProvider) Metadata(ctx context.Context, req provider.MetadataRequ
4141

4242
func (p *OpenAIProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
4343
resp.Schema = schema.Schema{
44-
MarkdownDescription: "The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.",
44+
MarkdownDescription: "The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.\n\nIf you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.\n\n[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)\n[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)",
4545
Attributes: map[string]schema.Attribute{
4646
"base_url": schema.StringAttribute{
4747
MarkdownDescription: "Base URL for the OpenAI API. Defaults to `https://api.openai.com`.",

internal/provider/resource_project_rate_limit.go

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,24 @@ func (r *ProjectRateLimitResource) Create(ctx context.Context, req resource.Crea
112112
return
113113
}
114114

115-
body := apiclient.ProjectRateLimitUpdateRequest{
116-
MaxRequestsPer1Minute: data.MaxRequestsPer1Minute.ValueInt64Pointer(),
117-
MaxTokensPer1Minute: data.MaxTokensPer1Minute.ValueInt64Pointer(),
118-
MaxImagesPer1Minute: data.MaxImagesPer1Minute.ValueInt64Pointer(),
119-
MaxAudioMegabytesPer1Minute: data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer(),
120-
MaxRequestsPer1Day: data.MaxRequestsPer1Day.ValueInt64Pointer(),
121-
Batch1DayMaxInputTokens: data.Batch1DayMaxInputTokens.ValueInt64Pointer(),
115+
body := apiclient.ProjectRateLimitUpdateRequest{}
116+
if !data.MaxRequestsPer1Minute.IsUnknown() {
117+
body.MaxRequestsPer1Minute = data.MaxRequestsPer1Minute.ValueInt64Pointer()
118+
}
119+
if !data.MaxTokensPer1Minute.IsUnknown() {
120+
body.MaxTokensPer1Minute = data.MaxTokensPer1Minute.ValueInt64Pointer()
121+
}
122+
if !data.MaxImagesPer1Minute.IsUnknown() {
123+
body.MaxImagesPer1Minute = data.MaxImagesPer1Minute.ValueInt64Pointer()
124+
}
125+
if !data.MaxAudioMegabytesPer1Minute.IsUnknown() {
126+
body.MaxAudioMegabytesPer1Minute = data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer()
127+
}
128+
if !data.MaxRequestsPer1Day.IsUnknown() {
129+
body.MaxRequestsPer1Day = data.MaxRequestsPer1Day.ValueInt64Pointer()
130+
}
131+
if !data.Batch1DayMaxInputTokens.IsUnknown() {
132+
body.Batch1DayMaxInputTokens = data.Batch1DayMaxInputTokens.ValueInt64Pointer()
122133
}
123134

124135
httpResp, err := r.client.UpdateProjectRateLimitsWithResponse(
@@ -197,13 +208,24 @@ func (r *ProjectRateLimitResource) Update(ctx context.Context, req resource.Upda
197208
return
198209
}
199210

200-
body := apiclient.ProjectRateLimitUpdateRequest{
201-
MaxRequestsPer1Minute: data.MaxRequestsPer1Minute.ValueInt64Pointer(),
202-
MaxTokensPer1Minute: data.MaxTokensPer1Minute.ValueInt64Pointer(),
203-
MaxImagesPer1Minute: data.MaxImagesPer1Minute.ValueInt64Pointer(),
204-
MaxAudioMegabytesPer1Minute: data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer(),
205-
MaxRequestsPer1Day: data.MaxRequestsPer1Day.ValueInt64Pointer(),
206-
Batch1DayMaxInputTokens: data.Batch1DayMaxInputTokens.ValueInt64Pointer(),
211+
body := apiclient.ProjectRateLimitUpdateRequest{}
212+
if !data.MaxRequestsPer1Minute.IsUnknown() {
213+
body.MaxRequestsPer1Minute = data.MaxRequestsPer1Minute.ValueInt64Pointer()
214+
}
215+
if !data.MaxTokensPer1Minute.IsUnknown() {
216+
body.MaxTokensPer1Minute = data.MaxTokensPer1Minute.ValueInt64Pointer()
217+
}
218+
if !data.MaxImagesPer1Minute.IsUnknown() {
219+
body.MaxImagesPer1Minute = data.MaxImagesPer1Minute.ValueInt64Pointer()
220+
}
221+
if !data.MaxAudioMegabytesPer1Minute.IsUnknown() {
222+
body.MaxAudioMegabytesPer1Minute = data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer()
223+
}
224+
if !data.MaxRequestsPer1Day.IsUnknown() {
225+
body.MaxRequestsPer1Day = data.MaxRequestsPer1Day.ValueInt64Pointer()
226+
}
227+
if !data.Batch1DayMaxInputTokens.IsUnknown() {
228+
body.Batch1DayMaxInputTokens = data.Batch1DayMaxInputTokens.ValueInt64Pointer()
207229
}
208230

209231
httpResp, err := r.client.UpdateProjectRateLimitsWithResponse(

0 commit comments

Comments
 (0)