Skip to content

Commit

Permalink
chore: sync sdk-generator changes (#84)
Browse files Browse the repository at this point in the history
## Description

Syncs changes to this repo based on file generation changes after
backporting the OpenTelemetry work and recent changes that have occured.

## References
<!-- Provide a list of any applicable references here (GitHub Issue,
[OpenFGA RFC](https://github.com/openfga/rfcs), other PRs, etc..) -->

## Review Checklist
- [x] I have clicked on ["allow edits by
maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
- [ ] I have added documentation for new/changed functionality in this
PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev)
[Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not `main`
- [ ] I have added tests to validate that the change in functionality is
working as expected

If you haven't done so yet, we would appreciate it if you could star the
[OpenFGA repository](https://github.com/openfga/openfga). :)
  • Loading branch information
ewanharris authored Nov 5, 2024
2 parents 8144f26 + b699603 commit b132018
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 25 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
with:
dotnet-version: 6.0.x

Expand All @@ -32,7 +32,7 @@ jobs:
- name: Test
run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.3.1
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: nuget-package
path: src/OpenFga.Sdk/bin/Release/OpenFga.Sdk.*.nupkg
Expand All @@ -50,12 +50,12 @@ jobs:
needs: [test]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0
with:
dotnet-version: 6.0.x
source-url: https://api.nuget.org/v3/index.json
Expand All @@ -68,7 +68,7 @@ jobs:
- name: Build
run: dotnet build --no-restore --configuration Release

- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.3.1
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: nuget-package
path: src/OpenFga.Sdk/bin/Release/OpenFga.Sdk.*.nupkg
Expand All @@ -87,7 +87,7 @@ jobs:
contents: write

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semgrep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
image: returntocorp/semgrep
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- run: semgrep ci --no-suppress-errors
Expand Down
3 changes: 3 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.github/ISSUE_TEMPLATE/config.yaml
.github/ISSUE_TEMPLATE/feature_request.yaml
.github/dependabot.yaml
.github/workflows/main.yaml
.github/workflows/semgrep.yaml
.gitignore
CHANGELOG.md
Expand Down Expand Up @@ -159,6 +160,7 @@ src/OpenFga.Sdk/Client/Model/RetryParams.cs
src/OpenFga.Sdk/Client/Model/StoreIdOptions.cs
src/OpenFga.Sdk/Configuration/Configuration.cs
src/OpenFga.Sdk/Configuration/Credentials.cs
src/OpenFga.Sdk/Configuration/TelemetryConfig.cs
src/OpenFga.Sdk/Exceptions/ApiAuthenticationError.cs
src/OpenFga.Sdk/Exceptions/ApiError.cs
src/OpenFga.Sdk/Exceptions/ApiException.cs
Expand Down Expand Up @@ -256,4 +258,5 @@ src/OpenFga.Sdk/OpenFga.Sdk.csproj
src/OpenFga.Sdk/Telemetry/Attributes.cs
src/OpenFga.Sdk/Telemetry/Counters.cs
src/OpenFga.Sdk/Telemetry/Histograms.cs
src/OpenFga.Sdk/Telemetry/Meters.cs
src/OpenFga.Sdk/Telemetry/Metrics.cs
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
### [0.5.0](https://github.com/openfga/dotnet-sdk/compare/v0.4.0...v0.5.0) (2024-08-28)

- feat: support consistency parameter (#70)
Note: To use this feature, you need to be running OpenFGA v1.5.7+ with the experimental flag `enable-consistency-params` enabled.
See the [v1.5.7 release notes](https://github.com/openfga/openfga/releases/tag/v1.5.7) for details.
Note: To use this feature, you need to be running OpenFGA v1.5.7+ with the experimental flag `enable-consistency-params` enabled.
See the [v1.5.7 release notes](https://github.com/openfga/openfga/releases/tag/v1.5.7) for details.

## v0.4.0

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ That repo includes an issue template that will walk through all the places to ch

### Submitting Pull Requests

Considering that the SDKs are autogenerated, please make sure to submit your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator). We will not accept PRs to this repository because they will be overwritten on the next sdk generation.
While we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well.

## Getting in touch

Expand All @@ -43,4 +43,4 @@ Please do not open issues for general support or usage questions. Instead, join

### Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://github.com/openfga/dotnet-sdk/blob/main/.github/SECURITY.md) details the procedure for disclosing security issues.
Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://github.com/openfga/.github/blob/main/SECURITY.md) details the procedure for disclosing security issues.
3 changes: 0 additions & 3 deletions OpenTelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ Not all metrics and attributes are enabled by default.

Some attributes, like `fga-client.user` have been disabled by default due to their high cardinality, which may result for very high costs when using some SaaS metric collectors.
If you expect to have a high cardinality for a specific attribute, you can disable it by updating the `TelemetryConfig` accordingly.

```csharp

## Configuration

See the OpenTelemetry docs on [Customizing the SDK](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/metrics/customizing-the-sdk/README.md).
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ If your server is configured with [authentication enabled](https://openfga.dev/d

Get a paginated list of stores.

[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/ListStores)
[API Documentation](https://openfga.dev/api/service#/Stores/ListStores)

```csharp
var options = new ClientListStoresOptions {
Expand All @@ -223,7 +223,7 @@ var response = await fgaClient.ListStores(options);

Initialize a store.

[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/CreateStore)
[API Documentation](https://openfga.dev/api/service#/Stores/CreateStore)

```csharp
var store = await fgaClient.CreateStore(new ClientCreateStoreRequest(){Name = "FGA Demo"})
Expand All @@ -242,7 +242,7 @@ fgaClient.StoreId = storeId;

Get information about the current store.

[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/GetStore)
[API Documentation](https://openfga.dev/api/service#/Stores/GetStore)

> Requires a client initialized with a storeId
Expand All @@ -256,7 +256,7 @@ var store = await fgaClient.GetStore();

Delete a store.

[API Documentation](https://openfga.dev/api/service/docs/api#/Stores/DeleteStore)
[API Documentation](https://openfga.dev/api/service#/Stores/DeleteStore)

> Requires a client initialized with a storeId
Expand Down
4 changes: 2 additions & 2 deletions src/OpenFga.Sdk/Client/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// NOTE: This file was auto generated. DO NOT EDIT.
//


using OpenFga.Sdk.Client.Model;
using OpenFga.Sdk.Configuration;
using OpenFga.Sdk.Exceptions;
using System.Text.RegularExpressions;

Expand All @@ -24,7 +24,7 @@ public class Telemetry {
}

/// <summary>
/// Configuration class for the OpenFGA client.
/// Configuration class for the OpenFga.Sdk client.
/// </summary>
public class ClientConfiguration : Configuration.Configuration {
/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/OpenFga.Sdk/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace OpenFga.Sdk.Configuration;

/// <summary>
/// Setup OpenFGA Configuration
/// Setup OpenFga.Sdk Configuration
/// </summary>
public class Configuration {
#region Constructors
Expand Down Expand Up @@ -65,7 +65,7 @@ public void EnsureValid() {
Telemetry?.EnsureValid();
}

#endregion
#endregion Methods

#region Constants

Expand Down
1 change: 1 addition & 0 deletions src/OpenFga.Sdk/Configuration/Credentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private static bool IsWellFormedUriString(string uri) {
/// Ensures the credentials configuration is valid otherwise throws an error
/// </summary>
/// <exception cref="FgaRequiredParamError"></exception>
/// <exception cref="FgaValidationError"></exception>
public void EnsureValid() {
switch (Method) {
case CredentialsMethod.ApiToken:
Expand Down
13 changes: 13 additions & 0 deletions src/OpenFga.Sdk/Configuration/TelemetryConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
//
// OpenFGA/.NET SDK for OpenFGA
//
// API version: 1.x
// Website: https://openfga.dev
// Documentation: https://openfga.dev/docs
// Support: https://openfga.dev/community
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
//
// NOTE: This file was auto generated. DO NOT EDIT.
//


using OpenFga.Sdk.Exceptions;
using OpenFga.Sdk.Telemetry;

Expand Down
4 changes: 2 additions & 2 deletions src/OpenFga.Sdk/Telemetry/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// NOTE: This file was auto generated. DO NOT EDIT.
//


using OpenFga.Sdk.ApiClient;
using OpenFga.Sdk.Configuration;
using System.Diagnostics;
Expand Down Expand Up @@ -306,8 +307,7 @@ private static TagList AddCommonAttributes<T>(
}
}

if (enabledAttributes.Contains(TelemetryAttribute.RequestClientId) && credentials is
{ Method: CredentialsMethod.ClientCredentials, Config.ClientId: not null }) {
if (enabledAttributes.Contains(TelemetryAttribute.RequestClientId) && credentials is { Method: CredentialsMethod.ClientCredentials, Config.ClientId: not null }) {
attributes.Add(new KeyValuePair<string, object?>(TelemetryAttribute.RequestClientId,
credentials.Config.ClientId));
}
Expand Down
1 change: 1 addition & 0 deletions src/OpenFga.Sdk/Telemetry/Counters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// NOTE: This file was auto generated. DO NOT EDIT.
//


using System.Diagnostics;
using System.Diagnostics.Metrics;

Expand Down
1 change: 1 addition & 0 deletions src/OpenFga.Sdk/Telemetry/Histograms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// NOTE: This file was auto generated. DO NOT EDIT.
//


using System.Diagnostics;
using System.Diagnostics.Metrics;

Expand Down
13 changes: 13 additions & 0 deletions src/OpenFga.Sdk/Telemetry/Meters.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
//
// OpenFGA/.NET SDK for OpenFGA
//
// API version: 1.x
// Website: https://openfga.dev
// Documentation: https://openfga.dev/docs
// Support: https://openfga.dev/community
// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE)
//
// NOTE: This file was auto generated. DO NOT EDIT.
//


namespace OpenFga.Sdk.Telemetry;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/OpenFga.Sdk/Telemetry/Metrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// NOTE: This file was auto generated. DO NOT EDIT.
//


using OpenFga.Sdk.ApiClient;
using OpenFga.Sdk.Configuration;
using System.Diagnostics;
Expand Down

0 comments on commit b132018

Please sign in to comment.