From ca8b65fbf66e0ad1e4705be72432ad90c1a3b54a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:47:06 +0200 Subject: [PATCH] Add support for `Security` APIs (#8315) (#8316) Co-authored-by: Florian Bernd --- .../_Generated/Api/ApiUrlLookup.g.cs | 47 + .../Security/ActivateUserProfileRequest.g.cs | 136 + .../Security/ActivateUserProfileResponse.g.cs | 45 + .../Api/Security/AuthenticateRequest.g.cs | 84 + .../Api/Security/AuthenticateResponse.g.cs | 53 + .../Api/Security/BulkDeleteRoleRequest.g.cs | 119 + .../Api/Security/BulkDeleteRoleResponse.g.cs | 54 + .../Api/Security/BulkPutRoleRequest.g.cs | 165 + .../Api/Security/BulkPutRoleResponse.g.cs | 62 + .../Api/Security/ClearApiKeyCacheRequest.g.cs | 88 + .../Security/ClearApiKeyCacheResponse.g.cs | 37 + .../ClearCachedPrivilegesRequest.g.cs | 86 + .../ClearCachedPrivilegesResponse.g.cs | 37 + .../Security/ClearCachedRealmsRequest.g.cs | 102 + .../Security/ClearCachedRealmsResponse.g.cs | 37 + .../Api/Security/ClearCachedRolesRequest.g.cs | 86 + .../Security/ClearCachedRolesResponse.g.cs | 37 + .../ClearCachedServiceTokensRequest.g.cs | 98 + .../ClearCachedServiceTokensResponse.g.cs | 37 + .../Api/Security/CreateApiKeyRequest.g.cs | 314 + .../Api/Security/CreateApiKeyResponse.g.cs | 72 + .../Security/CreateServiceTokenRequest.g.cs | 122 + .../Security/CreateServiceTokenResponse.g.cs | 35 + .../Api/Security/DeletePrivilegesRequest.g.cs | 108 + .../Security/DeletePrivilegesResponse.g.cs | 37 + .../Security/DeleteRoleMappingRequest.g.cs | 102 + .../Security/DeleteRoleMappingResponse.g.cs | 33 + .../Api/Security/DeleteRoleRequest.g.cs | 102 + .../Api/Security/DeleteRoleResponse.g.cs | 33 + .../Security/DeleteServiceTokenRequest.g.cs | 114 + .../Security/DeleteServiceTokenResponse.g.cs | 33 + .../Security/DisableUserProfileRequest.g.cs | 106 + .../Security/DisableUserProfileResponse.g.cs | 38 + .../Security/EnableUserProfileRequest.g.cs | 106 + .../Security/EnableUserProfileResponse.g.cs | 38 + .../Api/Security/GetApiKeyRequest.g.cs | 228 + .../Api/Security/GetApiKeyResponse.g.cs | 33 + .../Security/GetBuiltinPrivilegesRequest.g.cs | 76 + .../GetBuiltinPrivilegesResponse.g.cs | 36 + .../Api/Security/GetPrivilegesRequest.g.cs | 104 + .../Api/Security/GetPrivilegesResponse.g.cs | 37 + .../Api/Security/GetRoleMappingRequest.g.cs | 94 + .../Api/Security/GetRoleMappingResponse.g.cs | 37 + .../Api/Security/GetRoleRequest.g.cs | 96 + .../Api/Security/GetRoleResponse.g.cs | 37 + .../Security/GetServiceAccountsRequest.g.cs | 104 + .../Security/GetServiceAccountsResponse.g.cs | 37 + .../GetServiceCredentialsRequest.g.cs | 92 + .../GetServiceCredentialsResponse.g.cs | 45 + .../Api/Security/GetTokenRequest.g.cs | 170 + .../Api/Security/GetTokenResponse.g.cs | 45 + .../Security/GetUserPrivilegesRequest.g.cs | 112 + .../Security/GetUserPrivilegesResponse.g.cs | 41 + .../Api/Security/GetUserProfileRequest.g.cs | 108 + .../Api/Security/GetUserProfileResponse.g.cs | 35 + .../Api/Security/GrantApiKeyRequest.g.cs | 484 ++ .../Api/Security/GrantApiKeyResponse.g.cs | 41 + .../Api/Security/HasPrivilegesRequest.g.cs | 272 + .../Api/Security/HasPrivilegesResponse.g.cs | 42 + .../HasPrivilegesUserProfileRequest.g.cs | 147 + .../HasPrivilegesUserProfileResponse.g.cs | 50 + .../Api/Security/InvalidateApiKeyRequest.g.cs | 277 + .../Security/InvalidateApiKeyResponse.g.cs | 39 + .../Api/Security/InvalidateTokenRequest.g.cs | 140 + .../Api/Security/InvalidateTokenResponse.g.cs | 39 + .../Api/Security/PutPrivilegesRequest.g.cs | 109 + .../Api/Security/PutPrivilegesResponse.g.cs | 37 + .../Api/Security/PutRoleMappingRequest.g.cs | 283 + .../Api/Security/PutRoleMappingResponse.g.cs | 35 + .../Api/Security/PutRoleRequest.g.cs | 685 ++ .../Api/Security/PutRoleResponse.g.cs | 33 + .../Api/Security/QueryApiKeysRequest.g.cs | 745 ++ .../Api/Security/QueryApiKeysResponse.g.cs | 62 + .../Api/Security/QueryRoleRequest.g.cs | 531 ++ .../Api/Security/QueryRoleResponse.g.cs | 54 + .../Api/Security/QueryUserRequest.g.cs | 546 ++ .../Api/Security/QueryUserResponse.g.cs | 54 + .../Api/Security/SamlAuthenticateRequest.g.cs | 149 + .../Security/SamlAuthenticateResponse.g.cs | 41 + .../Security/SamlCompleteLogoutRequest.g.cs | 175 + .../Security/SamlCompleteLogoutResponse.g.cs | 31 + .../Api/Security/SamlInvalidateRequest.g.cs | 161 + .../Api/Security/SamlInvalidateResponse.g.cs | 37 + .../Api/Security/SamlLogoutRequest.g.cs | 131 + .../Api/Security/SamlLogoutResponse.g.cs | 33 + .../SamlPrepareAuthenticationRequest.g.cs | 163 + .../SamlPrepareAuthenticationResponse.g.cs | 37 + .../SamlServiceProviderMetadataRequest.g.cs | 86 + .../SamlServiceProviderMetadataResponse.g.cs | 33 + .../Security/SuggestUserProfilesRequest.g.cs | 228 + .../Security/SuggestUserProfilesResponse.g.cs | 37 + .../Api/Security/UpdateApiKeyRequest.g.cs | 295 + .../Api/Security/UpdateApiKeyResponse.g.cs | 39 + .../UpdateUserProfileDataRequest.g.cs | 197 + .../UpdateUserProfileDataResponse.g.cs | 38 + .../Client/ElasticsearchClient.Security.g.cs | 3289 ++++++++ .../Client/ElasticsearchClient.g.cs | 3 + .../Aggregations/CardinalityAggregation.g.cs | 1 + .../Aggregations/CompositeAggregation.g.cs | 1 + .../Aggregations/DateRangeAggregation.g.cs | 1 + .../Aggregations/MissingAggregation.g.cs | 1 + .../Types/Aggregations/RangeAggregation.g.cs | 1 + .../Types/Aggregations/TermsAggregation.g.cs | 1 + .../Aggregations/ValueCountAggregation.g.cs | 1 + .../Types/Enums/Enums.Security.g.cs | 308 + .../_Generated/Types/QueryDsl/BoolQuery.g.cs | 3 + .../Types/QueryDsl/ExistsQuery.g.cs | 3 + .../_Generated/Types/QueryDsl/IdsQuery.g.cs | 3 + .../Types/QueryDsl/MatchAllQuery.g.cs | 3 + .../_Generated/Types/QueryDsl/MatchQuery.g.cs | 3 + .../Types/QueryDsl/PrefixQuery.g.cs | 3 + .../QueryDsl/SimpleQueryStringQuery.g.cs | 3 + .../_Generated/Types/QueryDsl/TermQuery.g.cs | 3 + .../_Generated/Types/QueryDsl/TermsQuery.g.cs | 3 + .../Types/QueryDsl/WildcardQuery.g.cs | 3 + .../_Generated/Types/Security/ApiKey.g.cs | 133 + .../Types/Security/ApiKeyAggregation.g.cs | 452 ++ .../Security/ApiKeyFiltersAggregation.g.cs | 244 + .../Types/Security/ApiKeyQuery.g.cs | 384 + .../ApplicationGlobalUserPrivileges.g.cs | 34 + .../Types/Security/ApplicationPrivileges.g.cs | 113 + .../Security/ApplicationPrivilegesCheck.g.cs | 113 + .../Types/Security/AuthenticateToken.g.cs | 36 + .../Types/Security/AuthenticatedUser.g.cs | 54 + .../Security/AuthenticationProvider.g.cs | 36 + .../_Generated/Types/Security/BulkError.g.cs | 47 + .../Types/Security/ClusterNode.g.cs | 34 + .../Types/Security/CreatedStatus.g.cs | 34 + .../_Generated/Types/Security/FieldRule.g.cs | 251 + .../Types/Security/FieldSecurity.g.cs | 122 + .../Types/Security/FoundStatus.g.cs | 34 + .../Types/Security/GetUserProfileErrors.g.cs | 36 + .../Types/Security/GlobalPrivilege.g.cs | 34 + .../Types/Security/GrantApiKey.g.cs | 231 + .../HasPrivilegesUserProfileErrors.g.cs | 36 + .../_Generated/Types/Security/Hint.g.cs | 103 + .../Types/Security/IndexPrivilegesCheck.g.cs | 121 + .../Types/Security/IndicesPrivileges.g.cs | 283 + .../Types/Security/ManageUserPrivileges.g.cs | 34 + .../Types/Security/NodesCredentials.g.cs | 47 + .../Security/NodesCredentialsFileToken.g.cs | 34 + .../Types/Security/PrivilegeActions.g.cs | 104 + .../Types/Security/PrivilegesCheck.g.cs | 220 + .../_Generated/Types/Security/QueryRole.g.cs | 168 + .../_Generated/Types/Security/QueryUser.g.cs | 48 + .../_Generated/Types/Security/RealmInfo.g.cs | 36 + .../_Generated/Types/Security/Role.g.cs | 48 + .../Types/Security/RoleDescriptor.g.cs | 689 ++ .../Types/Security/RoleDescriptorRead.g.cs | 146 + .../Types/Security/RoleDescriptorWrapper.g.cs | 34 + .../Types/Security/RoleMapping.g.cs | 42 + .../Types/Security/RoleMappingRule.g.cs | 272 + .../_Generated/Types/Security/RoleQuery.g.cs | 384 + .../Types/Security/RoleTemplate.g.cs | 108 + .../Types/Security/ServiceToken.g.cs | 36 + .../Types/Security/TotalUserProfiles.g.cs | 36 + .../Types/Security/UserIndicesPrivileges.g.cs | 72 + .../Types/Security/UserProfile.g.cs | 42 + .../Security/UserProfileHitMetadata.g.cs | 36 + .../Types/Security/UserProfileUser.g.cs | 44 + .../Security/UserProfileWithMetadata.g.cs | 46 + .../_Generated/Types/Security/UserQuery.g.cs | 384 + .../_Generated/Types/Security/UserRealm.g.cs | 36 + .../SingleOrManySerializationHelper.cs | 2 +- .../_Generated/Api/ApiUrlLookup.g.cs | 52 + .../Security/ActivateUserProfileRequest.g.cs | 136 + .../Security/ActivateUserProfileResponse.g.cs | 45 + .../Api/Security/AuthenticateRequest.g.cs | 84 + .../Api/Security/AuthenticateResponse.g.cs | 53 + .../Api/Security/ChangePasswordRequest.g.cs | 171 + .../Api/Security/ChangePasswordResponse.g.cs | 31 + .../Api/Security/ClearApiKeyCacheRequest.g.cs | 88 + .../Security/ClearApiKeyCacheResponse.g.cs | 37 + .../ClearCachedPrivilegesRequest.g.cs | 86 + .../ClearCachedPrivilegesResponse.g.cs | 37 + .../Security/ClearCachedRealmsRequest.g.cs | 102 + .../Security/ClearCachedRealmsResponse.g.cs | 37 + .../Api/Security/ClearCachedRolesRequest.g.cs | 86 + .../Security/ClearCachedRolesResponse.g.cs | 37 + .../ClearCachedServiceTokensRequest.g.cs | 98 + .../ClearCachedServiceTokensResponse.g.cs | 37 + .../Api/Security/CreateApiKeyRequest.g.cs | 314 + .../Api/Security/CreateApiKeyResponse.g.cs | 72 + .../Security/CreateServiceTokenRequest.g.cs | 122 + .../Security/CreateServiceTokenResponse.g.cs | 35 + .../Api/Security/DeletePrivilegesRequest.g.cs | 108 + .../Security/DeletePrivilegesResponse.g.cs | 37 + .../Security/DeleteRoleMappingRequest.g.cs | 102 + .../Security/DeleteRoleMappingResponse.g.cs | 33 + .../Api/Security/DeleteRoleRequest.g.cs | 102 + .../Api/Security/DeleteRoleResponse.g.cs | 33 + .../Security/DeleteServiceTokenRequest.g.cs | 114 + .../Security/DeleteServiceTokenResponse.g.cs | 33 + .../Api/Security/DeleteUserRequest.g.cs | 102 + .../Api/Security/DeleteUserResponse.g.cs | 33 + .../Security/DisableUserProfileRequest.g.cs | 106 + .../Security/DisableUserProfileResponse.g.cs | 38 + .../Api/Security/DisableUserRequest.g.cs | 102 + .../Api/Security/DisableUserResponse.g.cs | 31 + .../Security/EnableUserProfileRequest.g.cs | 106 + .../Security/EnableUserProfileResponse.g.cs | 38 + .../Api/Security/EnableUserRequest.g.cs | 102 + .../Api/Security/EnableUserResponse.g.cs | 31 + .../Api/Security/EnrollKibanaRequest.g.cs | 76 + .../Api/Security/EnrollKibanaResponse.g.cs | 35 + .../Api/Security/EnrollNodeRequest.g.cs | 76 + .../Api/Security/EnrollNodeResponse.g.cs | 43 + .../Api/Security/GetApiKeyRequest.g.cs | 228 + .../Api/Security/GetApiKeyResponse.g.cs | 33 + .../Security/GetBuiltinPrivilegesRequest.g.cs | 76 + .../GetBuiltinPrivilegesResponse.g.cs | 36 + .../Api/Security/GetPrivilegesRequest.g.cs | 104 + .../Api/Security/GetPrivilegesResponse.g.cs | 37 + .../Api/Security/GetRoleMappingRequest.g.cs | 94 + .../Api/Security/GetRoleMappingResponse.g.cs | 37 + .../Api/Security/GetRoleRequest.g.cs | 96 + .../Api/Security/GetRoleResponse.g.cs | 37 + .../Security/GetServiceAccountsRequest.g.cs | 104 + .../Security/GetServiceAccountsResponse.g.cs | 37 + .../GetServiceCredentialsRequest.g.cs | 92 + .../GetServiceCredentialsResponse.g.cs | 45 + .../Api/Security/GetTokenRequest.g.cs | 170 + .../Api/Security/GetTokenResponse.g.cs | 45 + .../Security/GetUserPrivilegesRequest.g.cs | 112 + .../Security/GetUserPrivilegesResponse.g.cs | 41 + .../Api/Security/GetUserProfileRequest.g.cs | 108 + .../Api/Security/GetUserProfileResponse.g.cs | 35 + .../Api/Security/GetUserRequest.g.cs | 110 + .../Api/Security/GetUserResponse.g.cs | 37 + .../Api/Security/GrantApiKeyRequest.g.cs | 484 ++ .../Api/Security/GrantApiKeyResponse.g.cs | 41 + .../Api/Security/HasPrivilegesRequest.g.cs | 272 + .../Api/Security/HasPrivilegesResponse.g.cs | 42 + .../HasPrivilegesUserProfileRequest.g.cs | 147 + .../HasPrivilegesUserProfileResponse.g.cs | 50 + .../Api/Security/InvalidateApiKeyRequest.g.cs | 277 + .../Security/InvalidateApiKeyResponse.g.cs | 39 + .../Api/Security/InvalidateTokenRequest.g.cs | 140 + .../Api/Security/InvalidateTokenResponse.g.cs | 39 + .../Api/Security/PutPrivilegesRequest.g.cs | 109 + .../Api/Security/PutPrivilegesResponse.g.cs | 37 + .../Api/Security/PutRoleMappingRequest.g.cs | 283 + .../Api/Security/PutRoleMappingResponse.g.cs | 35 + .../Api/Security/PutRoleRequest.g.cs | 729 ++ .../Api/Security/PutRoleResponse.g.cs | 33 + .../Api/Security/PutUserRequest.g.cs | 215 + .../Api/Security/PutUserResponse.g.cs | 33 + .../Api/Security/QueryApiKeysRequest.g.cs | 745 ++ .../Api/Security/QueryApiKeysResponse.g.cs | 62 + .../Api/Security/QueryUserRequest.g.cs | 546 ++ .../Api/Security/QueryUserResponse.g.cs | 54 + .../Api/Security/SamlAuthenticateRequest.g.cs | 149 + .../Security/SamlAuthenticateResponse.g.cs | 41 + .../Security/SamlCompleteLogoutRequest.g.cs | 175 + .../Security/SamlCompleteLogoutResponse.g.cs | 31 + .../Api/Security/SamlInvalidateRequest.g.cs | 161 + .../Api/Security/SamlInvalidateResponse.g.cs | 37 + .../Api/Security/SamlLogoutRequest.g.cs | 131 + .../Api/Security/SamlLogoutResponse.g.cs | 33 + .../SamlPrepareAuthenticationRequest.g.cs | 163 + .../SamlPrepareAuthenticationResponse.g.cs | 37 + .../SamlServiceProviderMetadataRequest.g.cs | 86 + .../SamlServiceProviderMetadataResponse.g.cs | 33 + .../Security/SuggestUserProfilesRequest.g.cs | 228 + .../Security/SuggestUserProfilesResponse.g.cs | 37 + .../Api/Security/UpdateApiKeyRequest.g.cs | 295 + .../Api/Security/UpdateApiKeyResponse.g.cs | 39 + .../UpdateUserProfileDataRequest.g.cs | 197 + .../UpdateUserProfileDataResponse.g.cs | 38 + .../Client/ElasticsearchClient.Security.g.cs | 7163 +++++++++++++++++ .../Client/ElasticsearchClient.g.cs | 3 + .../Aggregations/CardinalityAggregation.g.cs | 1 + .../Aggregations/CompositeAggregation.g.cs | 1 + .../Aggregations/DateRangeAggregation.g.cs | 1 + .../Aggregations/MissingAggregation.g.cs | 1 + .../Types/Aggregations/RangeAggregation.g.cs | 1 + .../Types/Aggregations/TermsAggregation.g.cs | 1 + .../Aggregations/ValueCountAggregation.g.cs | 1 + .../Types/Enums/Enums.Security.g.cs | 345 + .../_Generated/Types/QueryDsl/BoolQuery.g.cs | 2 + .../Types/QueryDsl/ExistsQuery.g.cs | 2 + .../_Generated/Types/QueryDsl/IdsQuery.g.cs | 2 + .../Types/QueryDsl/MatchAllQuery.g.cs | 2 + .../_Generated/Types/QueryDsl/MatchQuery.g.cs | 2 + .../Types/QueryDsl/PrefixQuery.g.cs | 2 + .../QueryDsl/SimpleQueryStringQuery.g.cs | 2 + .../_Generated/Types/QueryDsl/TermQuery.g.cs | 2 + .../_Generated/Types/QueryDsl/TermsQuery.g.cs | 2 + .../Types/QueryDsl/WildcardQuery.g.cs | 2 + .../_Generated/Types/Security/ApiKey.g.cs | 133 + .../Types/Security/ApiKeyAggregation.g.cs | 452 ++ .../Security/ApiKeyFiltersAggregation.g.cs | 244 + .../Types/Security/ApiKeyQuery.g.cs | 384 + .../ApplicationGlobalUserPrivileges.g.cs | 93 + .../Types/Security/ApplicationPrivileges.g.cs | 113 + .../Security/ApplicationPrivilegesCheck.g.cs | 113 + .../Types/Security/AuthenticateToken.g.cs | 36 + .../Types/Security/AuthenticatedUser.g.cs | 54 + .../Security/AuthenticationProvider.g.cs | 36 + .../Types/Security/ClusterNode.g.cs | 34 + .../Types/Security/CreatedStatus.g.cs | 34 + .../_Generated/Types/Security/FieldRule.g.cs | 251 + .../Types/Security/FieldSecurity.g.cs | 122 + .../Types/Security/FoundStatus.g.cs | 34 + .../Types/Security/GetUserProfileErrors.g.cs | 36 + .../Types/Security/GlobalPrivilege.g.cs | 93 + .../Types/Security/GrantApiKey.g.cs | 231 + .../HasPrivilegesUserProfileErrors.g.cs | 36 + .../_Generated/Types/Security/Hint.g.cs | 103 + .../Types/Security/IndexPrivilegesCheck.g.cs | 121 + .../Types/Security/IndicesPrivileges.g.cs | 327 + .../Types/Security/KibanaToken.g.cs | 36 + .../Types/Security/ManageUserPrivileges.g.cs | 59 + .../Types/Security/NodesCredentials.g.cs | 47 + .../Security/NodesCredentialsFileToken.g.cs | 34 + .../Types/Security/PrivilegeActions.g.cs | 104 + .../Types/Security/PrivilegesCheck.g.cs | 220 + .../_Generated/Types/Security/QueryUser.g.cs | 48 + .../_Generated/Types/Security/RealmInfo.g.cs | 36 + .../_Generated/Types/Security/Role.g.cs | 48 + .../Types/Security/RoleDescriptor.g.cs | 856 ++ .../Types/Security/RoleDescriptorRead.g.cs | 160 + .../Types/Security/RoleDescriptorWrapper.g.cs | 34 + .../Types/Security/RoleMapping.g.cs | 42 + .../Types/Security/RoleMappingRule.g.cs | 272 + .../Types/Security/RoleTemplate.g.cs | 108 + .../Types/Security/ServiceToken.g.cs | 36 + .../Types/Security/TotalUserProfiles.g.cs | 36 + .../_Generated/Types/Security/User.g.cs | 46 + .../Types/Security/UserIndicesPrivileges.g.cs | 72 + .../Types/Security/UserProfile.g.cs | 42 + .../Security/UserProfileHitMetadata.g.cs | 36 + .../Types/Security/UserProfileUser.g.cs | 44 + .../Security/UserProfileWithMetadata.g.cs | 46 + .../_Generated/Types/Security/UserQuery.g.cs | 384 + .../_Generated/Types/Security/UserRealm.g.cs | 36 + 336 files changed, 45513 insertions(+), 1 deletion(-) create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.Security.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Security.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKey.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyAggregation.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticateToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticatedUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticationProvider.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/BulkError.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ClusterNode.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/CreatedStatus.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldRule.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldSecurity.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FoundStatus.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GetUserProfileErrors.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GlobalPrivilege.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GrantApiKey.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Hint.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndexPrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndicesPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ManageUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentials.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentialsFileToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegeActions.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryRole.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RealmInfo.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Role.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptor.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorRead.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorWrapper.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMapping.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMappingRule.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleTemplate.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ServiceToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/TotalUserProfiles.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserIndicesPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfile.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileHitMetadata.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileWithMetadata.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserRealm.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/ApiUrlLookup.g.cs index 9456e65f629..caf67257462 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/ApiUrlLookup.g.cs @@ -216,6 +216,53 @@ internal static class ApiUrlLookup internal static ApiUrls QueryRulesListRulesets = new ApiUrls(new[] { "_query_rules" }); internal static ApiUrls QueryRulesPutRule = new ApiUrls(new[] { "_query_rules/{ruleset_id}/_rule/{rule_id}" }); internal static ApiUrls QueryRulesPutRuleset = new ApiUrls(new[] { "_query_rules/{ruleset_id}" }); + internal static ApiUrls SecurityActivateUserProfile = new ApiUrls(new[] { "_security/profile/_activate" }); + internal static ApiUrls SecurityAuthenticate = new ApiUrls(new[] { "_security/_authenticate" }); + internal static ApiUrls SecurityBulkDeleteRole = new ApiUrls(new[] { "_security/role" }); + internal static ApiUrls SecurityBulkPutRole = new ApiUrls(new[] { "_security/role" }); + internal static ApiUrls SecurityClearApiKeyCache = new ApiUrls(new[] { "_security/api_key/{ids}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedPrivileges = new ApiUrls(new[] { "_security/privilege/{application}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedRealms = new ApiUrls(new[] { "_security/realm/{realms}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedRoles = new ApiUrls(new[] { "_security/role/{name}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedServiceTokens = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}/_clear_cache" }); + internal static ApiUrls SecurityCreateApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityCreateServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}", "_security/service/{namespace}/{service}/credential/token" }); + internal static ApiUrls SecurityDeletePrivileges = new ApiUrls(new[] { "_security/privilege/{application}/{name}" }); + internal static ApiUrls SecurityDeleteRole = new ApiUrls(new[] { "_security/role/{name}" }); + internal static ApiUrls SecurityDeleteRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" }); + internal static ApiUrls SecurityDeleteServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}" }); + internal static ApiUrls SecurityDisableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_disable" }); + internal static ApiUrls SecurityEnableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_enable" }); + internal static ApiUrls SecurityGetApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityGetBuiltinPrivileges = new ApiUrls(new[] { "_security/privilege/_builtin" }); + internal static ApiUrls SecurityGetPrivileges = new ApiUrls(new[] { "_security/privilege", "_security/privilege/{application}", "_security/privilege/{application}/{name}" }); + internal static ApiUrls SecurityGetRole = new ApiUrls(new[] { "_security/role/{name}", "_security/role" }); + internal static ApiUrls SecurityGetRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}", "_security/role_mapping" }); + internal static ApiUrls SecurityGetServiceAccounts = new ApiUrls(new[] { "_security/service/{namespace}/{service}", "_security/service/{namespace}", "_security/service" }); + internal static ApiUrls SecurityGetServiceCredentials = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential" }); + internal static ApiUrls SecurityGetToken = new ApiUrls(new[] { "_security/oauth2/token" }); + internal static ApiUrls SecurityGetUserPrivileges = new ApiUrls(new[] { "_security/user/_privileges" }); + internal static ApiUrls SecurityGetUserProfile = new ApiUrls(new[] { "_security/profile/{uid}" }); + internal static ApiUrls SecurityGrantApiKey = new ApiUrls(new[] { "_security/api_key/grant" }); + internal static ApiUrls SecurityHasPrivileges = new ApiUrls(new[] { "_security/user/_has_privileges", "_security/user/{user}/_has_privileges" }); + internal static ApiUrls SecurityHasPrivilegesUserProfile = new ApiUrls(new[] { "_security/profile/_has_privileges" }); + internal static ApiUrls SecurityInvalidateApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityInvalidateToken = new ApiUrls(new[] { "_security/oauth2/token" }); + internal static ApiUrls SecurityPutPrivileges = new ApiUrls(new[] { "_security/privilege" }); + internal static ApiUrls SecurityPutRole = new ApiUrls(new[] { "_security/role/{name}" }); + internal static ApiUrls SecurityPutRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" }); + internal static ApiUrls SecurityQueryApiKeys = new ApiUrls(new[] { "_security/_query/api_key" }); + internal static ApiUrls SecurityQueryRole = new ApiUrls(new[] { "_security/_query/role" }); + internal static ApiUrls SecurityQueryUser = new ApiUrls(new[] { "_security/_query/user" }); + internal static ApiUrls SecuritySamlAuthenticate = new ApiUrls(new[] { "_security/saml/authenticate" }); + internal static ApiUrls SecuritySamlCompleteLogout = new ApiUrls(new[] { "_security/saml/complete_logout" }); + internal static ApiUrls SecuritySamlInvalidate = new ApiUrls(new[] { "_security/saml/invalidate" }); + internal static ApiUrls SecuritySamlLogout = new ApiUrls(new[] { "_security/saml/logout" }); + internal static ApiUrls SecuritySamlPrepareAuthentication = new ApiUrls(new[] { "_security/saml/prepare" }); + internal static ApiUrls SecuritySamlServiceProviderMetadata = new ApiUrls(new[] { "_security/saml/metadata/{realm_name}" }); + internal static ApiUrls SecuritySuggestUserProfiles = new ApiUrls(new[] { "_security/profile/_suggest" }); + internal static ApiUrls SecurityUpdateApiKey = new ApiUrls(new[] { "_security/api_key/{id}" }); + internal static ApiUrls SecurityUpdateUserProfileData = new ApiUrls(new[] { "_security/profile/{uid}/_data" }); internal static ApiUrls SnapshotCleanupRepository = new ApiUrls(new[] { "_snapshot/{repository}/_cleanup" }); internal static ApiUrls SnapshotClone = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}" }); internal static ApiUrls SnapshotCreate = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}" }); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileRequest.g.cs new file mode 100644 index 00000000000..9b7d53c88ad --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileRequest.g.cs @@ -0,0 +1,136 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ActivateUserProfileRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates or updates a user profile on behalf of another user. +/// +/// +public sealed partial class ActivateUserProfileRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.activate_user_profile"; + + [JsonInclude, JsonPropertyName("access_token")] + public string? AccessToken { get; set; } + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Serverless.Security.GrantType GrantType { get; set; } + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + [JsonInclude, JsonPropertyName("username")] + public string? Username { get; set; } +} + +/// +/// +/// Creates or updates a user profile on behalf of another user. +/// +/// +public sealed partial class ActivateUserProfileRequestDescriptor : RequestDescriptor +{ + internal ActivateUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public ActivateUserProfileRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.activate_user_profile"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.GrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private string? UsernameValue { get; set; } + + public ActivateUserProfileRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + public ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Serverless.Security.GrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + public ActivateUserProfileRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + public ActivateUserProfileRequestDescriptor Username(string? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(UsernameValue)) + { + writer.WritePropertyName("username"); + writer.WriteStringValue(UsernameValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileResponse.g.cs new file mode 100644 index 00000000000..eef852bd9c6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ActivateUserProfileResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ActivateUserProfileResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("_doc")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserProfileHitMetadata Doc { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("last_synchronized")] + public long LastSynchronized { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateRequest.g.cs new file mode 100644 index 00000000000..8788e7dc1ed --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateRequest.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class AuthenticateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Authenticate a user. +/// Authenticates a user and returns information about the authenticated user. +/// Include the user information in a basic auth header. +/// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. +/// If the user cannot be authenticated, this API returns a 401 status code. +/// +/// +public sealed partial class AuthenticateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.authenticate"; +} + +/// +/// +/// Authenticate a user. +/// Authenticates a user and returns information about the authenticated user. +/// Include the user information in a basic auth header. +/// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. +/// If the user cannot be authenticated, this API returns a 401 status code. +/// +/// +public sealed partial class AuthenticateRequestDescriptor : RequestDescriptor +{ + internal AuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + + public AuthenticateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.authenticate"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateResponse.g.cs new file mode 100644 index 00000000000..653805273f8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/AuthenticateResponse.g.cs @@ -0,0 +1,53 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class AuthenticateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_key")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ApiKey? ApiKey { get; init; } + [JsonInclude, JsonPropertyName("authentication_realm")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RealmInfo AuthenticationRealm { get; init; } + [JsonInclude, JsonPropertyName("authentication_type")] + public string AuthenticationType { get; init; } + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("lookup_realm")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RealmInfo LookupRealm { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("token")] + public Elastic.Clients.Elasticsearch.Serverless.Security.AuthenticateToken? Token { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs new file mode 100644 index 00000000000..49545b0f963 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleRequest.g.cs @@ -0,0 +1,119 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class BulkDeleteRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The bulk delete roles API cannot delete roles that are defined in roles files. +/// +/// +public sealed partial class BulkDeleteRoleRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.bulk_delete_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// An array of role names to delete + /// + /// + [JsonInclude, JsonPropertyName("names")] + public ICollection Names { get; set; } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The bulk delete roles API cannot delete roles that are defined in roles files. +/// +/// +public sealed partial class BulkDeleteRoleRequestDescriptor : RequestDescriptor +{ + internal BulkDeleteRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public BulkDeleteRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.bulk_delete_role"; + + public BulkDeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + private ICollection NamesValue { get; set; } + + /// + /// + /// An array of role names to delete + /// + /// + public BulkDeleteRoleRequestDescriptor Names(ICollection names) + { + NamesValue = names; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs new file mode 100644 index 00000000000..4334b626ee3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkDeleteRoleResponse.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class BulkDeleteRoleResponse : ElasticsearchResponse +{ + /// + /// + /// Array of deleted roles + /// + /// + [JsonInclude, JsonPropertyName("deleted")] + public IReadOnlyCollection? Deleted { get; init; } + + /// + /// + /// Present if any deletes resulted in errors + /// + /// + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Serverless.Security.BulkError? Errors { get; init; } + + /// + /// + /// Array of roles that could not be found + /// + /// + [JsonInclude, JsonPropertyName("not_found")] + public IReadOnlyCollection? NotFound { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleRequest.g.cs new file mode 100644 index 00000000000..0a15f6d6413 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleRequest.g.cs @@ -0,0 +1,165 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class BulkPutRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The bulk create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class BulkPutRoleRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.bulk_put_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + [JsonInclude, JsonPropertyName("roles")] + public IDictionary Roles { get; set; } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The bulk create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class BulkPutRoleRequestDescriptor : RequestDescriptor, BulkPutRoleRequestParameters> +{ + internal BulkPutRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + + public BulkPutRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.bulk_put_role"; + + public BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + private IDictionary> RolesValue { get; set; } + + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public BulkPutRoleRequestDescriptor Roles(Func>, FluentDescriptorDictionary>> selector) + { + RolesValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("roles"); + JsonSerializer.Serialize(writer, RolesValue, options); + writer.WriteEndObject(); + } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The bulk create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class BulkPutRoleRequestDescriptor : RequestDescriptor +{ + internal BulkPutRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public BulkPutRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityBulkPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.bulk_put_role"; + + public BulkPutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + private IDictionary RolesValue { get; set; } + + /// + /// + /// A dictionary of role name to RoleDescriptor objects to add or update + /// + /// + public BulkPutRoleRequestDescriptor Roles(Func, FluentDescriptorDictionary> selector) + { + RolesValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("roles"); + JsonSerializer.Serialize(writer, RolesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleResponse.g.cs new file mode 100644 index 00000000000..85ff7db5a44 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/BulkPutRoleResponse.g.cs @@ -0,0 +1,62 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class BulkPutRoleResponse : ElasticsearchResponse +{ + /// + /// + /// Array of created roles + /// + /// + [JsonInclude, JsonPropertyName("created")] + public IReadOnlyCollection? Created { get; init; } + + /// + /// + /// Present if any updates resulted in errors + /// + /// + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Serverless.Security.BulkError? Errors { get; init; } + + /// + /// + /// Array of role names without any changes + /// + /// + [JsonInclude, JsonPropertyName("noop")] + public IReadOnlyCollection? Noop { get; init; } + + /// + /// + /// Array of updated roles + /// + /// + [JsonInclude, JsonPropertyName("updated")] + public IReadOnlyCollection? Updated { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs new file mode 100644 index 00000000000..4647a129f1b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs @@ -0,0 +1,88 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearApiKeyCacheRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts a subset of all entries from the API key cache. +/// The cache is also automatically cleared on state changes of the security index. +/// +/// +public sealed partial class ClearApiKeyCacheRequest : PlainRequest +{ + public ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Serverless.Ids ids) : base(r => r.Required("ids", ids)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_api_key_cache"; +} + +/// +/// +/// Evicts a subset of all entries from the API key cache. +/// The cache is also automatically cleared on state changes of the security index. +/// +/// +public sealed partial class ClearApiKeyCacheRequestDescriptor : RequestDescriptor +{ + internal ClearApiKeyCacheRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Ids ids) : base(r => r.Required("ids", ids)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_api_key_cache"; + + public ClearApiKeyCacheRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.Ids ids) + { + RouteValues.Required("ids", ids); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs new file mode 100644 index 00000000000..e7dd4705bee --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearApiKeyCacheResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs new file mode 100644 index 00000000000..cef156ee080 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts application privileges from the native application privileges cache. +/// +/// +public sealed partial class ClearCachedPrivilegesRequest : PlainRequest +{ + public ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Serverless.Name application) : base(r => r.Required("application", application)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_privileges"; +} + +/// +/// +/// Evicts application privileges from the native application privileges cache. +/// +/// +public sealed partial class ClearCachedPrivilegesRequestDescriptor : RequestDescriptor +{ + internal ClearCachedPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name application) : base(r => r.Required("application", application)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_privileges"; + + public ClearCachedPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Name application) + { + RouteValues.Required("application", application); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs new file mode 100644 index 00000000000..80153dbf93b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs new file mode 100644 index 00000000000..38ff7ca998b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedRealmsRequestParameters : RequestParameters +{ + /// + /// + /// Comma-separated list of usernames to clear from the cache + /// + /// + public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } +} + +/// +/// +/// Evicts users from the user cache. Can completely clear the cache or evict specific users. +/// +/// +public sealed partial class ClearCachedRealmsRequest : PlainRequest +{ + public ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Serverless.Names realms) : base(r => r.Required("realms", realms)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_realms"; + + /// + /// + /// Comma-separated list of usernames to clear from the cache + /// + /// + [JsonIgnore] + public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } +} + +/// +/// +/// Evicts users from the user cache. Can completely clear the cache or evict specific users. +/// +/// +public sealed partial class ClearCachedRealmsRequestDescriptor : RequestDescriptor +{ + internal ClearCachedRealmsRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Names realms) : base(r => r.Required("realms", realms)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_realms"; + + public ClearCachedRealmsRequestDescriptor Usernames(ICollection? usernames) => Qs("usernames", usernames); + + public ClearCachedRealmsRequestDescriptor Realms(Elastic.Clients.Elasticsearch.Serverless.Names realms) + { + RouteValues.Required("realms", realms); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs new file mode 100644 index 00000000000..efe1c3411eb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedRealmsResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesRequest.g.cs new file mode 100644 index 00000000000..38e07e69001 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedRolesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts roles from the native role cache. +/// +/// +public sealed partial class ClearCachedRolesRequest : PlainRequest +{ + public ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_roles"; +} + +/// +/// +/// Evicts roles from the native role cache. +/// +/// +public sealed partial class ClearCachedRolesRequestDescriptor : RequestDescriptor +{ + internal ClearCachedRolesRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_roles"; + + public ClearCachedRolesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesResponse.g.cs new file mode 100644 index 00000000000..e28b91f8337 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedRolesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedRolesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs new file mode 100644 index 00000000000..5bb0d3a44d7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs @@ -0,0 +1,98 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedServiceTokensRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts tokens from the service account token caches. +/// +/// +public sealed partial class ClearCachedServiceTokensRequest : PlainRequest +{ + public ClearCachedServiceTokensRequest(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_service_tokens"; +} + +/// +/// +/// Evicts tokens from the service account token caches. +/// +/// +public sealed partial class ClearCachedServiceTokensRequestDescriptor : RequestDescriptor +{ + internal ClearCachedServiceTokensRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedServiceTokensRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_service_tokens"; + + public ClearCachedServiceTokensRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + public ClearCachedServiceTokensRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public ClearCachedServiceTokensRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs new file mode 100644 index 00000000000..a97f7495f65 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClearCachedServiceTokensResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyRequest.g.cs new file mode 100644 index 00000000000..1eee8df99aa --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyRequest.g.cs @@ -0,0 +1,314 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class CreateApiKeyRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public Elastic.Clients.Elasticsearch.Serverless.Duration? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// Specifies the name for this API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Serverless.Name? Name { get; set; } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IDictionary? RoleDescriptors { get; set; } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor, CreateApiKeyRequestParameters> +{ + internal CreateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public CreateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + private Elastic.Clients.Elasticsearch.Serverless.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name? NameValue { get; set; } + private IDictionary> RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Serverless.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Specifies the name for this API key. + /// + /// + public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public CreateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor +{ + internal CreateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public CreateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + private Elastic.Clients.Elasticsearch.Serverless.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name? NameValue { get; set; } + private IDictionary RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Serverless.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Specifies the name for this API key. + /// + /// + public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public CreateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyResponse.g.cs new file mode 100644 index 00000000000..841689b990c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateApiKeyResponse.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class CreateApiKeyResponse : ElasticsearchResponse +{ + /// + /// + /// Generated API key. + /// + /// + [JsonInclude, JsonPropertyName("api_key")] + public string ApiKey { get; init; } + + /// + /// + /// API key credentials which is the base64-encoding of + /// the UTF-8 representation of id and api_key joined + /// by a colon (:). + /// + /// + [JsonInclude, JsonPropertyName("encoded")] + public string Encoded { get; init; } + + /// + /// + /// Expiration in milliseconds for the API key. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + + /// + /// + /// Unique ID for this API key. + /// + /// + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + + /// + /// + /// Specifies the name for this API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenRequest.g.cs new file mode 100644 index 00000000000..fd4f499ab0a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenRequest.g.cs @@ -0,0 +1,122 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class CreateServiceTokenRequestParameters : RequestParameters +{ + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates a service accounts token for access without requiring basic authentication. +/// +/// +public sealed partial class CreateServiceTokenRequest : PlainRequest +{ + public CreateServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + { + } + + public CreateServiceTokenRequest(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.create_service_token"; + + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates a service accounts token for access without requiring basic authentication. +/// +/// +public sealed partial class CreateServiceTokenRequestDescriptor : RequestDescriptor +{ + internal CreateServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public CreateServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + { + } + + public CreateServiceTokenRequestDescriptor(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.create_service_token"; + + public CreateServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public CreateServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) + { + RouteValues.Optional("name", name); + return Self; + } + + public CreateServiceTokenRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public CreateServiceTokenRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenResponse.g.cs new file mode 100644 index 00000000000..14ddc24ddc3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/CreateServiceTokenResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class CreateServiceTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("created")] + public bool Created { get; init; } + [JsonInclude, JsonPropertyName("token")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ServiceToken Token { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesRequest.g.cs new file mode 100644 index 00000000000..3ba1aaaa1cf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesRequest.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeletePrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes application privileges. +/// +/// +public sealed partial class DeletePrivilegesRequest : PlainRequest +{ + public DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Serverless.Name application, Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("application", application).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_privileges"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes application privileges. +/// +/// +public sealed partial class DeletePrivilegesRequestDescriptor : RequestDescriptor +{ + internal DeletePrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name application, Elastic.Clients.Elasticsearch.Serverless.Names name) : base(r => r.Required("application", application).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_privileges"; + + public DeletePrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public DeletePrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Name application) + { + RouteValues.Required("application", application); + return Self; + } + + public DeletePrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesResponse.g.cs new file mode 100644 index 00000000000..71fa169150a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeletePrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeletePrivilegesResponse : DictionaryResponse> +{ + public DeletePrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public DeletePrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs new file mode 100644 index 00000000000..b9f237e97a6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteRoleMappingRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes role mappings. +/// +/// +public sealed partial class DeleteRoleMappingRequest : PlainRequest +{ + public DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role_mapping"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes role mappings. +/// +/// +public sealed partial class DeleteRoleMappingRequestDescriptor : RequestDescriptor +{ + internal DeleteRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role_mapping"; + + public DeleteRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs new file mode 100644 index 00000000000..69ec38d8224 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteRoleMappingResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleRequest.g.cs new file mode 100644 index 00000000000..50ac48cefc1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes roles in the native realm. +/// +/// +public sealed partial class DeleteRoleRequest : PlainRequest +{ + public DeleteRoleRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes roles in the native realm. +/// +/// +public sealed partial class DeleteRoleRequestDescriptor : RequestDescriptor +{ + internal DeleteRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role"; + + public DeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleResponse.g.cs new file mode 100644 index 00000000000..e7fc61a464e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteRoleResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteRoleResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs new file mode 100644 index 00000000000..11073804c2b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteServiceTokenRequestParameters : RequestParameters +{ + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes a service account token. +/// +/// +public sealed partial class DeleteServiceTokenRequest : PlainRequest +{ + public DeleteServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_service_token"; + + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes a service account token. +/// +/// +public sealed partial class DeleteServiceTokenRequestDescriptor : RequestDescriptor +{ + internal DeleteServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_service_token"; + + public DeleteServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + public DeleteServiceTokenRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public DeleteServiceTokenRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs new file mode 100644 index 00000000000..26b35f9f977 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DeleteServiceTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileRequest.g.cs new file mode 100644 index 00000000000..fc3ed9282be --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileRequest.g.cs @@ -0,0 +1,106 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DisableUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables a user profile so it's not visible in user profile searches. +/// +/// +public sealed partial class DisableUserProfileRequest : PlainRequest +{ + public DisableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user_profile"; + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables a user profile so it's not visible in user profile searches. +/// +/// +public sealed partial class DisableUserProfileRequestDescriptor : RequestDescriptor +{ + internal DisableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public DisableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user_profile"; + + public DisableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public DisableUserProfileRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileResponse.g.cs new file mode 100644 index 00000000000..13e6c139b7f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/DisableUserProfileResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class DisableUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileRequest.g.cs new file mode 100644 index 00000000000..2263cb4aa2b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileRequest.g.cs @@ -0,0 +1,106 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class EnableUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables a user profile so it's visible in user profile searches. +/// +/// +public sealed partial class EnableUserProfileRequest : PlainRequest +{ + public EnableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user_profile"; + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables a user profile so it's visible in user profile searches. +/// +/// +public sealed partial class EnableUserProfileRequestDescriptor : RequestDescriptor +{ + internal EnableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public EnableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user_profile"; + + public EnableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public EnableUserProfileRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileResponse.g.cs new file mode 100644 index 00000000000..4296ea9afc1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/EnableUserProfileResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class EnableUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyRequest.g.cs new file mode 100644 index 00000000000..ab5a750f0b6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyRequest.g.cs @@ -0,0 +1,228 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetApiKeyRequestParameters : RequestParameters +{ + /// + /// + /// A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as owner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. + /// + /// + public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } + + /// + /// + /// An API key id. + /// This parameter cannot be used with any of name, realm_name or username. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Id? Id { get => Q("id"); set => Q("id", value); } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of id, realm_name or username. + /// It supports prefix search with wildcard. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Name? Name { get => Q("name"); set => Q("name", value); } + + /// + /// + /// A boolean flag that can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + public bool? Owner { get => Q("owner"); set => Q("owner", value); } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Name? RealmName { get => Q("realm_name"); set => Q("realm_name", value); } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get => Q("username"); set => Q("username", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors + /// associated with the API key. An API key's actual + /// permission is the intersection of its assigned role + /// descriptors and the owner user's role descriptors. + /// + /// + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Get API key information. +/// Retrieves information for one or more API keys. +/// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. +/// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. +/// +/// +public sealed partial class GetApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_api_key"; + + /// + /// + /// A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as owner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. + /// + /// + [JsonIgnore] + public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } + + /// + /// + /// An API key id. + /// This parameter cannot be used with any of name, realm_name or username. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Id? Id { get => Q("id"); set => Q("id", value); } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of id, realm_name or username. + /// It supports prefix search with wildcard. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Name? Name { get => Q("name"); set => Q("name", value); } + + /// + /// + /// A boolean flag that can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + [JsonIgnore] + public bool? Owner { get => Q("owner"); set => Q("owner", value); } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Name? RealmName { get => Q("realm_name"); set => Q("realm_name", value); } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get => Q("username"); set => Q("username", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors + /// associated with the API key. An API key's actual + /// permission is the intersection of its assigned role + /// descriptors and the owner user's role descriptors. + /// + /// + [JsonIgnore] + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Get API key information. +/// Retrieves information for one or more API keys. +/// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. +/// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. +/// +/// +public sealed partial class GetApiKeyRequestDescriptor : RequestDescriptor +{ + internal GetApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_api_key"; + + public GetApiKeyRequestDescriptor ActiveOnly(bool? activeOnly = true) => Qs("active_only", activeOnly); + public GetApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Serverless.Id? id) => Qs("id", id); + public GetApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) => Qs("name", name); + public GetApiKeyRequestDescriptor Owner(bool? owner = true) => Qs("owner", owner); + public GetApiKeyRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Serverless.Name? realmName) => Qs("realm_name", realmName); + public GetApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) => Qs("username", username); + public GetApiKeyRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public GetApiKeyRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyResponse.g.cs new file mode 100644 index 00000000000..38a73ca81a9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetApiKeyResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_keys")] + public IReadOnlyCollection ApiKeys { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs new file mode 100644 index 00000000000..26bff95de4f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs @@ -0,0 +1,76 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetBuiltinPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. +/// +/// +public sealed partial class GetBuiltinPrivilegesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_builtin_privileges"; +} + +/// +/// +/// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. +/// +/// +public sealed partial class GetBuiltinPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetBuiltinPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetBuiltinPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_builtin_privileges"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs new file mode 100644 index 00000000000..36890a6be56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetBuiltinPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("index")] + [SingleOrManyCollectionConverter(typeof(string))] + public IReadOnlyCollection Indices { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesRequest.g.cs new file mode 100644 index 00000000000..ec87394ca9e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesRequest.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves application privileges. +/// +/// +public sealed partial class GetPrivilegesRequest : PlainRequest +{ + public GetPrivilegesRequest() + { + } + + public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serverless.Name? application) : base(r => r.Optional("application", application)) + { + } + + public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Serverless.Name? application, Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_privileges"; +} + +/// +/// +/// Retrieves application privileges. +/// +/// +public sealed partial class GetPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name? application, Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) + { + } + + public GetPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_privileges"; + + public GetPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Name? application) + { + RouteValues.Optional("application", application); + return Self; + } + + public GetPrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesResponse.g.cs new file mode 100644 index 00000000000..90136141d25 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetPrivilegesResponse : DictionaryResponse> +{ + public GetPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public GetPrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingRequest.g.cs new file mode 100644 index 00000000000..a1a2f9bf581 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingRequest.g.cs @@ -0,0 +1,94 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetRoleMappingRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves role mappings. +/// +/// +public sealed partial class GetRoleMappingRequest : PlainRequest +{ + public GetRoleMappingRequest() + { + } + + public GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role_mapping"; +} + +/// +/// +/// Retrieves role mappings. +/// +/// +public sealed partial class GetRoleMappingRequestDescriptor : RequestDescriptor +{ + internal GetRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("name", name)) + { + } + + public GetRoleMappingRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role_mapping"; + + public GetRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingResponse.g.cs new file mode 100644 index 00000000000..f7780fbe01a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleMappingResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetRoleMappingResponse : DictionaryResponse +{ + public GetRoleMappingResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetRoleMappingResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleRequest.g.cs new file mode 100644 index 00000000000..3b86f9ba8c9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleRequest.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetRoleRequestParameters : RequestParameters +{ +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The get roles API cannot retrieve roles that are defined in roles files. +/// +/// +public sealed partial class GetRoleRequest : PlainRequest +{ + public GetRoleRequest() + { + } + + public GetRoleRequest(Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role"; +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The get roles API cannot retrieve roles that are defined in roles files. +/// +/// +public sealed partial class GetRoleRequestDescriptor : RequestDescriptor +{ + internal GetRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Names? name) : base(r => r.Optional("name", name)) + { + } + + public GetRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role"; + + public GetRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleResponse.g.cs new file mode 100644 index 00000000000..4cca8aab744 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetRoleResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetRoleResponse : DictionaryResponse +{ + public GetRoleResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetRoleResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsRequest.g.cs new file mode 100644 index 00000000000..af9fd73de29 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsRequest.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetServiceAccountsRequestParameters : RequestParameters +{ +} + +/// +/// +/// This API returns a list of service accounts that match the provided path parameter(s). +/// +/// +public sealed partial class GetServiceAccountsRequest : PlainRequest +{ + public GetServiceAccountsRequest() + { + } + + public GetServiceAccountsRequest(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + { + } + + public GetServiceAccountsRequest(string? ns) : base(r => r.Optional("namespace", ns)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_accounts"; +} + +/// +/// +/// This API returns a list of service accounts that match the provided path parameter(s). +/// +/// +public sealed partial class GetServiceAccountsRequestDescriptor : RequestDescriptor +{ + internal GetServiceAccountsRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetServiceAccountsRequestDescriptor(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + { + } + + public GetServiceAccountsRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_accounts"; + + public GetServiceAccountsRequestDescriptor Namespace(string? ns) + { + RouteValues.Optional("namespace", ns); + return Self; + } + + public GetServiceAccountsRequestDescriptor Service(string? service) + { + RouteValues.Optional("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsResponse.g.cs new file mode 100644 index 00000000000..0a2df0874be --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceAccountsResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetServiceAccountsResponse : DictionaryResponse +{ + public GetServiceAccountsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetServiceAccountsResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs new file mode 100644 index 00000000000..f790f6794c9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs @@ -0,0 +1,92 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetServiceCredentialsRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves information of all service credentials for a service account. +/// +/// +public sealed partial class GetServiceCredentialsRequest : PlainRequest +{ + public GetServiceCredentialsRequest(string ns, Elastic.Clients.Elasticsearch.Serverless.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_credentials"; +} + +/// +/// +/// Retrieves information of all service credentials for a service account. +/// +/// +public sealed partial class GetServiceCredentialsRequestDescriptor : RequestDescriptor +{ + internal GetServiceCredentialsRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetServiceCredentialsRequestDescriptor(string ns, Elastic.Clients.Elasticsearch.Serverless.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_credentials"; + + public GetServiceCredentialsRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public GetServiceCredentialsRequestDescriptor Service(Elastic.Clients.Elasticsearch.Serverless.Name service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs new file mode 100644 index 00000000000..02af7395fcc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetServiceCredentialsResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// Contains service account credentials collected from all nodes of the cluster + /// + /// + [JsonInclude, JsonPropertyName("nodes_credentials")] + public Elastic.Clients.Elasticsearch.Serverless.Security.NodesCredentials NodesCredentials { get; init; } + [JsonInclude, JsonPropertyName("service_account")] + public string ServiceAccount { get; init; } + [JsonInclude, JsonPropertyName("tokens")] + public IReadOnlyDictionary> Tokens { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenRequest.g.cs new file mode 100644 index 00000000000..3b89a43486b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenRequest.g.cs @@ -0,0 +1,170 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetTokenRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates a bearer token for access without requiring basic authentication. +/// +/// +public sealed partial class GetTokenRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.get_token"; + + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Serverless.Security.AccessTokenGrantType? GrantType { get; set; } + [JsonInclude, JsonPropertyName("kerberos_ticket")] + public string? KerberosTicket { get; set; } + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + [JsonInclude, JsonPropertyName("scope")] + public string? Scope { get; set; } + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get; set; } +} + +/// +/// +/// Creates a bearer token for access without requiring basic authentication. +/// +/// +public sealed partial class GetTokenRequestDescriptor : RequestDescriptor +{ + internal GetTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetTokenRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.get_token"; + + private Elastic.Clients.Elasticsearch.Serverless.Security.AccessTokenGrantType? GrantTypeValue { get; set; } + private string? KerberosTicketValue { get; set; } + private string? PasswordValue { get; set; } + private string? RefreshTokenValue { get; set; } + private string? ScopeValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? UsernameValue { get; set; } + + public GetTokenRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Serverless.Security.AccessTokenGrantType? grantType) + { + GrantTypeValue = grantType; + return Self; + } + + public GetTokenRequestDescriptor KerberosTicket(string? kerberosTicket) + { + KerberosTicketValue = kerberosTicket; + return Self; + } + + public GetTokenRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + public GetTokenRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + public GetTokenRequestDescriptor Scope(string? scope) + { + ScopeValue = scope; + return Self; + } + + public GetTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (GrantTypeValue is not null) + { + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + } + + if (!string.IsNullOrEmpty(KerberosTicketValue)) + { + writer.WritePropertyName("kerberos_ticket"); + writer.WriteStringValue(KerberosTicketValue); + } + + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + if (!string.IsNullOrEmpty(ScopeValue)) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(ScopeValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenResponse.g.cs new file mode 100644 index 00000000000..36728c4b664 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetTokenResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("access_token")] + public string AccessToken { get; init; } + [JsonInclude, JsonPropertyName("authentication")] + public Elastic.Clients.Elasticsearch.Serverless.Security.AuthenticatedUser Authentication { get; init; } + [JsonInclude, JsonPropertyName("expires_in")] + public long ExpiresIn { get; init; } + [JsonInclude, JsonPropertyName("kerberos_authentication_response_token")] + public string? KerberosAuthenticationResponseToken { get; init; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; init; } + [JsonInclude, JsonPropertyName("scope")] + public string? Scope { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs new file mode 100644 index 00000000000..9b3f5475ff9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs @@ -0,0 +1,112 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetUserPrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Name? Application { get => Q("application"); set => Q("application", value); } + + /// + /// + /// The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Name? Priviledge { get => Q("priviledge"); set => Q("priviledge", value); } + public Elastic.Clients.Elasticsearch.Serverless.Name? Username { get => Q("username"); set => Q("username", value); } +} + +/// +/// +/// Retrieves security privileges for the logged in user. +/// +/// +public sealed partial class GetUserPrivilegesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_privileges"; + + /// + /// + /// The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Name? Application { get => Q("application"); set => Q("application", value); } + + /// + /// + /// The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Name? Priviledge { get => Q("priviledge"); set => Q("priviledge", value); } + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Name? Username { get => Q("username"); set => Q("username", value); } +} + +/// +/// +/// Retrieves security privileges for the logged in user. +/// +/// +public sealed partial class GetUserPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetUserPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetUserPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_privileges"; + + public GetUserPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Name? application) => Qs("application", application); + public GetUserPrivilegesRequestDescriptor Priviledge(Elastic.Clients.Elasticsearch.Serverless.Name? priviledge) => Qs("priviledge", priviledge); + public GetUserPrivilegesRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Name? username) => Qs("username", username); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs new file mode 100644 index 00000000000..308ab397b53 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetUserPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("applications")] + public IReadOnlyCollection Applications { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("global")] + public IReadOnlyCollection Global { get; init; } + [JsonInclude, JsonPropertyName("indices")] + public IReadOnlyCollection Indices { get; init; } + [JsonInclude, JsonPropertyName("run_as")] + public IReadOnlyCollection RunAs { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileRequest.g.cs new file mode 100644 index 00000000000..d1fdb32c053 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileRequest.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public ICollection? Data { get => Q?>("data"); set => Q("data", value); } +} + +/// +/// +/// Retrieves a user's profile using the unique profile ID. +/// +/// +public sealed partial class GetUserProfileRequest : PlainRequest +{ + public GetUserProfileRequest(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_profile"; + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + [JsonIgnore] + public ICollection? Data { get => Q?>("data"); set => Q("data", value); } +} + +/// +/// +/// Retrieves a user's profile using the unique profile ID. +/// +/// +public sealed partial class GetUserProfileRequestDescriptor : RequestDescriptor +{ + internal GetUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetUserProfileRequestDescriptor(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_profile"; + + public GetUserProfileRequestDescriptor Data(ICollection? data) => Qs("data", data); + + public GetUserProfileRequestDescriptor Uid(IReadOnlyCollection uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileResponse.g.cs new file mode 100644 index 00000000000..de77684beab --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GetUserProfileResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetUserProfileResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Serverless.Security.GetUserProfileErrors? Errors { get; init; } + [JsonInclude, JsonPropertyName("profiles")] + public IReadOnlyCollection Profiles { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyRequest.g.cs new file mode 100644 index 00000000000..dc869cec5ba --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyRequest.g.cs @@ -0,0 +1,484 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GrantApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("access_token")] + public string? AccessToken { get; set; } + + /// + /// + /// Defines the API key. + /// + /// + [JsonInclude, JsonPropertyName("api_key")] + public Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKey ApiKey { get; set; } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyGrantType GrantType { get; set; } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + [JsonInclude, JsonPropertyName("run_as")] + public Elastic.Clients.Elasticsearch.Serverless.Username? RunAs { get; set; } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get; set; } +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor, GrantApiKeyRequestParameters> +{ + internal GrantApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public GrantApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKey ApiKeyValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } + private Action> ApiKeyDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyGrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? RunAsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? UsernameValue { get; set; } + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + /// + /// + /// Defines the API key. + /// + /// + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKey apiKey) + { + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = null; + ApiKeyValue = apiKey; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor descriptor) + { + ApiKeyValue = null; + ApiKeyDescriptorAction = null; + ApiKeyDescriptor = descriptor; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Action> configure) + { + ApiKeyValue = null; + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = configure; + return Self; + } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyGrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Serverless.Username? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + if (ApiKeyDescriptor is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); + } + else if (ApiKeyDescriptorAction is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); + } + else + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyValue, options); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor +{ + internal GrantApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public GrantApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKey ApiKeyValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } + private Action ApiKeyDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyGrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? RunAsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? UsernameValue { get; set; } + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + /// + /// + /// Defines the API key. + /// + /// + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKey apiKey) + { + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = null; + ApiKeyValue = apiKey; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor descriptor) + { + ApiKeyValue = null; + ApiKeyDescriptorAction = null; + ApiKeyDescriptor = descriptor; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Action configure) + { + ApiKeyValue = null; + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = configure; + return Self; + } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyGrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Serverless.Username? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + if (ApiKeyDescriptor is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); + } + else if (ApiKeyDescriptorAction is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); + } + else + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyValue, options); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyResponse.g.cs new file mode 100644 index 00000000000..60f9d7f83b5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/GrantApiKeyResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GrantApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_key")] + public string ApiKey { get; init; } + [JsonInclude, JsonPropertyName("encoded")] + public string Encoded { get; init; } + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesRequest.g.cs new file mode 100644 index 00000000000..75358b5db25 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesRequest.g.cs @@ -0,0 +1,272 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class HasPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Check user privileges. +/// Determines whether the specified user has a specified list of privileges. +/// +/// +public sealed partial class HasPrivilegesRequest : PlainRequest +{ + public HasPrivilegesRequest() + { + } + + public HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Serverless.Name? user) : base(r => r.Optional("user", user)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges"; + + [JsonInclude, JsonPropertyName("application")] + public ICollection? Application { get; set; } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + [JsonInclude, JsonPropertyName("index")] + public ICollection? Index { get; set; } +} + +/// +/// +/// Check user privileges. +/// Determines whether the specified user has a specified list of privileges. +/// +/// +public sealed partial class HasPrivilegesRequestDescriptor : RequestDescriptor +{ + internal HasPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name? user) : base(r => r.Optional("user", user)) + { + } + + public HasPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges"; + + public HasPrivilegesRequestDescriptor User(Elastic.Clients.Elasticsearch.Serverless.Name? user) + { + RouteValues.Optional("user", user); + return Self; + } + + private ICollection? ApplicationValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } + private Action ApplicationDescriptorAction { get; set; } + private Action[] ApplicationDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private ICollection? IndexValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } + private Action IndexDescriptorAction { get; set; } + private Action[] IndexDescriptorActions { get; set; } + + public HasPrivilegesRequestDescriptor Application(ICollection? application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationValue = application; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorActions = null; + ApplicationDescriptorAction = configure; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(params Action[] configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public HasPrivilegesRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(ICollection? index) + { + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexValue = index; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor descriptor) + { + IndexValue = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexDescriptor = descriptor; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(Action configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorActions = null; + IndexDescriptorAction = configure; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(params Action[] configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorActions is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + foreach (var action in ApplicationDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationValue is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (IndexDescriptor is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndexDescriptor, options); + writer.WriteEndArray(); + } + else if (IndexDescriptorAction is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndexDescriptorActions is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + foreach (var action in IndexDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndexValue is not null) + { + writer.WritePropertyName("index"); + JsonSerializer.Serialize(writer, IndexValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesResponse.g.cs new file mode 100644 index 00000000000..4411a6e4215 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesResponse.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class HasPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("application")] + public IReadOnlyDictionary>> Application { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyDictionary Cluster { get; init; } + [JsonInclude, JsonPropertyName("has_all_requested")] + public bool HasAllRequested { get; init; } + [JsonInclude, JsonPropertyName("index")] + [ReadOnlyIndexNameDictionaryConverter(typeof(IReadOnlyDictionary))] + public IReadOnlyDictionary> Index { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs new file mode 100644 index 00000000000..3c691698789 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs @@ -0,0 +1,147 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class HasPrivilegesUserProfileRequestParameters : RequestParameters +{ +} + +/// +/// +/// Determines whether the users associated with the specified profile IDs have all the requested privileges. +/// +/// +public sealed partial class HasPrivilegesUserProfileRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges_user_profile"; + + [JsonInclude, JsonPropertyName("privileges")] + public Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheck Privileges { get; set; } + + /// + /// + /// A list of profile IDs. The privileges are checked for associated users of the profiles. + /// + /// + [JsonInclude, JsonPropertyName("uids")] + public ICollection Uids { get; set; } +} + +/// +/// +/// Determines whether the users associated with the specified profile IDs have all the requested privileges. +/// +/// +public sealed partial class HasPrivilegesUserProfileRequestDescriptor : RequestDescriptor +{ + internal HasPrivilegesUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public HasPrivilegesUserProfileRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges_user_profile"; + + private Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheck PrivilegesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheckDescriptor PrivilegesDescriptor { get; set; } + private Action PrivilegesDescriptorAction { get; set; } + private ICollection UidsValue { get; set; } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheck privileges) + { + PrivilegesDescriptor = null; + PrivilegesDescriptorAction = null; + PrivilegesValue = privileges; + return Self; + } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheckDescriptor descriptor) + { + PrivilegesValue = null; + PrivilegesDescriptorAction = null; + PrivilegesDescriptor = descriptor; + return Self; + } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Action configure) + { + PrivilegesValue = null; + PrivilegesDescriptor = null; + PrivilegesDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of profile IDs. The privileges are checked for associated users of the profiles. + /// + /// + public HasPrivilegesUserProfileRequestDescriptor Uids(ICollection uids) + { + UidsValue = uids; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (PrivilegesDescriptor is not null) + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesDescriptor, options); + } + else if (PrivilegesDescriptorAction is not null) + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.PrivilegesCheckDescriptor(PrivilegesDescriptorAction), options); + } + else + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + } + + writer.WritePropertyName("uids"); + JsonSerializer.Serialize(writer, UidsValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs new file mode 100644 index 00000000000..050f0f7f9b3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs @@ -0,0 +1,50 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class HasPrivilegesUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// The subset of the requested profile IDs for which an error + /// was encountered. It does not include the missing profile IDs + /// or the profile IDs of the users that do not have all the + /// requested privileges. This field is absent if empty. + /// + /// + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Serverless.Security.HasPrivilegesUserProfileErrors? Errors { get; init; } + + /// + /// + /// The subset of the requested profile IDs of the users that + /// have all the requested privileges. + /// + /// + [JsonInclude, JsonPropertyName("has_privilege_uids")] + public IReadOnlyCollection HasPrivilegeUids { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs new file mode 100644 index 00000000000..b07642ff132 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs @@ -0,0 +1,277 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class InvalidateApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Invalidate API keys. +/// Invalidates one or more API keys. +/// The manage_api_key privilege allows deleting any API keys. +/// The manage_own_api_key only allows deleting API keys that are owned by the user. +/// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: +/// +/// +/// +/// +/// Set the parameter owner=true. +/// +/// +/// +/// +/// Or, set both username and realm_name to match the user’s identity. +/// +/// +/// +/// +/// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. +/// +/// +/// +/// +public sealed partial class InvalidateApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_api_key"; + + [JsonInclude, JsonPropertyName("id")] + public Elastic.Clients.Elasticsearch.Serverless.Id? Id { get; set; } + + /// + /// + /// A list of API key ids. + /// This parameter cannot be used with any of name, realm_name, or username. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public ICollection? Ids { get; set; } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of ids, realm_name or username. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Serverless.Name? Name { get; set; } + + /// + /// + /// Can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + [JsonInclude, JsonPropertyName("owner")] + public bool? Owner { get; set; } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + [JsonInclude, JsonPropertyName("realm_name")] + public string? RealmName { get; set; } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get; set; } +} + +/// +/// +/// Invalidate API keys. +/// Invalidates one or more API keys. +/// The manage_api_key privilege allows deleting any API keys. +/// The manage_own_api_key only allows deleting API keys that are owned by the user. +/// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: +/// +/// +/// +/// +/// Set the parameter owner=true. +/// +/// +/// +/// +/// Or, set both username and realm_name to match the user’s identity. +/// +/// +/// +/// +/// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. +/// +/// +/// +/// +public sealed partial class InvalidateApiKeyRequestDescriptor : RequestDescriptor +{ + internal InvalidateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public InvalidateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_api_key"; + + private Elastic.Clients.Elasticsearch.Serverless.Id? IdValue { get; set; } + private ICollection? IdsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name? NameValue { get; set; } + private bool? OwnerValue { get; set; } + private string? RealmNameValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? UsernameValue { get; set; } + + public InvalidateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Serverless.Id? id) + { + IdValue = id; + return Self; + } + + /// + /// + /// A list of API key ids. + /// This parameter cannot be used with any of name, realm_name, or username. + /// + /// + public InvalidateApiKeyRequestDescriptor Ids(ICollection? ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of ids, realm_name or username. + /// + /// + public InvalidateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// Can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + public InvalidateApiKeyRequestDescriptor Owner(bool? owner = true) + { + OwnerValue = owner; + return Self; + } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + public InvalidateApiKeyRequestDescriptor RealmName(string? realmName) + { + RealmNameValue = realmName; + return Self; + } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + public InvalidateApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (IdValue is not null) + { + writer.WritePropertyName("id"); + JsonSerializer.Serialize(writer, IdValue, options); + } + + if (IdsValue is not null) + { + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (OwnerValue.HasValue) + { + writer.WritePropertyName("owner"); + writer.WriteBooleanValue(OwnerValue.Value); + } + + if (!string.IsNullOrEmpty(RealmNameValue)) + { + writer.WritePropertyName("realm_name"); + writer.WriteStringValue(RealmNameValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs new file mode 100644 index 00000000000..aa223f94def --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class InvalidateApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("error_count")] + public int ErrorCount { get; init; } + [JsonInclude, JsonPropertyName("error_details")] + public IReadOnlyCollection? ErrorDetails { get; init; } + [JsonInclude, JsonPropertyName("invalidated_api_keys")] + public IReadOnlyCollection InvalidatedApiKeys { get; init; } + [JsonInclude, JsonPropertyName("previously_invalidated_api_keys")] + public IReadOnlyCollection PreviouslyInvalidatedApiKeys { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenRequest.g.cs new file mode 100644 index 00000000000..1e65b16c9c9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenRequest.g.cs @@ -0,0 +1,140 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class InvalidateTokenRequestParameters : RequestParameters +{ +} + +/// +/// +/// Invalidates one or more access tokens or refresh tokens. +/// +/// +public sealed partial class InvalidateTokenRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_token"; + + [JsonInclude, JsonPropertyName("realm_name")] + public Elastic.Clients.Elasticsearch.Serverless.Name? RealmName { get; set; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + [JsonInclude, JsonPropertyName("token")] + public string? Token { get; set; } + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Serverless.Username? Username { get; set; } +} + +/// +/// +/// Invalidates one or more access tokens or refresh tokens. +/// +/// +public sealed partial class InvalidateTokenRequestDescriptor : RequestDescriptor +{ + internal InvalidateTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public InvalidateTokenRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_token"; + + private Elastic.Clients.Elasticsearch.Serverless.Name? RealmNameValue { get; set; } + private string? RefreshTokenValue { get; set; } + private string? TokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Username? UsernameValue { get; set; } + + public InvalidateTokenRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Serverless.Name? realmName) + { + RealmNameValue = realmName; + return Self; + } + + public InvalidateTokenRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + public InvalidateTokenRequestDescriptor Token(string? token) + { + TokenValue = token; + return Self; + } + + public InvalidateTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (RealmNameValue is not null) + { + writer.WritePropertyName("realm_name"); + JsonSerializer.Serialize(writer, RealmNameValue, options); + } + + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + if (!string.IsNullOrEmpty(TokenValue)) + { + writer.WritePropertyName("token"); + writer.WriteStringValue(TokenValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenResponse.g.cs new file mode 100644 index 00000000000..7d3014db840 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/InvalidateTokenResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class InvalidateTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("error_count")] + public long ErrorCount { get; init; } + [JsonInclude, JsonPropertyName("error_details")] + public IReadOnlyCollection? ErrorDetails { get; init; } + [JsonInclude, JsonPropertyName("invalidated_tokens")] + public long InvalidatedTokens { get; init; } + [JsonInclude, JsonPropertyName("previously_invalidated_tokens")] + public long PreviouslyInvalidatedTokens { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesRequest.g.cs new file mode 100644 index 00000000000..f3253850b85 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesRequest.g.cs @@ -0,0 +1,109 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutPrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Adds or updates application privileges. +/// +/// +public sealed partial class PutPrivilegesRequest : PlainRequest, ISelfSerializable +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_privileges"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + public Dictionary> Privileges { get; set; } + + void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, Privileges, options); + } +} + +/// +/// +/// Adds or updates application privileges. +/// +/// +public sealed partial class PutPrivilegesRequestDescriptor : RequestDescriptor, ISelfSerializable +{ + internal PutPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_privileges"; + + public PutPrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, _items, options); + } + + Dictionary> _items = new(); + + public PutPrivilegesRequestDescriptor AddPrivileges(string key, Dictionary value) + { + _items.Add(key, value); + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesResponse.g.cs new file mode 100644 index 00000000000..8e250b9a89d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutPrivilegesResponse : DictionaryResponse> +{ + public PutPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public PutPrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingRequest.g.cs new file mode 100644 index 00000000000..f0fd4a895c9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingRequest.g.cs @@ -0,0 +1,283 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutRoleMappingRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates and updates role mappings. +/// +/// +public sealed partial class PutRoleMappingRequest : PlainRequest +{ + public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role_mapping"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("roles")] + public ICollection? Roles { get; set; } + [JsonInclude, JsonPropertyName("role_templates")] + public ICollection? RoleTemplates { get; set; } + [JsonInclude, JsonPropertyName("rules")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule? Rules { get; set; } + [JsonInclude, JsonPropertyName("run_as")] + public ICollection? RunAs { get; set; } +} + +/// +/// +/// Creates and updates role mappings. +/// +/// +public sealed partial class PutRoleMappingRequestDescriptor : RequestDescriptor +{ + internal PutRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role_mapping"; + + public PutRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private bool? EnabledValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RolesValue { get; set; } + private ICollection? RoleTemplatesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleTemplateDescriptor RoleTemplatesDescriptor { get; set; } + private Action RoleTemplatesDescriptorAction { get; set; } + private Action[] RoleTemplatesDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule? RulesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRuleDescriptor RulesDescriptor { get; set; } + private Action RulesDescriptorAction { get; set; } + private ICollection? RunAsValue { get; set; } + + public PutRoleMappingRequestDescriptor Enabled(bool? enabled = true) + { + EnabledValue = enabled; + return Self; + } + + public PutRoleMappingRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PutRoleMappingRequestDescriptor Roles(ICollection? roles) + { + RolesValue = roles; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(ICollection? roleTemplates) + { + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesValue = roleTemplates; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(Elastic.Clients.Elasticsearch.Serverless.Security.RoleTemplateDescriptor descriptor) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesDescriptor = descriptor; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(Action configure) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesDescriptorAction = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(params Action[] configure) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule? rules) + { + RulesDescriptor = null; + RulesDescriptorAction = null; + RulesValue = rules; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRuleDescriptor descriptor) + { + RulesValue = null; + RulesDescriptorAction = null; + RulesDescriptor = descriptor; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Action configure) + { + RulesValue = null; + RulesDescriptor = null; + RulesDescriptorAction = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (EnabledValue.HasValue) + { + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(EnabledValue.Value); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RolesValue is not null) + { + writer.WritePropertyName("roles"); + JsonSerializer.Serialize(writer, RolesValue, options); + } + + if (RoleTemplatesDescriptor is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RoleTemplatesDescriptor, options); + writer.WriteEndArray(); + } + else if (RoleTemplatesDescriptorAction is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.RoleTemplateDescriptor(RoleTemplatesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RoleTemplatesDescriptorActions is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + foreach (var action in RoleTemplatesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.RoleTemplateDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (RoleTemplatesValue is not null) + { + writer.WritePropertyName("role_templates"); + JsonSerializer.Serialize(writer, RoleTemplatesValue, options); + } + + if (RulesDescriptor is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, RulesDescriptor, options); + } + else if (RulesDescriptorAction is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRuleDescriptor(RulesDescriptorAction), options); + } + else if (RulesValue is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, RulesValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingResponse.g.cs new file mode 100644 index 00000000000..df37b6dc402 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleMappingResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutRoleMappingResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("created")] + public bool? Created { get; init; } + [JsonInclude, JsonPropertyName("role_mapping")] + public Elastic.Clients.Elasticsearch.Serverless.Security.CreatedStatus RoleMapping { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleRequest.g.cs new file mode 100644 index 00000000000..93c7b54b71c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleRequest.g.cs @@ -0,0 +1,685 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequest : PlainRequest +{ + public PutRoleRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// A list of application privilege entries. + /// + /// + [JsonInclude, JsonPropertyName("applications")] + public ICollection? Applications { get; set; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + [JsonInclude, JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + [JsonInclude, JsonPropertyName("indices")] + public ICollection? Indices { get; set; } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + [JsonInclude, JsonPropertyName("run_as")] + public ICollection? RunAs { get; set; } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + [JsonInclude, JsonPropertyName("transient_metadata")] + public IDictionary? TransientMetadata { get; set; } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequestDescriptor : RequestDescriptor, PutRoleRequestParameters> +{ + internal PutRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action> IndicesDescriptorAction { get; set; } + private Action>[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries. + /// + /// + public PutRoleRequestDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public PutRoleRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public PutRoleRequestDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public PutRoleRequestDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Indices(Action> configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Indices(params Action>[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public PutRoleRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequestDescriptor : RequestDescriptor +{ + internal PutRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action IndicesDescriptorAction { get; set; } + private Action[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries. + /// + /// + public PutRoleRequestDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public PutRoleRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public PutRoleRequestDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public PutRoleRequestDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Indices(Action configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Indices(params Action[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public PutRoleRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleResponse.g.cs new file mode 100644 index 00000000000..a08aebbae71 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/PutRoleResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PutRoleResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("role")] + public Elastic.Clients.Elasticsearch.Serverless.Security.CreatedStatus Role { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysRequest.g.cs new file mode 100644 index 00000000000..4589cb5ef09 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysRequest.g.cs @@ -0,0 +1,745 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryApiKeysRequestParameters : RequestParameters +{ + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. + /// + /// + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +internal sealed partial class QueryApiKeysRequestConverter : JsonConverter +{ + public override QueryApiKeysRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new QueryApiKeysRequest(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "aggregations" || property == "aggs") + { + variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "from") + { + variant.From = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "query") + { + variant.Query = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "search_after") + { + variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "size") + { + variant.Size = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "sort") + { + variant.Sort = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, QueryApiKeysRequest value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + if (value.From.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(value.From.Value); + } + + if (value.Query is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, value.Query, options); + } + + if (value.SearchAfter is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, value.SearchAfter, options); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + if (value.Sort is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, value.Sort, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +[JsonConverter(typeof(QueryApiKeysRequestConverter))] +public sealed partial class QueryApiKeysRequest : PlainRequest +{ + public QueryApiKeysRequest() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + [JsonIgnore] + public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. + /// + /// + [JsonIgnore] + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public IDictionary? Aggregations { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("from")] + public int? From { get; set; } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery? Query { get; set; } + + /// + /// + /// Search after definition + /// + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public int? Size { get; set; } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.SortOptions))] + public ICollection? Sort { get; set; } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor, QueryApiKeysRequestParameters> +{ + internal QueryApiKeysRequestDescriptor(Action> configure) => configure.Invoke(this); + + public QueryApiKeysRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private IDictionary> AggregationsValue { get; set; } + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public QueryApiKeysRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor +{ + internal QueryApiKeysRequestDescriptor(Action configure) => configure.Invoke(this); + + public QueryApiKeysRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private IDictionary AggregationsValue { get; set; } + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public QueryApiKeysRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysResponse.g.cs new file mode 100644 index 00000000000..2b1dc469d1f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryApiKeysResponse.g.cs @@ -0,0 +1,62 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryApiKeysResponse : ElasticsearchResponse +{ + /// + /// + /// The aggregations result, if requested. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.AggregateDictionary? Aggregations { get; init; } + + /// + /// + /// A list of API key information. + /// + /// + [JsonInclude, JsonPropertyName("api_keys")] + public IReadOnlyCollection ApiKeys { get; init; } + + /// + /// + /// The number of API keys returned in the response. + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// The total number of API keys found. + /// + /// + [JsonInclude, JsonPropertyName("total")] + public int Total { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleRequest.g.cs new file mode 100644 index 00000000000..fffc62f9085 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleRequest.g.cs @@ -0,0 +1,531 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryRoleRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves roles in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryRoleRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_role"; + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("from")] + public int? From { get; set; } + + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, applications.resources. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery? Query { get; set; } + + /// + /// + /// Search after definition + /// + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public int? Size { get; set; } + + /// + /// + /// All public fields of a role are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.SortOptions))] + public ICollection? Sort { get; set; } +} + +/// +/// +/// Retrieves roles in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryRoleRequestDescriptor : RequestDescriptor, QueryRoleRequestParameters> +{ + internal QueryRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + + public QueryRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_role"; + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryRoleRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, applications.resources. + /// + /// + public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryRoleRequestDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryRoleRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryRoleRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// All public fields of a role are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryRoleRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryRoleRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryRoleRequestDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryRoleRequestDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Retrieves roles in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryRoleRequestDescriptor : RequestDescriptor +{ + internal QueryRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public QueryRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_role"; + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryRoleRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which roles to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with roles: name, description, metadata, + /// applications.application, applications.privileges, applications.resources. + /// + /// + public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryRoleRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryRoleRequestDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryRoleRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryRoleRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// All public fields of a role are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryRoleRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryRoleRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryRoleRequestDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryRoleRequestDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.RoleQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleResponse.g.cs new file mode 100644 index 00000000000..9d55064c136 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryRoleResponse.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryRoleResponse : ElasticsearchResponse +{ + /// + /// + /// The number of roles returned in the response. + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// The list of roles. + /// + /// + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + + /// + /// + /// The total number of roles found. + /// + /// + [JsonInclude, JsonPropertyName("total")] + public int Total { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserRequest.g.cs new file mode 100644 index 00000000000..68f7966e44d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserRequest.g.cs @@ -0,0 +1,546 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryUserRequestParameters : RequestParameters +{ + /// + /// + /// If true will return the User Profile ID for the users in the query result, if any. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + /// + /// + /// If true will return the User Profile ID for the users in the query result, if any. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("from")] + public int? From { get; set; } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery? Query { get; set; } + + /// + /// + /// Search after definition + /// + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public int? Size { get; set; } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.Serverless.SortOptions))] + public ICollection? Sort { get; set; } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequestDescriptor : RequestDescriptor, QueryUserRequestParameters> +{ + internal QueryUserRequestDescriptor(Action> configure) => configure.Invoke(this); + + public QueryUserRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryUserRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryUserRequestDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequestDescriptor : RequestDescriptor +{ + internal QueryUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public QueryUserRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryUserRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryUserRequestDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.UserQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserResponse.g.cs new file mode 100644 index 00000000000..adf3180f98f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/QueryUserResponse.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryUserResponse : ElasticsearchResponse +{ + /// + /// + /// The number of users returned in the response. + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// The total number of users found. + /// + /// + [JsonInclude, JsonPropertyName("total")] + public int Total { get; init; } + + /// + /// + /// A list of user information. + /// + /// + [JsonInclude, JsonPropertyName("users")] + public IReadOnlyCollection Users { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateRequest.g.cs new file mode 100644 index 00000000000..312f6abf4a7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateRequest.g.cs @@ -0,0 +1,149 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlAuthenticateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a SAML Response message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlAuthenticateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_authenticate"; + + /// + /// + /// The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. + /// + /// + [JsonInclude, JsonPropertyName("content")] + public string Content { get; set; } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public Elastic.Clients.Elasticsearch.Serverless.Ids Ids { get; set; } + + /// + /// + /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } +} + +/// +/// +/// Submits a SAML Response message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlAuthenticateRequestDescriptor : RequestDescriptor +{ + internal SamlAuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlAuthenticateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_authenticate"; + + private string ContentValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Ids IdsValue { get; set; } + private string? RealmValue { get; set; } + + /// + /// + /// The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. + /// + /// + public SamlAuthenticateRequestDescriptor Content(string content) + { + ContentValue = content; + return Self; + } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + public SamlAuthenticateRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.Ids ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. + /// + /// + public SamlAuthenticateRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("content"); + writer.WriteStringValue(ContentValue); + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateResponse.g.cs new file mode 100644 index 00000000000..9ba0d7b25de --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlAuthenticateResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlAuthenticateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("access_token")] + public string AccessToken { get; init; } + [JsonInclude, JsonPropertyName("expires_in")] + public int ExpiresIn { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string RefreshToken { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs new file mode 100644 index 00000000000..a12629e4ba2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs @@ -0,0 +1,175 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlCompleteLogoutRequestParameters : RequestParameters +{ +} + +/// +/// +/// Verifies the logout response sent from the SAML IdP. +/// +/// +public sealed partial class SamlCompleteLogoutRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_complete_logout"; + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. + /// + /// + [JsonInclude, JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public Elastic.Clients.Elasticsearch.Serverless.Ids Ids { get; set; } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. + /// + /// + [JsonInclude, JsonPropertyName("query_string")] + public string? QueryString { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; set; } +} + +/// +/// +/// Verifies the logout response sent from the SAML IdP. +/// +/// +public sealed partial class SamlCompleteLogoutRequestDescriptor : RequestDescriptor +{ + internal SamlCompleteLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlCompleteLogoutRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_complete_logout"; + + private string? ContentValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Ids IdsValue { get; set; } + private string? QueryStringValue { get; set; } + private string RealmValue { get; set; } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. + /// + /// + public SamlCompleteLogoutRequestDescriptor Content(string? content) + { + ContentValue = content; + return Self; + } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + public SamlCompleteLogoutRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.Ids ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. + /// + /// + public SamlCompleteLogoutRequestDescriptor QueryString(string? queryString) + { + QueryStringValue = queryString; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. + /// + /// + public SamlCompleteLogoutRequestDescriptor Realm(string realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContentValue)) + { + writer.WritePropertyName("content"); + writer.WriteStringValue(ContentValue); + } + + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + if (!string.IsNullOrEmpty(QueryStringValue)) + { + writer.WritePropertyName("query_string"); + writer.WriteStringValue(QueryStringValue); + } + + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs new file mode 100644 index 00000000000..704c8499723 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlCompleteLogoutResponse : ElasticsearchResponse +{ +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateRequest.g.cs new file mode 100644 index 00000000000..cf7be1c7b05 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateRequest.g.cs @@ -0,0 +1,161 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlInvalidateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a SAML LogoutRequest message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlInvalidateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_invalidate"; + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. + /// + /// + [JsonInclude, JsonPropertyName("acs")] + public string? Acs { get; set; } + + /// + /// + /// The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. + /// This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. + /// If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. + /// In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. + /// The client application must not attempt to parse or process the string in any way. + /// + /// + [JsonInclude, JsonPropertyName("query_string")] + public string QueryString { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } +} + +/// +/// +/// Submits a SAML LogoutRequest message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlInvalidateRequestDescriptor : RequestDescriptor +{ + internal SamlInvalidateRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlInvalidateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_invalidate"; + + private string? AcsValue { get; set; } + private string QueryStringValue { get; set; } + private string? RealmValue { get; set; } + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. + /// + /// + public SamlInvalidateRequestDescriptor Acs(string? acs) + { + AcsValue = acs; + return Self; + } + + /// + /// + /// The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. + /// This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. + /// If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. + /// In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. + /// The client application must not attempt to parse or process the string in any way. + /// + /// + public SamlInvalidateRequestDescriptor QueryString(string queryString) + { + QueryStringValue = queryString; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. + /// + /// + public SamlInvalidateRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AcsValue)) + { + writer.WritePropertyName("acs"); + writer.WriteStringValue(AcsValue); + } + + writer.WritePropertyName("query_string"); + writer.WriteStringValue(QueryStringValue); + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateResponse.g.cs new file mode 100644 index 00000000000..41fa0eb26b9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlInvalidateResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlInvalidateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("invalidated")] + public int Invalidated { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutRequest.g.cs new file mode 100644 index 00000000000..cd2b87084c8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutRequest.g.cs @@ -0,0 +1,131 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlLogoutRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a request to invalidate an access token and refresh token. +/// +/// +public sealed partial class SamlLogoutRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_logout"; + + /// + /// + /// The refresh token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent refresh token that was received after refreshing the original access token. + /// + /// + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + + /// + /// + /// The access token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. + /// + /// + [JsonInclude, JsonPropertyName("token")] + public string Token { get; set; } +} + +/// +/// +/// Submits a request to invalidate an access token and refresh token. +/// +/// +public sealed partial class SamlLogoutRequestDescriptor : RequestDescriptor +{ + internal SamlLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlLogoutRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_logout"; + + private string? RefreshTokenValue { get; set; } + private string TokenValue { get; set; } + + /// + /// + /// The refresh token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent refresh token that was received after refreshing the original access token. + /// + /// + public SamlLogoutRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + /// + /// + /// The access token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. + /// + /// + public SamlLogoutRequestDescriptor Token(string token) + { + TokenValue = token; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + writer.WritePropertyName("token"); + writer.WriteStringValue(TokenValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutResponse.g.cs new file mode 100644 index 00000000000..0d354b5df3a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlLogoutResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlLogoutResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs new file mode 100644 index 00000000000..6a4c33b6a6f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs @@ -0,0 +1,163 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlPrepareAuthenticationRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +/// +/// +public sealed partial class SamlPrepareAuthenticationRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_prepare_authentication"; + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. + /// The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. + /// + /// + [JsonInclude, JsonPropertyName("acs")] + public string? Acs { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. + /// You must specify either this parameter or the acs parameter. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } + + /// + /// + /// A string that will be included in the redirect URL that this API returns as the RelayState query parameter. + /// If the Authentication Request is signed, this value is used as part of the signature computation. + /// + /// + [JsonInclude, JsonPropertyName("relay_state")] + public string? RelayState { get; set; } +} + +/// +/// +/// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +/// +/// +public sealed partial class SamlPrepareAuthenticationRequestDescriptor : RequestDescriptor +{ + internal SamlPrepareAuthenticationRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlPrepareAuthenticationRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_prepare_authentication"; + + private string? AcsValue { get; set; } + private string? RealmValue { get; set; } + private string? RelayStateValue { get; set; } + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. + /// The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor Acs(string? acs) + { + AcsValue = acs; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. + /// You must specify either this parameter or the acs parameter. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + /// + /// + /// A string that will be included in the redirect URL that this API returns as the RelayState query parameter. + /// If the Authentication Request is signed, this value is used as part of the signature computation. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor RelayState(string? relayState) + { + RelayStateValue = relayState; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AcsValue)) + { + writer.WritePropertyName("acs"); + writer.WriteStringValue(AcsValue); + } + + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + if (!string.IsNullOrEmpty(RelayStateValue)) + { + writer.WritePropertyName("relay_state"); + writer.WriteStringValue(RelayStateValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs new file mode 100644 index 00000000000..892f9c1435b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlPrepareAuthenticationResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs new file mode 100644 index 00000000000..de2a004a00a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlServiceProviderMetadataRequestParameters : RequestParameters +{ +} + +/// +/// +/// Generate SAML metadata for a SAML 2.0 Service Provider. +/// +/// +public sealed partial class SamlServiceProviderMetadataRequest : PlainRequest +{ + public SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Serverless.Name realmName) : base(r => r.Required("realm_name", realmName)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.saml_service_provider_metadata"; +} + +/// +/// +/// Generate SAML metadata for a SAML 2.0 Service Provider. +/// +/// +public sealed partial class SamlServiceProviderMetadataRequestDescriptor : RequestDescriptor +{ + internal SamlServiceProviderMetadataRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name realmName) : base(r => r.Required("realm_name", realmName)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.saml_service_provider_metadata"; + + public SamlServiceProviderMetadataRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Serverless.Name realmName) + { + RouteValues.Required("realm_name", realmName); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs new file mode 100644 index 00000000000..05aec4d42a5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SamlServiceProviderMetadataResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("metadata")] + public string Metadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs new file mode 100644 index 00000000000..889d901e195 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs @@ -0,0 +1,228 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SuggestUserProfilesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Get suggestions for user profiles that match specified search criteria. +/// +/// +public sealed partial class SuggestUserProfilesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.suggest_user_profiles"; + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + [JsonInclude, JsonPropertyName("data")] + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Data { get; set; } + + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint don't exclude the profile from the response + /// as long as the profile matches the name field query. + /// + /// + [JsonInclude, JsonPropertyName("hint")] + public Elastic.Clients.Elasticsearch.Serverless.Security.Hint? Hint { get; set; } + + /// + /// + /// Query string used to match name-related fields in user profile documents. + /// Name-related fields are the user's username, full_name, and email. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// + /// Number of profiles to return. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public long? Size { get; set; } +} + +/// +/// +/// Get suggestions for user profiles that match specified search criteria. +/// +/// +public sealed partial class SuggestUserProfilesRequestDescriptor : RequestDescriptor +{ + internal SuggestUserProfilesRequestDescriptor(Action configure) => configure.Invoke(this); + + public SuggestUserProfilesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.suggest_user_profiles"; + + private ICollection? DataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.Hint? HintValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.HintDescriptor HintDescriptor { get; set; } + private Action HintDescriptorAction { get; set; } + private string? NameValue { get; set; } + private long? SizeValue { get; set; } + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public SuggestUserProfilesRequestDescriptor Data(ICollection? data) + { + DataValue = data; + return Self; + } + + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint don't exclude the profile from the response + /// as long as the profile matches the name field query. + /// + /// + public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Serverless.Security.Hint? hint) + { + HintDescriptor = null; + HintDescriptorAction = null; + HintValue = hint; + return Self; + } + + public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Serverless.Security.HintDescriptor descriptor) + { + HintValue = null; + HintDescriptorAction = null; + HintDescriptor = descriptor; + return Self; + } + + public SuggestUserProfilesRequestDescriptor Hint(Action configure) + { + HintValue = null; + HintDescriptor = null; + HintDescriptorAction = configure; + return Self; + } + + /// + /// + /// Query string used to match name-related fields in user profile documents. + /// Name-related fields are the user's username, full_name, and email. + /// + /// + public SuggestUserProfilesRequestDescriptor Name(string? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// Number of profiles to return. + /// + /// + public SuggestUserProfilesRequestDescriptor Size(long? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DataValue is not null) + { + writer.WritePropertyName("data"); + SingleOrManySerializationHelper.Serialize(DataValue, writer, options); + } + + if (HintDescriptor is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, HintDescriptor, options); + } + else if (HintDescriptorAction is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.HintDescriptor(HintDescriptorAction), options); + } + else if (HintValue is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, HintValue, options); + } + + if (!string.IsNullOrEmpty(NameValue)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(NameValue); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs new file mode 100644 index 00000000000..3ec3181c5a7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class SuggestUserProfilesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("profiles")] + public IReadOnlyCollection Profiles { get; init; } + [JsonInclude, JsonPropertyName("took")] + public long Took { get; init; } + [JsonInclude, JsonPropertyName("total")] + public Elastic.Clients.Elasticsearch.Serverless.Security.TotalUserProfiles Total { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyRequest.g.cs new file mode 100644 index 00000000000..cc892285e51 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyRequest.g.cs @@ -0,0 +1,295 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UpdateApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequest : PlainRequest +{ + public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Serverless.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + /// + /// + /// Expiration time for the API key. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public Elastic.Clients.Elasticsearch.Serverless.Duration? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IDictionary? RoleDescriptors { get; set; } +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor, UpdateApiKeyRequestParameters> +{ + internal UpdateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Serverless.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Elastic.Clients.Elasticsearch.Serverless.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private IDictionary> RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. + /// + /// + public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Serverless.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public UpdateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor +{ + internal UpdateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Serverless.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Elastic.Clients.Elasticsearch.Serverless.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private IDictionary RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. + /// + /// + public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Serverless.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public UpdateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyResponse.g.cs new file mode 100644 index 00000000000..c9a0279b423 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateApiKeyResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UpdateApiKeyResponse : ElasticsearchResponse +{ + /// + /// + /// If true, the API key was updated. + /// If false, the API key didn’t change because no change was detected. + /// + /// + [JsonInclude, JsonPropertyName("updated")] + public bool Updated { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs new file mode 100644 index 00000000000..80213bcee15 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs @@ -0,0 +1,197 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Requests; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UpdateUserProfileDataRequestParameters : RequestParameters +{ + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Updates specific data for the user profile that's associated with the specified unique ID. +/// +/// +public sealed partial class UpdateUserProfileDataRequest : PlainRequest +{ + public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_user_profile_data"; + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + [JsonIgnore] + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + [JsonIgnore] + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Serverless.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// + /// + [JsonInclude, JsonPropertyName("data")] + public IDictionary? Data { get; set; } + + /// + /// + /// Searchable data that you want to associate with the user profile. This + /// field supports a nested data structure. + /// + /// + [JsonInclude, JsonPropertyName("labels")] + public IDictionary? Labels { get; set; } +} + +/// +/// +/// Updates specific data for the user profile that's associated with the specified unique ID. +/// +/// +public sealed partial class UpdateUserProfileDataRequestDescriptor : RequestDescriptor +{ + internal UpdateUserProfileDataRequestDescriptor(Action configure) => configure.Invoke(this); + + public UpdateUserProfileDataRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_user_profile_data"; + + public UpdateUserProfileDataRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); + public UpdateUserProfileDataRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); + public UpdateUserProfileDataRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Serverless.Refresh? refresh) => Qs("refresh", refresh); + + public UpdateUserProfileDataRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + private IDictionary? DataValue { get; set; } + private IDictionary? LabelsValue { get; set; } + + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// + /// + public UpdateUserProfileDataRequestDescriptor Data(Func, FluentDictionary> selector) + { + DataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Searchable data that you want to associate with the user profile. This + /// field supports a nested data structure. + /// + /// + public UpdateUserProfileDataRequestDescriptor Labels(Func, FluentDictionary> selector) + { + LabelsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DataValue is not null) + { + writer.WritePropertyName("data"); + JsonSerializer.Serialize(writer, DataValue, options); + } + + if (LabelsValue is not null) + { + writer.WritePropertyName("labels"); + JsonSerializer.Serialize(writer, LabelsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs new file mode 100644 index 00000000000..1c0d0221b89 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UpdateUserProfileDataResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.Security.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.Security.g.cs new file mode 100644 index 00000000000..67e3c6f6217 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.Security.g.cs @@ -0,0 +1,3289 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public partial class SecurityNamespacedClient : NamespacedClientProxy +{ + /// + /// + /// Initializes a new instance of the class for mocking. + /// + /// + protected SecurityNamespacedClient() : base() + { + } + + internal SecurityNamespacedClient(ElasticsearchClient client) : base(client) + { + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(CancellationToken cancellationToken = default) + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(AuthenticateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(AuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new AuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new AuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk delete roles API cannot delete roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkDeleteRoleAsync(BulkDeleteRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk delete roles API cannot delete roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkDeleteRoleAsync(BulkDeleteRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk delete roles API cannot delete roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkDeleteRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new BulkDeleteRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk delete roles API cannot delete roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkDeleteRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new BulkDeleteRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(BulkPutRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(BulkPutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new BulkPutRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new BulkPutRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, BulkPutRoleResponse, BulkPutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(BulkPutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new BulkPutRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The bulk create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task BulkPutRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new BulkPutRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Serverless.Ids ids, CancellationToken cancellationToken = default) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Serverless.Ids ids, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name application, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name application, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Serverless.Names realms, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Serverless.Names realms, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Serverless.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name? name, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name application, Elastic.Clients.Elasticsearch.Serverless.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name application, Elastic.Clients.Elasticsearch.Serverless.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(DeleteRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(DeleteRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Serverless.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(DisableUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(DisableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(EnableUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(EnableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(GetApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(GetApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(GetPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(GetPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name? application, Elastic.Clients.Elasticsearch.Serverless.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name? application, Elastic.Clients.Elasticsearch.Serverless.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(GetRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(GetRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(GetRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(GetRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(string? ns, string? service, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(string? ns, string? service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Serverless.Name service, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Serverless.Name service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(GetTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(GetTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(GetUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(GetUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(HasPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(HasPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name? user, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Serverless.Name? user, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(InvalidateTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(InvalidateTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(PutPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(PutPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new PutPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(PutRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(PutRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Serverless.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(QueryRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(QueryRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryRoleResponse, QueryRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(QueryRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves roles in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(SamlInvalidateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(SamlInvalidateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlInvalidateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlInvalidateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(SamlLogoutRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(SamlLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Serverless.Name realmName, CancellationToken cancellationToken = default) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Serverless.Name realmName, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Serverless.Id id, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Serverless.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Serverless.Id id, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Serverless.Id id, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.g.cs index e40b3bfe8ba..e422ade31e7 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Client/ElasticsearchClient.g.cs @@ -29,6 +29,7 @@ using Elastic.Clients.Elasticsearch.Serverless.MachineLearning; using Elastic.Clients.Elasticsearch.Serverless.Nodes; using Elastic.Clients.Elasticsearch.Serverless.QueryRules; +using Elastic.Clients.Elasticsearch.Serverless.Security; using Elastic.Clients.Elasticsearch.Serverless.Snapshot; using Elastic.Clients.Elasticsearch.Serverless.SnapshotLifecycleManagement; using Elastic.Clients.Elasticsearch.Serverless.Sql; @@ -57,6 +58,7 @@ public partial class ElasticsearchClient public virtual MachineLearningNamespacedClient MachineLearning { get; private set; } public virtual NodesNamespacedClient Nodes { get; private set; } public virtual QueryRulesNamespacedClient QueryRules { get; private set; } + public virtual SecurityNamespacedClient Security { get; private set; } public virtual SnapshotNamespacedClient Snapshot { get; private set; } public virtual SnapshotLifecycleManagementNamespacedClient SnapshotLifecycleManagement { get; private set; } public virtual SqlNamespacedClient Sql { get; private set; } @@ -79,6 +81,7 @@ private partial void SetupNamespaces() MachineLearning = new MachineLearningNamespacedClient(this); Nodes = new NodesNamespacedClient(this); QueryRules = new QueryRulesNamespacedClient(this); + Security = new SecurityNamespacedClient(this); Snapshot = new SnapshotNamespacedClient(this); SnapshotLifecycleManagement = new SnapshotLifecycleManagementNamespacedClient(this); Sql = new SqlNamespacedClient(this); diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CardinalityAggregation.g.cs index 1ac44390f6f..4197e991736 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CardinalityAggregation.g.cs @@ -68,6 +68,7 @@ public sealed partial class CardinalityAggregation public Elastic.Clients.Elasticsearch.Serverless.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.Cardinality(cardinalityAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Cardinality(cardinalityAggregation); } public sealed partial class CardinalityAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CompositeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CompositeAggregation.g.cs index 472e5be90b4..17a3421ab98 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CompositeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/CompositeAggregation.g.cs @@ -55,6 +55,7 @@ public sealed partial class CompositeAggregation public ICollection>? Sources { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.Composite(compositeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Composite(compositeAggregation); } public sealed partial class CompositeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateRangeAggregation.g.cs index 3199a7d4b84..a35e230e557 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/DateRangeAggregation.g.cs @@ -71,6 +71,7 @@ public sealed partial class DateRangeAggregation public string? TimeZone { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.DateRange(dateRangeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.DateRange(dateRangeAggregation); } public sealed partial class DateRangeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/MissingAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/MissingAggregation.g.cs index afffcc58ce0..4f0bbb3cf1c 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/MissingAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/MissingAggregation.g.cs @@ -40,6 +40,7 @@ public sealed partial class MissingAggregation public Elastic.Clients.Elasticsearch.Serverless.FieldValue? Missing { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.Missing(missingAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Missing(missingAggregation); } public sealed partial class MissingAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/RangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/RangeAggregation.g.cs index cac73f6ecea..8912410a1ce 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/RangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/RangeAggregation.g.cs @@ -59,6 +59,7 @@ public sealed partial class RangeAggregation public Elastic.Clients.Elasticsearch.Serverless.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.Range(rangeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Range(rangeAggregation); } public sealed partial class RangeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/TermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/TermsAggregation.g.cs index 58078764401..84596ba6190 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/TermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/TermsAggregation.g.cs @@ -149,6 +149,7 @@ public sealed partial class TermsAggregation public string? ValueType { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.Terms(termsAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Terms(termsAggregation); public static implicit operator Elastic.Clients.Elasticsearch.Serverless.TransformManagement.PivotGroupBy(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Serverless.TransformManagement.PivotGroupBy.Terms(termsAggregation); } diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ValueCountAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ValueCountAggregation.g.cs index e3bb51d98ea..3670bc51476 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ValueCountAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Aggregations/ValueCountAggregation.g.cs @@ -51,6 +51,7 @@ public sealed partial class ValueCountAggregation public Elastic.Clients.Elasticsearch.Serverless.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Serverless.Aggregations.Aggregation.ValueCount(valueCountAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.ValueCount(valueCountAggregation); } public sealed partial class ValueCountAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Security.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Security.g.cs new file mode 100644 index 00000000000..08429f5c021 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Enums/Enums.Security.g.cs @@ -0,0 +1,308 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Core; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using Elastic.Transport; +using System; +using System.Runtime.Serialization; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(AccessTokenGrantTypeConverter))] +public enum AccessTokenGrantType +{ + [EnumMember(Value = "refresh_token")] + RefreshToken, + [EnumMember(Value = "password")] + Password, + [EnumMember(Value = "_kerberos")] + Kerberos, + [EnumMember(Value = "client_credentials")] + ClientCredentials +} + +internal sealed class AccessTokenGrantTypeConverter : JsonConverter +{ + public override AccessTokenGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "refresh_token": + return AccessTokenGrantType.RefreshToken; + case "password": + return AccessTokenGrantType.Password; + case "_kerberos": + return AccessTokenGrantType.Kerberos; + case "client_credentials": + return AccessTokenGrantType.ClientCredentials; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, AccessTokenGrantType value, JsonSerializerOptions options) + { + switch (value) + { + case AccessTokenGrantType.RefreshToken: + writer.WriteStringValue("refresh_token"); + return; + case AccessTokenGrantType.Password: + writer.WriteStringValue("password"); + return; + case AccessTokenGrantType.Kerberos: + writer.WriteStringValue("_kerberos"); + return; + case AccessTokenGrantType.ClientCredentials: + writer.WriteStringValue("client_credentials"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(ApiKeyGrantTypeConverter))] +public enum ApiKeyGrantType +{ + [EnumMember(Value = "password")] + Password, + [EnumMember(Value = "access_token")] + AccessToken +} + +internal sealed class ApiKeyGrantTypeConverter : JsonConverter +{ + public override ApiKeyGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "password": + return ApiKeyGrantType.Password; + case "access_token": + return ApiKeyGrantType.AccessToken; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyGrantType value, JsonSerializerOptions options) + { + switch (value) + { + case ApiKeyGrantType.Password: + writer.WriteStringValue("password"); + return; + case ApiKeyGrantType.AccessToken: + writer.WriteStringValue("access_token"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(EnumStructConverter))] +public readonly partial struct ClusterPrivilege : IEnumStruct +{ + public ClusterPrivilege(string value) => Value = value; + + ClusterPrivilege IEnumStruct.Create(string value) => value; + + public readonly string Value { get; } + public static ClusterPrivilege ReadSecurity { get; } = new ClusterPrivilege("read_security"); + public static ClusterPrivilege ReadPipeline { get; } = new ClusterPrivilege("read_pipeline"); + public static ClusterPrivilege PostBehavioralAnalyticsEvent { get; } = new ClusterPrivilege("post_behavioral_analytics_event"); + public static ClusterPrivilege None { get; } = new ClusterPrivilege("none"); + public static ClusterPrivilege MonitorTransform { get; } = new ClusterPrivilege("monitor_transform"); + public static ClusterPrivilege MonitorMl { get; } = new ClusterPrivilege("monitor_ml"); + public static ClusterPrivilege MonitorInference { get; } = new ClusterPrivilege("monitor_inference"); + public static ClusterPrivilege MonitorEnrich { get; } = new ClusterPrivilege("monitor_enrich"); + public static ClusterPrivilege Monitor { get; } = new ClusterPrivilege("monitor"); + public static ClusterPrivilege ManageTransform { get; } = new ClusterPrivilege("manage_transform"); + public static ClusterPrivilege ManageSecurity { get; } = new ClusterPrivilege("manage_security"); + public static ClusterPrivilege ManageSearchSynonyms { get; } = new ClusterPrivilege("manage_search_synonyms"); + public static ClusterPrivilege ManageSearchQueryRules { get; } = new ClusterPrivilege("manage_search_query_rules"); + public static ClusterPrivilege ManageSearchApplication { get; } = new ClusterPrivilege("manage_search_application"); + public static ClusterPrivilege ManagePipeline { get; } = new ClusterPrivilege("manage_pipeline"); + public static ClusterPrivilege ManageOwnApiKey { get; } = new ClusterPrivilege("manage_own_api_key"); + public static ClusterPrivilege ManageMl { get; } = new ClusterPrivilege("manage_ml"); + public static ClusterPrivilege ManageLogstashPipelines { get; } = new ClusterPrivilege("manage_logstash_pipelines"); + public static ClusterPrivilege ManageIngestPipelines { get; } = new ClusterPrivilege("manage_ingest_pipelines"); + public static ClusterPrivilege ManageInference { get; } = new ClusterPrivilege("manage_inference"); + public static ClusterPrivilege ManageIndexTemplates { get; } = new ClusterPrivilege("manage_index_templates"); + public static ClusterPrivilege ManageEnrich { get; } = new ClusterPrivilege("manage_enrich"); + public static ClusterPrivilege ManageBehavioralAnalytics { get; } = new ClusterPrivilege("manage_behavioral_analytics"); + public static ClusterPrivilege ManageApiKey { get; } = new ClusterPrivilege("manage_api_key"); + public static ClusterPrivilege Manage { get; } = new ClusterPrivilege("manage"); + public static ClusterPrivilege CancelTask { get; } = new ClusterPrivilege("cancel_task"); + public static ClusterPrivilege All { get; } = new ClusterPrivilege("all"); + + public override string ToString() => Value ?? string.Empty; + + public static implicit operator string(ClusterPrivilege clusterPrivilege) => clusterPrivilege.Value; + public static implicit operator ClusterPrivilege(string value) => new(value); + + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is ClusterPrivilege other && this.Equals(other); + public bool Equals(ClusterPrivilege other) => Value == other.Value; + + public static bool operator ==(ClusterPrivilege a, ClusterPrivilege b) => a.Equals(b); + public static bool operator !=(ClusterPrivilege a, ClusterPrivilege b) => !(a == b); +} + +[JsonConverter(typeof(GrantTypeConverter))] +public enum GrantType +{ + /// + /// + /// In this type of grant, you must supply the user ID and password for which you want to create the API key. + /// + /// + [EnumMember(Value = "password")] + Password, + /// + /// + /// In this type of grant, you must supply an access token that was created by the Elasticsearch token service. + /// + /// + [EnumMember(Value = "access_token")] + AccessToken +} + +internal sealed class GrantTypeConverter : JsonConverter +{ + public override GrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "password": + return GrantType.Password; + case "access_token": + return GrantType.AccessToken; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, GrantType value, JsonSerializerOptions options) + { + switch (value) + { + case GrantType.Password: + writer.WriteStringValue("password"); + return; + case GrantType.AccessToken: + writer.WriteStringValue("access_token"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(EnumStructConverter))] +public readonly partial struct IndexPrivilege : IEnumStruct +{ + public IndexPrivilege(string value) => Value = value; + + IndexPrivilege IEnumStruct.Create(string value) => value; + + public readonly string Value { get; } + public static IndexPrivilege Write { get; } = new IndexPrivilege("write"); + public static IndexPrivilege ViewIndexMetadata { get; } = new IndexPrivilege("view_index_metadata"); + public static IndexPrivilege Read { get; } = new IndexPrivilege("read"); + public static IndexPrivilege None { get; } = new IndexPrivilege("none"); + public static IndexPrivilege Monitor { get; } = new IndexPrivilege("monitor"); + public static IndexPrivilege ManageDataStreamLifecycle { get; } = new IndexPrivilege("manage_data_stream_lifecycle"); + public static IndexPrivilege Manage { get; } = new IndexPrivilege("manage"); + public static IndexPrivilege Maintenance { get; } = new IndexPrivilege("maintenance"); + public static IndexPrivilege Index { get; } = new IndexPrivilege("index"); + public static IndexPrivilege DeleteIndex { get; } = new IndexPrivilege("delete_index"); + public static IndexPrivilege Delete { get; } = new IndexPrivilege("delete"); + public static IndexPrivilege CreateIndex { get; } = new IndexPrivilege("create_index"); + public static IndexPrivilege CreateDoc { get; } = new IndexPrivilege("create_doc"); + public static IndexPrivilege Create { get; } = new IndexPrivilege("create"); + public static IndexPrivilege AutoConfigure { get; } = new IndexPrivilege("auto_configure"); + public static IndexPrivilege All { get; } = new IndexPrivilege("all"); + + public override string ToString() => Value ?? string.Empty; + + public static implicit operator string(IndexPrivilege indexPrivilege) => indexPrivilege.Value; + public static implicit operator IndexPrivilege(string value) => new(value); + + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is IndexPrivilege other && this.Equals(other); + public bool Equals(IndexPrivilege other) => Value == other.Value; + + public static bool operator ==(IndexPrivilege a, IndexPrivilege b) => a.Equals(b); + public static bool operator !=(IndexPrivilege a, IndexPrivilege b) => !(a == b); +} + +[JsonConverter(typeof(TemplateFormatConverter))] +public enum TemplateFormat +{ + [EnumMember(Value = "string")] + String, + [EnumMember(Value = "json")] + Json +} + +internal sealed class TemplateFormatConverter : JsonConverter +{ + public override TemplateFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "string": + return TemplateFormat.String; + case "json": + return TemplateFormat.Json; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, TemplateFormat value, JsonSerializerOptions options) + { + switch (value) + { + case TemplateFormat.String: + writer.WriteStringValue("string"); + return; + case TemplateFormat.Json: + writer.WriteStringValue("json"); + return; + } + + writer.WriteNullValue(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/BoolQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/BoolQuery.g.cs index 546ff80a089..febf7b6dc6a 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/BoolQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/BoolQuery.g.cs @@ -89,6 +89,9 @@ public sealed partial class BoolQuery public ICollection? Should { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Bool(boolQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Bool(boolQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Bool(boolQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Bool(boolQuery); } public sealed partial class BoolQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/ExistsQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/ExistsQuery.g.cs index 568678bc110..4f2b09aec21 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/ExistsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/ExistsQuery.g.cs @@ -51,6 +51,9 @@ public sealed partial class ExistsQuery public string? QueryName { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Exists(existsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Exists(existsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Exists(existsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Exists(existsQuery); } public sealed partial class ExistsQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/IdsQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/IdsQuery.g.cs index 3915c424b59..48ca46766af 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/IdsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/IdsQuery.g.cs @@ -51,6 +51,9 @@ public sealed partial class IdsQuery public Elastic.Clients.Elasticsearch.Serverless.Ids? Values { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Ids(idsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Ids(idsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Ids(idsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Ids(idsQuery); } public sealed partial class IdsQueryDescriptor : SerializableDescriptor diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchAllQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchAllQuery.g.cs index cc070e757d0..bf7576bc03e 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchAllQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchAllQuery.g.cs @@ -43,6 +43,9 @@ public sealed partial class MatchAllQuery public string? QueryName { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.MatchAll(matchAllQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.MatchAll(matchAllQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.MatchAll(matchAllQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.MatchAll(matchAllQuery); } public sealed partial class MatchAllQueryDescriptor : SerializableDescriptor diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchQuery.g.cs index da8b5240a59..5907d2f7093 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/MatchQuery.g.cs @@ -333,6 +333,9 @@ public MatchQuery(Elastic.Clients.Elasticsearch.Serverless.Field field) public Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Match(matchQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Match(matchQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Match(matchQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Match(matchQuery); } public sealed partial class MatchQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/PrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/PrefixQuery.g.cs index 5bac74f80a7..f808632a013 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/PrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/PrefixQuery.g.cs @@ -163,6 +163,9 @@ public PrefixQuery(Elastic.Clients.Elasticsearch.Serverless.Field field) public string Value { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Prefix(prefixQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Prefix(prefixQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Prefix(prefixQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Prefix(prefixQuery); } public sealed partial class PrefixQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs index 671cfc00e51..a8928659067 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs @@ -151,6 +151,9 @@ public sealed partial class SimpleQueryStringQuery public string? QuoteFieldSuffix { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.SimpleQueryString(simpleQueryStringQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.SimpleQueryString(simpleQueryStringQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.SimpleQueryString(simpleQueryStringQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.SimpleQueryString(simpleQueryStringQuery); } public sealed partial class SimpleQueryStringQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermQuery.g.cs index 7b04b4ec1d8..b5e2dfd6e85 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermQuery.g.cs @@ -144,6 +144,9 @@ public TermQuery(Elastic.Clients.Elasticsearch.Serverless.Field field) public Elastic.Clients.Elasticsearch.Serverless.FieldValue Value { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Term(termQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Term(termQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Term(termQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Term(termQuery); } public sealed partial class TermQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermsQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermsQuery.g.cs index 87ff99707cf..c40bc83f2ba 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/TermsQuery.g.cs @@ -108,6 +108,9 @@ public sealed partial class TermsQuery public Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQueryField Term { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Terms(termsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Terms(termsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Terms(termsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Terms(termsQuery); } public sealed partial class TermsQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/WildcardQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/WildcardQuery.g.cs index 33955b0736d..f45948b7b38 100644 --- a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/WildcardQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/QueryDsl/WildcardQuery.g.cs @@ -185,6 +185,9 @@ public WildcardQuery(Elastic.Clients.Elasticsearch.Serverless.Field field) public string? Wildcard { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Serverless.QueryDsl.Query.Wildcard(wildcardQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery.Wildcard(wildcardQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.RoleQuery.Wildcard(wildcardQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Serverless.Security.UserQuery.Wildcard(wildcardQuery); } public sealed partial class WildcardQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKey.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKey.g.cs new file mode 100644 index 00000000000..c31021053fd --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKey.g.cs @@ -0,0 +1,133 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ApiKey +{ + /// + /// + /// Creation time for the API key in milliseconds. + /// + /// + [JsonInclude, JsonPropertyName("creation")] + public long? Creation { get; init; } + + /// + /// + /// Expiration time for the API key in milliseconds. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + + /// + /// + /// Id for the API key + /// + /// + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + + /// + /// + /// Invalidation status for the API key. + /// If the key has been invalidated, it has a value of true. Otherwise, it is false. + /// + /// + [JsonInclude, JsonPropertyName("invalidated")] + public bool? Invalidated { get; init; } + + /// + /// + /// The owner user’s permissions associated with the API key. + /// It is a point-in-time snapshot captured at creation and subsequent updates. + /// An API key’s effective permissions are an intersection of its assigned privileges and the owner user’s permissions. + /// + /// + [JsonInclude, JsonPropertyName("limited_by")] + public IReadOnlyCollection>? LimitedBy { get; init; } + + /// + /// + /// Metadata of the API key + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary? Metadata { get; init; } + + /// + /// + /// Name of the API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + + /// + /// + /// The profile uid for the API key owner principal, if requested and if it exists + /// + /// + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + + /// + /// + /// Realm name of the principal for which this API key was created. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; init; } + + /// + /// + /// Realm type of the principal for which this API key was created + /// + /// + [JsonInclude, JsonPropertyName("realm_type")] + public string? RealmType { get; init; } + + /// + /// + /// The role descriptors assigned to this API key when it was created or last updated. + /// An empty role descriptor means the API key inherits the owner user’s permissions. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IReadOnlyDictionary? RoleDescriptors { get; init; } + [JsonInclude, JsonPropertyName("_sort")] + public IReadOnlyCollection? Sort { get; init; } + + /// + /// + /// Principal for which this API key was created + /// + /// + [JsonInclude, JsonPropertyName("username")] + public string? Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyAggregation.g.cs new file mode 100644 index 00000000000..53a0e25eabb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyAggregation.g.cs @@ -0,0 +1,452 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(ApiKeyAggregationConverter))] +public sealed partial class ApiKeyAggregation +{ + internal ApiKeyAggregation(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static ApiKeyAggregation Cardinality(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CardinalityAggregation cardinalityAggregation) => new ApiKeyAggregation("cardinality", cardinalityAggregation); + public static ApiKeyAggregation Composite(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CompositeAggregation compositeAggregation) => new ApiKeyAggregation("composite", compositeAggregation); + public static ApiKeyAggregation DateRange(Elastic.Clients.Elasticsearch.Serverless.Aggregations.DateRangeAggregation dateRangeAggregation) => new ApiKeyAggregation("date_range", dateRangeAggregation); + public static ApiKeyAggregation Filter(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery apiKeyQueryContainer) => new ApiKeyAggregation("filter", apiKeyQueryContainer); + public static ApiKeyAggregation Filters(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => new ApiKeyAggregation("filters", apiKeyFiltersAggregation); + public static ApiKeyAggregation Missing(Elastic.Clients.Elasticsearch.Serverless.Aggregations.MissingAggregation missingAggregation) => new ApiKeyAggregation("missing", missingAggregation); + public static ApiKeyAggregation Range(Elastic.Clients.Elasticsearch.Serverless.Aggregations.RangeAggregation rangeAggregation) => new ApiKeyAggregation("range", rangeAggregation); + public static ApiKeyAggregation Terms(Elastic.Clients.Elasticsearch.Serverless.Aggregations.TermsAggregation termsAggregation) => new ApiKeyAggregation("terms", termsAggregation); + public static ApiKeyAggregation ValueCount(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ValueCountAggregation valueCountAggregation) => new ApiKeyAggregation("value_count", valueCountAggregation); + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public IDictionary? Aggregations { get; set; } + [JsonInclude, JsonPropertyName("meta")] + public IDictionary? Meta { get; set; } + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class ApiKeyAggregationConverter : JsonConverter +{ + public override ApiKeyAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + IDictionary? aggregationsValue = default; + IDictionary? metaValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "aggregations") + { + aggregationsValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "meta") + { + metaValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "cardinality") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "composite") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "date_range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "filter") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "filters") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "missing") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "value_count") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyAggregation' from the response."); + } + + var result = new ApiKeyAggregation(variantNameValue, variantValue); + result.Aggregations = aggregationsValue; + result.Meta = metaValue; + return result; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "cardinality": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.CardinalityAggregation)value.Variant, options); + break; + case "composite": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.CompositeAggregation)value.Variant, options); + break; + case "date_range": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.DateRangeAggregation)value.Variant, options); + break; + case "filter": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery)value.Variant, options); + break; + case "filters": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyFiltersAggregation)value.Variant, options); + break; + case "missing": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.MissingAggregation)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.RangeAggregation)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.TermsAggregation)value.Variant, options); + break; + case "value_count": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Aggregations.ValueCountAggregation)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor> +{ + internal ApiKeyAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyAggregationDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyAggregationDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private IDictionary> AggregationsValue { get; set; } + private IDictionary? MetaValue { get; set; } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public ApiKeyAggregationDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); + public ApiKeyAggregationDescriptor Cardinality(Action> configure) => Set(configure, "cardinality"); + public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); + public ApiKeyAggregationDescriptor Composite(Action> configure) => Set(configure, "composite"); + public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Serverless.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); + public ApiKeyAggregationDescriptor DateRange(Action> configure) => Set(configure, "date_range"); + public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); + public ApiKeyAggregationDescriptor Filter(Action> configure) => Set(configure, "filter"); + public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); + public ApiKeyAggregationDescriptor Filters(Action> configure) => Set(configure, "filters"); + public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Serverless.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); + public ApiKeyAggregationDescriptor Missing(Action> configure) => Set(configure, "missing"); + public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); + public ApiKeyAggregationDescriptor Range(Action> configure) => Set(configure, "range"); + public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); + public ApiKeyAggregationDescriptor Terms(Action> configure) => Set(configure, "terms"); + public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); + public ApiKeyAggregationDescriptor ValueCount(Action> configure) => Set(configure, "value_count"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor +{ + internal ApiKeyAggregationDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyAggregationDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyAggregationDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private IDictionary AggregationsValue { get; set; } + private IDictionary? MetaValue { get; set; } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public ApiKeyAggregationDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); + public ApiKeyAggregationDescriptor Cardinality(Action configure) => Set(configure, "cardinality"); + public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Serverless.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); + public ApiKeyAggregationDescriptor Composite(Action configure) => Set(configure, "composite"); + public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Serverless.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); + public ApiKeyAggregationDescriptor DateRange(Action configure) => Set(configure, "date_range"); + public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); + public ApiKeyAggregationDescriptor Filter(Action configure) => Set(configure, "filter"); + public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); + public ApiKeyAggregationDescriptor Filters(Action configure) => Set(configure, "filters"); + public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Serverless.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); + public ApiKeyAggregationDescriptor Missing(Action configure) => Set(configure, "missing"); + public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); + public ApiKeyAggregationDescriptor Range(Action configure) => Set(configure, "range"); + public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); + public ApiKeyAggregationDescriptor Terms(Action configure) => Set(configure, "terms"); + public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Serverless.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); + public ApiKeyAggregationDescriptor ValueCount(Action configure) => Set(configure, "value_count"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs new file mode 100644 index 00000000000..2e241b37b09 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs @@ -0,0 +1,244 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ApiKeyFiltersAggregation +{ + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + [JsonInclude, JsonPropertyName("filters")] + public Elastic.Clients.Elasticsearch.Serverless.Aggregations.Buckets? Filters { get; set; } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + [JsonInclude, JsonPropertyName("keyed")] + public bool? Keyed { get; set; } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + [JsonInclude, JsonPropertyName("other_bucket")] + public bool? OtherBucket { get; set; } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + [JsonInclude, JsonPropertyName("other_bucket_key")] + public string? OtherBucketKey { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation(ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Elastic.Clients.Elasticsearch.Serverless.Security.ApiKeyAggregation.Filters(apiKeyFiltersAggregation); +} + +public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor> +{ + internal ApiKeyFiltersAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyFiltersAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.Buckets? FiltersValue { get; set; } + private bool? KeyedValue { get; set; } + private bool? OtherBucketValue { get; set; } + private string? OtherBucketKeyValue { get; set; } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Serverless.Aggregations.Buckets? filters) + { + FiltersValue = filters; + return Self; + } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + { + OtherBucketValue = otherBucket; + return Self; + } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + { + OtherBucketKeyValue = otherBucketKey; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FiltersValue is not null) + { + writer.WritePropertyName("filters"); + JsonSerializer.Serialize(writer, FiltersValue, options); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (OtherBucketValue.HasValue) + { + writer.WritePropertyName("other_bucket"); + writer.WriteBooleanValue(OtherBucketValue.Value); + } + + if (!string.IsNullOrEmpty(OtherBucketKeyValue)) + { + writer.WritePropertyName("other_bucket_key"); + writer.WriteStringValue(OtherBucketKeyValue); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor +{ + internal ApiKeyFiltersAggregationDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyFiltersAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Aggregations.Buckets? FiltersValue { get; set; } + private bool? KeyedValue { get; set; } + private bool? OtherBucketValue { get; set; } + private string? OtherBucketKeyValue { get; set; } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Serverless.Aggregations.Buckets? filters) + { + FiltersValue = filters; + return Self; + } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + { + OtherBucketValue = otherBucket; + return Self; + } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + { + OtherBucketKeyValue = otherBucketKey; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FiltersValue is not null) + { + writer.WritePropertyName("filters"); + JsonSerializer.Serialize(writer, FiltersValue, options); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (OtherBucketValue.HasValue) + { + writer.WritePropertyName("other_bucket"); + writer.WriteBooleanValue(OtherBucketValue.Value); + } + + if (!string.IsNullOrEmpty(OtherBucketKeyValue)) + { + writer.WritePropertyName("other_bucket_key"); + writer.WriteStringValue(OtherBucketKeyValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyQuery.g.cs new file mode 100644 index 00000000000..eac62337667 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApiKeyQuery.g.cs @@ -0,0 +1,384 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(ApiKeyQueryConverter))] +public sealed partial class ApiKeyQuery +{ + internal ApiKeyQuery(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static ApiKeyQuery Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => new ApiKeyQuery("bool", boolQuery); + public static ApiKeyQuery Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => new ApiKeyQuery("exists", existsQuery); + public static ApiKeyQuery Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => new ApiKeyQuery("ids", idsQuery); + public static ApiKeyQuery Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => new ApiKeyQuery("match", matchQuery); + public static ApiKeyQuery MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => new ApiKeyQuery("match_all", matchAllQuery); + public static ApiKeyQuery Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => new ApiKeyQuery("prefix", prefixQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new ApiKeyQuery("simple_query_string", simpleQueryStringQuery); + public static ApiKeyQuery Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => new ApiKeyQuery("term", termQuery); + public static ApiKeyQuery Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => new ApiKeyQuery("terms", termsQuery); + public static ApiKeyQuery Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => new ApiKeyQuery("wildcard", wildcardQuery); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class ApiKeyQueryConverter : JsonConverter +{ + public override ApiKeyQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "bool") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "exists") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "ids") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match_all") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "prefix") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "simple_query_string") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "term") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "wildcard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyQuery' from the response."); + } + + var result = new ApiKeyQuery(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "bool": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery)value.Variant, options); + break; + case "exists": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery)value.Variant, options); + break; + case "ids": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery)value.Variant, options); + break; + case "match": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery)value.Variant, options); + break; + case "match_all": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery)value.Variant, options); + break; + case "prefix": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); + break; + case "simple_query_string": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery)value.Variant, options); + break; + case "wildcard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor> +{ + internal ApiKeyQueryDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public ApiKeyQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); + public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public ApiKeyQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); + public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public ApiKeyQueryDescriptor Match(Action> configure) => Set(configure, "match"); + public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public ApiKeyQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public ApiKeyQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); + public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public ApiKeyQueryDescriptor Term(Action> configure) => Set(configure, "term"); + public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public ApiKeyQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); + public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public ApiKeyQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor +{ + internal ApiKeyQueryDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public ApiKeyQueryDescriptor Bool(Action configure) => Set(configure, "bool"); + public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public ApiKeyQueryDescriptor Exists(Action configure) => Set(configure, "exists"); + public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public ApiKeyQueryDescriptor Match(Action configure) => Set(configure, "match"); + public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public ApiKeyQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public ApiKeyQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); + public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public ApiKeyQueryDescriptor Term(Action configure) => Set(configure, "term"); + public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public ApiKeyQueryDescriptor Terms(Action configure) => Set(configure, "terms"); + public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public ApiKeyQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs new file mode 100644 index 00000000000..27c0724d7fa --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ApplicationGlobalUserPrivileges +{ + [JsonInclude, JsonPropertyName("manage")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ManageUserPrivileges Manage { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivileges.g.cs new file mode 100644 index 00000000000..5cdb4075a3a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivileges.g.cs @@ -0,0 +1,113 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ApplicationPrivileges +{ + /// + /// + /// The name of the application to which this entry applies. + /// + /// + [JsonInclude, JsonPropertyName("application")] + public string Application { get; set; } + + /// + /// + /// A list of strings, where each element is the name of an application privilege or action. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A list resources to which the privileges are applied. + /// + /// + [JsonInclude, JsonPropertyName("resources")] + public ICollection Resources { get; set; } +} + +public sealed partial class ApplicationPrivilegesDescriptor : SerializableDescriptor +{ + internal ApplicationPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public ApplicationPrivilegesDescriptor() : base() + { + } + + private string ApplicationValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private ICollection ResourcesValue { get; set; } + + /// + /// + /// The name of the application to which this entry applies. + /// + /// + public ApplicationPrivilegesDescriptor Application(string application) + { + ApplicationValue = application; + return Self; + } + + /// + /// + /// A list of strings, where each element is the name of an application privilege or action. + /// + /// + public ApplicationPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A list resources to which the privileges are applied. + /// + /// + public ApplicationPrivilegesDescriptor Resources(ICollection resources) + { + ResourcesValue = resources; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WritePropertyName("resources"); + JsonSerializer.Serialize(writer, ResourcesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs new file mode 100644 index 00000000000..1ff42648227 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs @@ -0,0 +1,113 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ApplicationPrivilegesCheck +{ + /// + /// + /// The name of the application. + /// + /// + [JsonInclude, JsonPropertyName("application")] + public string Application { get; set; } + + /// + /// + /// A list of the privileges that you want to check for the specified resources. May be either application privilege names, or the names of actions that are granted by those privileges + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A list of resource names against which the privileges should be checked + /// + /// + [JsonInclude, JsonPropertyName("resources")] + public ICollection Resources { get; set; } +} + +public sealed partial class ApplicationPrivilegesCheckDescriptor : SerializableDescriptor +{ + internal ApplicationPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public ApplicationPrivilegesCheckDescriptor() : base() + { + } + + private string ApplicationValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private ICollection ResourcesValue { get; set; } + + /// + /// + /// The name of the application. + /// + /// + public ApplicationPrivilegesCheckDescriptor Application(string application) + { + ApplicationValue = application; + return Self; + } + + /// + /// + /// A list of the privileges that you want to check for the specified resources. May be either application privilege names, or the names of actions that are granted by those privileges + /// + /// + public ApplicationPrivilegesCheckDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A list of resource names against which the privileges should be checked + /// + /// + public ApplicationPrivilegesCheckDescriptor Resources(ICollection resources) + { + ResourcesValue = resources; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WritePropertyName("resources"); + JsonSerializer.Serialize(writer, ResourcesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticateToken.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticateToken.g.cs new file mode 100644 index 00000000000..e33e8bd4d3f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticateToken.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class AuthenticateToken +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string? Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticatedUser.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticatedUser.g.cs new file mode 100644 index 00000000000..164996b3e29 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticatedUser.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class AuthenticatedUser +{ + [JsonInclude, JsonPropertyName("authentication_provider")] + public Elastic.Clients.Elasticsearch.Serverless.Security.AuthenticationProvider? AuthenticationProvider { get; init; } + [JsonInclude, JsonPropertyName("authentication_realm")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserRealm AuthenticationRealm { get; init; } + [JsonInclude, JsonPropertyName("authentication_type")] + public string AuthenticationType { get; init; } + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("lookup_realm")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserRealm LookupRealm { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticationProvider.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticationProvider.g.cs new file mode 100644 index 00000000000..83e8094757a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/AuthenticationProvider.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class AuthenticationProvider +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/BulkError.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/BulkError.g.cs new file mode 100644 index 00000000000..41b39cc686c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/BulkError.g.cs @@ -0,0 +1,47 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class BulkError +{ + /// + /// + /// The number of errors + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// Details about the errors, keyed by role name + /// + /// + [JsonInclude, JsonPropertyName("details")] + public IReadOnlyDictionary Details { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ClusterNode.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ClusterNode.g.cs new file mode 100644 index 00000000000..35dbf38ddf7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ClusterNode.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ClusterNode +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/CreatedStatus.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/CreatedStatus.g.cs new file mode 100644 index 00000000000..bf398809526 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/CreatedStatus.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class CreatedStatus +{ + [JsonInclude, JsonPropertyName("created")] + public bool Created { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldRule.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldRule.g.cs new file mode 100644 index 00000000000..4b17f9090f9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldRule.g.cs @@ -0,0 +1,251 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(FieldRuleConverter))] +public sealed partial class FieldRule +{ + internal FieldRule(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static FieldRule Dn(Elastic.Clients.Elasticsearch.Serverless.Names names) => new FieldRule("dn", names); + public static FieldRule Groups(Elastic.Clients.Elasticsearch.Serverless.Names names) => new FieldRule("groups", names); + public static FieldRule Username(Elastic.Clients.Elasticsearch.Serverless.Names names) => new FieldRule("username", names); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class FieldRuleConverter : JsonConverter +{ + public override FieldRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "dn") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "groups") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "username") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'FieldRule' from the response."); + } + + var result = new FieldRule(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, FieldRule value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "dn": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Names)value.Variant, options); + break; + case "groups": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Names)value.Variant, options); + break; + case "username": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Names)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldRuleDescriptor : SerializableDescriptor> +{ + internal FieldRuleDescriptor(Action> configure) => configure.Invoke(this); + + public FieldRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private FieldRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "dn"); + public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "groups"); + public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "username"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldRuleDescriptor : SerializableDescriptor +{ + internal FieldRuleDescriptor(Action configure) => configure.Invoke(this); + + public FieldRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private FieldRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "dn"); + public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "groups"); + public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Serverless.Names names) => Set(names, "username"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldSecurity.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldSecurity.g.cs new file mode 100644 index 00000000000..02fbe16cb49 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FieldSecurity.g.cs @@ -0,0 +1,122 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class FieldSecurity +{ + [JsonInclude, JsonPropertyName("except")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Serverless.Fields? Except { get; set; } + [JsonInclude, JsonPropertyName("grant")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Serverless.Fields? Grant { get; set; } +} + +public sealed partial class FieldSecurityDescriptor : SerializableDescriptor> +{ + internal FieldSecurityDescriptor(Action> configure) => configure.Invoke(this); + + public FieldSecurityDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Fields? ExceptValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Fields? GrantValue { get; set; } + + public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Serverless.Fields? except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Serverless.Fields? grant) + { + GrantValue = grant; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExceptValue is not null) + { + writer.WritePropertyName("except"); + JsonSerializer.Serialize(writer, ExceptValue, options); + } + + if (GrantValue is not null) + { + writer.WritePropertyName("grant"); + JsonSerializer.Serialize(writer, GrantValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldSecurityDescriptor : SerializableDescriptor +{ + internal FieldSecurityDescriptor(Action configure) => configure.Invoke(this); + + public FieldSecurityDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Fields? ExceptValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Fields? GrantValue { get; set; } + + public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Serverless.Fields? except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Serverless.Fields? grant) + { + GrantValue = grant; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExceptValue is not null) + { + writer.WritePropertyName("except"); + JsonSerializer.Serialize(writer, ExceptValue, options); + } + + if (GrantValue is not null) + { + writer.WritePropertyName("grant"); + JsonSerializer.Serialize(writer, GrantValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FoundStatus.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FoundStatus.g.cs new file mode 100644 index 00000000000..1a1bce313ea --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/FoundStatus.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class FoundStatus +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GetUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GetUserProfileErrors.g.cs new file mode 100644 index 00000000000..f4787ecbf87 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GetUserProfileErrors.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GetUserProfileErrors +{ + [JsonInclude, JsonPropertyName("count")] + public long Count { get; init; } + [JsonInclude, JsonPropertyName("details")] + public IReadOnlyDictionary Details { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GlobalPrivilege.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GlobalPrivilege.g.cs new file mode 100644 index 00000000000..7bd785a07a9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GlobalPrivilege.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GlobalPrivilege +{ + [JsonInclude, JsonPropertyName("application")] + public Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationGlobalUserPrivileges Application { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GrantApiKey.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GrantApiKey.g.cs new file mode 100644 index 00000000000..28fd18d61e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/GrantApiKey.g.cs @@ -0,0 +1,231 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class GrantApiKey +{ + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public string? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Serverless.Name Name { get; set; } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + [SingleOrManyCollectionConverter(typeof(IReadOnlyDictionary))] + public ICollection>? RoleDescriptors { get; set; } +} + +public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor> +{ + internal GrantApiKeyDescriptor(Action> configure) => configure.Invoke(this); + + public GrantApiKeyDescriptor() : base() + { + } + + private string? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name NameValue { get; set; } + private ICollection>? RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public GrantApiKeyDescriptor Expiration(string? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + NameValue = name; + return Self; + } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + { + RoleDescriptorsValue = roleDescriptors; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ExpirationValue)) + { + writer.WritePropertyName("expiration"); + writer.WriteStringValue(ExpirationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor +{ + internal GrantApiKeyDescriptor(Action configure) => configure.Invoke(this); + + public GrantApiKeyDescriptor() : base() + { + } + + private string? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name NameValue { get; set; } + private ICollection>? RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public GrantApiKeyDescriptor Expiration(string? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name) + { + NameValue = name; + return Self; + } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + { + RoleDescriptorsValue = roleDescriptors; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ExpirationValue)) + { + writer.WritePropertyName("expiration"); + writer.WriteStringValue(ExpirationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs new file mode 100644 index 00000000000..761813bde1f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class HasPrivilegesUserProfileErrors +{ + [JsonInclude, JsonPropertyName("count")] + public long Count { get; init; } + [JsonInclude, JsonPropertyName("details")] + public IReadOnlyDictionary Details { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Hint.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Hint.g.cs new file mode 100644 index 00000000000..5d87b05c492 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Hint.g.cs @@ -0,0 +1,103 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class Hint +{ + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + [JsonInclude, JsonPropertyName("labels")] + public IDictionary>>? Labels { get; set; } + + /// + /// + /// A list of Profile UIDs to match against. + /// + /// + [JsonInclude, JsonPropertyName("uids")] + public ICollection? Uids { get; set; } +} + +public sealed partial class HintDescriptor : SerializableDescriptor +{ + internal HintDescriptor(Action configure) => configure.Invoke(this); + + public HintDescriptor() : base() + { + } + + private IDictionary>>? LabelsValue { get; set; } + private ICollection? UidsValue { get; set; } + + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + public HintDescriptor Labels(Func>>, FluentDictionary>>> selector) + { + LabelsValue = selector?.Invoke(new FluentDictionary>>()); + return Self; + } + + /// + /// + /// A list of Profile UIDs to match against. + /// + /// + public HintDescriptor Uids(ICollection? uids) + { + UidsValue = uids; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (LabelsValue is not null) + { + writer.WritePropertyName("labels"); + JsonSerializer.Serialize(writer, LabelsValue, options); + } + + if (UidsValue is not null) + { + writer.WritePropertyName("uids"); + JsonSerializer.Serialize(writer, UidsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndexPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndexPrivilegesCheck.g.cs new file mode 100644 index 00000000000..f92e09190ab --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndexPrivilegesCheck.g.cs @@ -0,0 +1,121 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class IndexPrivilegesCheck +{ + /// + /// + /// This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. + /// Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. + /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. + /// + /// + [JsonInclude, JsonPropertyName("allow_restricted_indices")] + public bool? AllowRestrictedIndices { get; set; } + + /// + /// + /// A list of indices. + /// + /// + [JsonInclude, JsonPropertyName("names")] + public Elastic.Clients.Elasticsearch.Serverless.Indices Names { get; set; } + + /// + /// + /// A list of the privileges that you want to check for the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } +} + +public sealed partial class IndexPrivilegesCheckDescriptor : SerializableDescriptor +{ + internal IndexPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public IndexPrivilegesCheckDescriptor() : base() + { + } + + private bool? AllowRestrictedIndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + + /// + /// + /// This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. + /// Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. + /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. + /// + /// + public IndexPrivilegesCheckDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + { + AllowRestrictedIndicesValue = allowRestrictedIndices; + return Self; + } + + /// + /// + /// A list of indices. + /// + /// + public IndexPrivilegesCheckDescriptor Names(Elastic.Clients.Elasticsearch.Serverless.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// A list of the privileges that you want to check for the specified indices. + /// + /// + public IndexPrivilegesCheckDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AllowRestrictedIndicesValue.HasValue) + { + writer.WritePropertyName("allow_restricted_indices"); + writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndicesPrivileges.g.cs new file mode 100644 index 00000000000..7b33b54b2a3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/IndicesPrivileges.g.cs @@ -0,0 +1,283 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class IndicesPrivileges +{ + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + [JsonInclude, JsonPropertyName("field_security")] + public Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurity? FieldSecurity { get; set; } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + [JsonInclude, JsonPropertyName("names")] + public Elastic.Clients.Elasticsearch.Serverless.Indices Names { get; set; } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public object? Query { get; set; } +} + +public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor> +{ + internal IndicesPrivilegesDescriptor(Action> configure) => configure.Invoke(this); + + public IndicesPrivilegesDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurity? FieldSecurityValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } + private Action> FieldSecurityDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private object? QueryValue { get; set; } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurity? fieldSecurity) + { + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityValue = fieldSecurity; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor descriptor) + { + FieldSecurityValue = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptor = descriptor; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Action> configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public IndicesPrivilegesDescriptor Names(Elastic.Clients.Elasticsearch.Serverless.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public IndicesPrivilegesDescriptor Query(object? query) + { + QueryValue = query; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FieldSecurityDescriptor is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); + } + else if (FieldSecurityDescriptorAction is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); + } + else if (FieldSecurityValue is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityValue, options); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor +{ + internal IndicesPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public IndicesPrivilegesDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurity? FieldSecurityValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } + private Action FieldSecurityDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private object? QueryValue { get; set; } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurity? fieldSecurity) + { + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityValue = fieldSecurity; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor descriptor) + { + FieldSecurityValue = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptor = descriptor; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Action configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public IndicesPrivilegesDescriptor Names(Elastic.Clients.Elasticsearch.Serverless.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public IndicesPrivilegesDescriptor Query(object? query) + { + QueryValue = query; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FieldSecurityDescriptor is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); + } + else if (FieldSecurityDescriptorAction is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); + } + else if (FieldSecurityValue is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityValue, options); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ManageUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ManageUserPrivileges.g.cs new file mode 100644 index 00000000000..950ec09e714 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ManageUserPrivileges.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ManageUserPrivileges +{ + [JsonInclude, JsonPropertyName("applications")] + public IReadOnlyCollection Applications { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentials.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentials.g.cs new file mode 100644 index 00000000000..7fdb1e7d250 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentials.g.cs @@ -0,0 +1,47 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class NodesCredentials +{ + /// + /// + /// File-backed tokens collected from all nodes + /// + /// + [JsonInclude, JsonPropertyName("file_tokens")] + public IReadOnlyDictionary FileTokens { get; init; } + + /// + /// + /// General status showing how nodes respond to the above collection request + /// + /// + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.Serverless.NodeStatistics Nodes { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentialsFileToken.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentialsFileToken.g.cs new file mode 100644 index 00000000000..80ce4668e7d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/NodesCredentialsFileToken.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class NodesCredentialsFileToken +{ + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyCollection Nodes { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegeActions.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegeActions.g.cs new file mode 100644 index 00000000000..ae01fafbb3a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegeActions.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PrivilegeActions +{ + [JsonInclude, JsonPropertyName("actions")] + public ICollection Actions { get; set; } + [JsonInclude, JsonPropertyName("application")] + public string? Application { get; set; } + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Serverless.Name? Name { get; set; } +} + +public sealed partial class PrivilegeActionsDescriptor : SerializableDescriptor +{ + internal PrivilegeActionsDescriptor(Action configure) => configure.Invoke(this); + + public PrivilegeActionsDescriptor() : base() + { + } + + private ICollection ActionsValue { get; set; } + private string? ApplicationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Name? NameValue { get; set; } + + public PrivilegeActionsDescriptor Actions(ICollection actions) + { + ActionsValue = actions; + return Self; + } + + public PrivilegeActionsDescriptor Application(string? application) + { + ApplicationValue = application; + return Self; + } + + public PrivilegeActionsDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PrivilegeActionsDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name? name) + { + NameValue = name; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("actions"); + JsonSerializer.Serialize(writer, ActionsValue, options); + if (!string.IsNullOrEmpty(ApplicationValue)) + { + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegesCheck.g.cs new file mode 100644 index 00000000000..c88d4b4a514 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/PrivilegesCheck.g.cs @@ -0,0 +1,220 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class PrivilegesCheck +{ + [JsonInclude, JsonPropertyName("application")] + public ICollection? Application { get; set; } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + [JsonInclude, JsonPropertyName("index")] + public ICollection? Index { get; set; } +} + +public sealed partial class PrivilegesCheckDescriptor : SerializableDescriptor +{ + internal PrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public PrivilegesCheckDescriptor() : base() + { + } + + private ICollection? ApplicationValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } + private Action ApplicationDescriptorAction { get; set; } + private Action[] ApplicationDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private ICollection? IndexValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } + private Action IndexDescriptorAction { get; set; } + private Action[] IndexDescriptorActions { get; set; } + + public PrivilegesCheckDescriptor Application(ICollection? application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationValue = application; + return Self; + } + + public PrivilegesCheckDescriptor Application(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public PrivilegesCheckDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorActions = null; + ApplicationDescriptorAction = configure; + return Self; + } + + public PrivilegesCheckDescriptor Application(params Action[] configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public PrivilegesCheckDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + public PrivilegesCheckDescriptor Index(ICollection? index) + { + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexValue = index; + return Self; + } + + public PrivilegesCheckDescriptor Index(Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor descriptor) + { + IndexValue = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexDescriptor = descriptor; + return Self; + } + + public PrivilegesCheckDescriptor Index(Action configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorActions = null; + IndexDescriptorAction = configure; + return Self; + } + + public PrivilegesCheckDescriptor Index(params Action[] configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorActions is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + foreach (var action in ApplicationDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationValue is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (IndexDescriptor is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndexDescriptor, options); + writer.WriteEndArray(); + } + else if (IndexDescriptorAction is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndexDescriptorActions is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + foreach (var action in IndexDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndexPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndexValue is not null) + { + writer.WritePropertyName("index"); + JsonSerializer.Serialize(writer, IndexValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryRole.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryRole.g.cs new file mode 100644 index 00000000000..1d0d895ca52 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryRole.g.cs @@ -0,0 +1,168 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +internal sealed partial class QueryRoleConverter : JsonConverter +{ + public override QueryRole Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + IReadOnlyCollection? applications = default; + IReadOnlyCollection? cluster = default; + string? description = default; + IReadOnlyCollection? indices = default; + IReadOnlyDictionary? metadata = default; + string name = default; + IReadOnlyCollection? runAs = default; + IReadOnlyCollection? sort = default; + IReadOnlyDictionary? transientMetadata = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + cluster = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "description") + { + description = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + indices = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "metadata") + { + metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "name") + { + name = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "run_as") + { + runAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "_sort") + { + sort = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + transientMetadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return new QueryRole { Applications = applications, Cluster = cluster, Description = description, Indices = indices, Metadata = metadata, Name = name, RunAs = runAs, Sort = sort, TransientMetadata = transientMetadata }; + } + + public override void Write(Utf8JsonWriter writer, QueryRole value, JsonSerializerOptions options) + { + throw new NotImplementedException("'QueryRole' is a readonly type, used only on responses and does not support being written to JSON."); + } +} + +[JsonConverter(typeof(QueryRoleConverter))] +public sealed partial class QueryRole +{ + /// + /// + /// A list of application privilege entries + /// + /// + public IReadOnlyCollection? Applications { get; init; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public IReadOnlyCollection? Cluster { get; init; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public string? Description { get; init; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public IReadOnlyCollection? Indices { get; init; } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public IReadOnlyDictionary? Metadata { get; init; } + + /// + /// + /// Name of the role. + /// + /// + public string Name { get; init; } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public IReadOnlyCollection? RunAs { get; init; } + public IReadOnlyCollection? Sort { get; init; } + public IReadOnlyDictionary? TransientMetadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryUser.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryUser.g.cs new file mode 100644 index 00000000000..c26f6535993 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/QueryUser.g.cs @@ -0,0 +1,48 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class QueryUser +{ + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("_sort")] + public IReadOnlyCollection? Sort { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RealmInfo.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RealmInfo.g.cs new file mode 100644 index 00000000000..ada7a06e620 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RealmInfo.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class RealmInfo +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Role.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Role.g.cs new file mode 100644 index 00000000000..f78d20713c7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/Role.g.cs @@ -0,0 +1,48 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class Role +{ + [JsonInclude, JsonPropertyName("applications")] + public IReadOnlyCollection Applications { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("global")] + public IReadOnlyDictionary>>>? Global { get; init; } + [JsonInclude, JsonPropertyName("indices")] + public IReadOnlyCollection Indices { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("role_templates")] + public IReadOnlyCollection? RoleTemplates { get; init; } + [JsonInclude, JsonPropertyName("run_as")] + public IReadOnlyCollection RunAs { get; init; } + [JsonInclude, JsonPropertyName("transient_metadata")] + public IReadOnlyDictionary? TransientMetadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptor.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptor.g.cs new file mode 100644 index 00000000000..237f24160fb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptor.g.cs @@ -0,0 +1,689 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +internal sealed partial class RoleDescriptorConverter : JsonConverter +{ + public override RoleDescriptor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new RoleDescriptor(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + variant.Applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + variant.Cluster = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "description") + { + variant.Description = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + variant.Indices = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "metadata") + { + variant.Metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "run_as") + { + variant.RunAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + variant.TransientMetadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, RoleDescriptor value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Applications is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, value.Applications, options); + } + + if (value.Cluster is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, value.Cluster, options); + } + + if (!string.IsNullOrEmpty(value.Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(value.Description); + } + + if (value.Indices is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, value.Indices, options); + } + + if (value.Metadata is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, value.Metadata, options); + } + + if (value.RunAs is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, value.RunAs, options); + } + + if (value.TransientMetadata is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, value.TransientMetadata, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(RoleDescriptorConverter))] +public sealed partial class RoleDescriptor +{ + /// + /// + /// A list of application privilege entries + /// + /// + public ICollection? Applications { get; set; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public ICollection? Cluster { get; set; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public string? Description { get; set; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public ICollection? Indices { get; set; } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public IDictionary? Metadata { get; set; } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public ICollection? RunAs { get; set; } + public IDictionary? TransientMetadata { get; set; } +} + +public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor> +{ + internal RoleDescriptorDescriptor(Action> configure) => configure.Invoke(this); + + public RoleDescriptorDescriptor() : base() + { + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action> IndicesDescriptorAction { get; set; } + private Action>[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries + /// + /// + public RoleDescriptorDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public RoleDescriptorDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public RoleDescriptorDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public RoleDescriptorDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Indices(Action> configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(params Action>[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public RoleDescriptorDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor +{ + internal RoleDescriptorDescriptor(Action configure) => configure.Invoke(this); + + public RoleDescriptorDescriptor() : base() + { + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action IndicesDescriptorAction { get; set; } + private Action[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries + /// + /// + public RoleDescriptorDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public RoleDescriptorDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public RoleDescriptorDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public RoleDescriptorDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Indices(Action configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(params Action[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public RoleDescriptorDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorRead.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorRead.g.cs new file mode 100644 index 00000000000..d34a6045e38 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorRead.g.cs @@ -0,0 +1,146 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +internal sealed partial class RoleDescriptorReadConverter : JsonConverter +{ + public override RoleDescriptorRead Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + IReadOnlyCollection? applications = default; + IReadOnlyCollection cluster = default; + string? description = default; + IReadOnlyCollection indices = default; + IReadOnlyDictionary? metadata = default; + IReadOnlyCollection? runAs = default; + IReadOnlyDictionary? transientMetadata = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + cluster = JsonSerializer.Deserialize>(ref reader, options); + continue; + } + + if (property == "description") + { + description = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + indices = JsonSerializer.Deserialize>(ref reader, options); + continue; + } + + if (property == "metadata") + { + metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "run_as") + { + runAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + transientMetadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return new RoleDescriptorRead { Applications = applications, Cluster = cluster, Description = description, Indices = indices, Metadata = metadata, RunAs = runAs, TransientMetadata = transientMetadata }; + } + + public override void Write(Utf8JsonWriter writer, RoleDescriptorRead value, JsonSerializerOptions options) + { + throw new NotImplementedException("'RoleDescriptorRead' is a readonly type, used only on responses and does not support being written to JSON."); + } +} + +[JsonConverter(typeof(RoleDescriptorReadConverter))] +public sealed partial class RoleDescriptorRead +{ + /// + /// + /// A list of application privilege entries + /// + /// + public IReadOnlyCollection? Applications { get; init; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public IReadOnlyCollection Cluster { get; init; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public string? Description { get; init; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public IReadOnlyCollection Indices { get; init; } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public IReadOnlyDictionary? Metadata { get; init; } + + /// + /// + /// A list of users that the API keys can impersonate. + /// + /// + public IReadOnlyCollection? RunAs { get; init; } + public IReadOnlyDictionary? TransientMetadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorWrapper.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorWrapper.g.cs new file mode 100644 index 00000000000..55e020abad6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleDescriptorWrapper.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class RoleDescriptorWrapper +{ + [JsonInclude, JsonPropertyName("role_descriptor")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RoleDescriptorRead RoleDescriptor { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMapping.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMapping.g.cs new file mode 100644 index 00000000000..791127292da --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMapping.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class RoleMapping +{ + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection? Roles { get; init; } + [JsonInclude, JsonPropertyName("role_templates")] + public IReadOnlyCollection? RoleTemplates { get; init; } + [JsonInclude, JsonPropertyName("rules")] + public Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule Rules { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMappingRule.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMappingRule.g.cs new file mode 100644 index 00000000000..3c5dc737caf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleMappingRule.g.cs @@ -0,0 +1,272 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(RoleMappingRuleConverter))] +public sealed partial class RoleMappingRule +{ + internal RoleMappingRule(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static RoleMappingRule All(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("all", roleMappingRule); + public static RoleMappingRule Any(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("any", roleMappingRule); + public static RoleMappingRule Except(Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule roleMappingRule) => new RoleMappingRule("except", roleMappingRule); + public static RoleMappingRule Field(Elastic.Clients.Elasticsearch.Serverless.Security.FieldRule fieldRule) => new RoleMappingRule("field", fieldRule); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class RoleMappingRuleConverter : JsonConverter +{ + public override RoleMappingRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "all") + { + variantValue = JsonSerializer.Deserialize?>(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "any") + { + variantValue = JsonSerializer.Deserialize?>(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "except") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "field") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RoleMappingRule' from the response."); + } + + var result = new RoleMappingRule(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, RoleMappingRule value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "all": + JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); + break; + case "any": + JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); + break; + case "except": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule)value.Variant, options); + break; + case "field": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.Security.FieldRule)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor> +{ + internal RoleMappingRuleDescriptor(Action> configure) => configure.Invoke(this); + + public RoleMappingRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleMappingRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); + public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); + public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); + public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); + public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); + public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); + public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Serverless.Security.FieldRule fieldRule) => Set(fieldRule, "field"); + public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor +{ + internal RoleMappingRuleDescriptor(Action configure) => configure.Invoke(this); + + public RoleMappingRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleMappingRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); + public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); + public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); + public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); + public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Serverless.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); + public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); + public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Serverless.Security.FieldRule fieldRule) => Set(fieldRule, "field"); + public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleQuery.g.cs new file mode 100644 index 00000000000..5dee2275fcf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleQuery.g.cs @@ -0,0 +1,384 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(RoleQueryConverter))] +public sealed partial class RoleQuery +{ + internal RoleQuery(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static RoleQuery Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => new RoleQuery("bool", boolQuery); + public static RoleQuery Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => new RoleQuery("exists", existsQuery); + public static RoleQuery Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => new RoleQuery("ids", idsQuery); + public static RoleQuery Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => new RoleQuery("match", matchQuery); + public static RoleQuery MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => new RoleQuery("match_all", matchAllQuery); + public static RoleQuery Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => new RoleQuery("prefix", prefixQuery); + public static RoleQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); + public static RoleQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); + public static RoleQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); + public static RoleQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => new RoleQuery("range", rangeQuery); + public static RoleQuery SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new RoleQuery("simple_query_string", simpleQueryStringQuery); + public static RoleQuery Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => new RoleQuery("term", termQuery); + public static RoleQuery Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => new RoleQuery("terms", termsQuery); + public static RoleQuery Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => new RoleQuery("wildcard", wildcardQuery); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class RoleQueryConverter : JsonConverter +{ + public override RoleQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "bool") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "exists") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "ids") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match_all") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "prefix") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "simple_query_string") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "term") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "wildcard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RoleQuery' from the response."); + } + + var result = new RoleQuery(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, RoleQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "bool": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery)value.Variant, options); + break; + case "exists": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery)value.Variant, options); + break; + case "ids": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery)value.Variant, options); + break; + case "match": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery)value.Variant, options); + break; + case "match_all": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery)value.Variant, options); + break; + case "prefix": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); + break; + case "simple_query_string": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery)value.Variant, options); + break; + case "wildcard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleQueryDescriptor : SerializableDescriptor> +{ + internal RoleQueryDescriptor(Action> configure) => configure.Invoke(this); + + public RoleQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public RoleQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); + public RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public RoleQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); + public RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public RoleQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public RoleQueryDescriptor Match(Action> configure) => Set(configure, "match"); + public RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public RoleQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public RoleQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public RoleQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); + public RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public RoleQueryDescriptor Term(Action> configure) => Set(configure, "term"); + public RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public RoleQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); + public RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public RoleQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleQueryDescriptor : SerializableDescriptor +{ + internal RoleQueryDescriptor(Action configure) => configure.Invoke(this); + + public RoleQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public RoleQueryDescriptor Bool(Action configure) => Set(configure, "bool"); + public RoleQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public RoleQueryDescriptor Exists(Action configure) => Set(configure, "exists"); + public RoleQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public RoleQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public RoleQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public RoleQueryDescriptor Match(Action configure) => Set(configure, "match"); + public RoleQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public RoleQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public RoleQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public RoleQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public RoleQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public RoleQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); + public RoleQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public RoleQueryDescriptor Term(Action configure) => Set(configure, "term"); + public RoleQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public RoleQueryDescriptor Terms(Action configure) => Set(configure, "terms"); + public RoleQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public RoleQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleTemplate.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleTemplate.g.cs new file mode 100644 index 00000000000..6ce4bacb6ce --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/RoleTemplate.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class RoleTemplate +{ + [JsonInclude, JsonPropertyName("format")] + public Elastic.Clients.Elasticsearch.Serverless.Security.TemplateFormat? Format { get; set; } + [JsonInclude, JsonPropertyName("template")] + public Elastic.Clients.Elasticsearch.Serverless.Script Template { get; set; } +} + +public sealed partial class RoleTemplateDescriptor : SerializableDescriptor +{ + internal RoleTemplateDescriptor(Action configure) => configure.Invoke(this); + + public RoleTemplateDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Serverless.Security.TemplateFormat? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.Script TemplateValue { get; set; } + private Elastic.Clients.Elasticsearch.Serverless.ScriptDescriptor TemplateDescriptor { get; set; } + private Action TemplateDescriptorAction { get; set; } + + public RoleTemplateDescriptor Format(Elastic.Clients.Elasticsearch.Serverless.Security.TemplateFormat? format) + { + FormatValue = format; + return Self; + } + + public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.Serverless.Script template) + { + TemplateDescriptor = null; + TemplateDescriptorAction = null; + TemplateValue = template; + return Self; + } + + public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.Serverless.ScriptDescriptor descriptor) + { + TemplateValue = null; + TemplateDescriptorAction = null; + TemplateDescriptor = descriptor; + return Self; + } + + public RoleTemplateDescriptor Template(Action configure) + { + TemplateValue = null; + TemplateDescriptor = null; + TemplateDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FormatValue is not null) + { + writer.WritePropertyName("format"); + JsonSerializer.Serialize(writer, FormatValue, options); + } + + if (TemplateDescriptor is not null) + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, TemplateDescriptor, options); + } + else if (TemplateDescriptorAction is not null) + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Serverless.ScriptDescriptor(TemplateDescriptorAction), options); + } + else + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, TemplateValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ServiceToken.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ServiceToken.g.cs new file mode 100644 index 00000000000..d3fb27827d5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/ServiceToken.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class ServiceToken +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("value")] + public string Value { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/TotalUserProfiles.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/TotalUserProfiles.g.cs new file mode 100644 index 00000000000..44b35e525e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/TotalUserProfiles.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class TotalUserProfiles +{ + [JsonInclude, JsonPropertyName("relation")] + public string Relation { get; init; } + [JsonInclude, JsonPropertyName("value")] + public long Value { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserIndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserIndicesPrivileges.g.cs new file mode 100644 index 00000000000..3693ef101e1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserIndicesPrivileges.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserIndicesPrivileges +{ + /// + /// + /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. + /// + /// + [JsonInclude, JsonPropertyName("allow_restricted_indices")] + public bool AllowRestrictedIndices { get; init; } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + [JsonInclude, JsonPropertyName("field_security")] + public IReadOnlyCollection? FieldSecurity { get; init; } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + [JsonInclude, JsonPropertyName("names")] + [SingleOrManyCollectionConverter(typeof(string))] + public IReadOnlyCollection Names { get; init; } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public IReadOnlyCollection Privileges { get; init; } + + /// + /// + /// Search queries that define the documents the user has access to. A document within the specified indices must match these queries for it to be accessible by the owners of the role. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public object? Query { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfile.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfile.g.cs new file mode 100644 index 00000000000..96482c37b66 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfile.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserProfile +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileHitMetadata.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileHitMetadata.g.cs new file mode 100644 index 00000000000..739521380a7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileHitMetadata.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserProfileHitMetadata +{ + [JsonInclude, JsonPropertyName("_primary_term")] + public long PrimaryTerm { get; init; } + [JsonInclude, JsonPropertyName("_seq_no")] + public long SeqNo { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileUser.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileUser.g.cs new file mode 100644 index 00000000000..59424cab9a3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileUser.g.cs @@ -0,0 +1,44 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserProfileUser +{ + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("realm_domain")] + public string? RealmDomain { get; init; } + [JsonInclude, JsonPropertyName("realm_name")] + public string RealmName { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileWithMetadata.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileWithMetadata.g.cs new file mode 100644 index 00000000000..782c2ff537a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserProfileWithMetadata.g.cs @@ -0,0 +1,46 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserProfileWithMetadata +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("_doc")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserProfileHitMetadata Doc { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("last_synchronized")] + public long LastSynchronized { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Serverless.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserQuery.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserQuery.g.cs new file mode 100644 index 00000000000..d030a6ecd17 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserQuery.g.cs @@ -0,0 +1,384 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +[JsonConverter(typeof(UserQueryConverter))] +public sealed partial class UserQuery +{ + internal UserQuery(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static UserQuery Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => new UserQuery("bool", boolQuery); + public static UserQuery Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => new UserQuery("exists", existsQuery); + public static UserQuery Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => new UserQuery("ids", idsQuery); + public static UserQuery Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => new UserQuery("match", matchQuery); + public static UserQuery MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => new UserQuery("match_all", matchAllQuery); + public static UserQuery Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => new UserQuery("prefix", prefixQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new UserQuery("simple_query_string", simpleQueryStringQuery); + public static UserQuery Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => new UserQuery("term", termQuery); + public static UserQuery Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => new UserQuery("terms", termsQuery); + public static UserQuery Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => new UserQuery("wildcard", wildcardQuery); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class UserQueryConverter : JsonConverter +{ + public override UserQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "bool") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "exists") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "ids") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match_all") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "prefix") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "simple_query_string") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "term") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "wildcard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'UserQuery' from the response."); + } + + var result = new UserQuery(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, UserQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "bool": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery)value.Variant, options); + break; + case "exists": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery)value.Variant, options); + break; + case "ids": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery)value.Variant, options); + break; + case "match": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery)value.Variant, options); + break; + case "match_all": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery)value.Variant, options); + break; + case "prefix": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); + break; + case "simple_query_string": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery)value.Variant, options); + break; + case "wildcard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class UserQueryDescriptor : SerializableDescriptor> +{ + internal UserQueryDescriptor(Action> configure) => configure.Invoke(this); + + public UserQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private UserQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public UserQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); + public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public UserQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); + public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public UserQueryDescriptor Match(Action> configure) => Set(configure, "match"); + public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public UserQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public UserQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); + public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public UserQueryDescriptor Term(Action> configure) => Set(configure, "term"); + public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public UserQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); + public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public UserQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class UserQueryDescriptor : SerializableDescriptor +{ + internal UserQueryDescriptor(Action configure) => configure.Invoke(this); + + public UserQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private UserQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public UserQueryDescriptor Bool(Action configure) => Set(configure, "bool"); + public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public UserQueryDescriptor Exists(Action configure) => Set(configure, "exists"); + public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public UserQueryDescriptor Match(Action configure) => Set(configure, "match"); + public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public UserQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public UserQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); + public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public UserQueryDescriptor Term(Action configure) => Set(configure, "term"); + public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public UserQueryDescriptor Terms(Action configure) => Set(configure, "terms"); + public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.Serverless.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public UserQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserRealm.g.cs b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserRealm.g.cs new file mode 100644 index 00000000000..6a51e1b4f4e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Serverless/_Generated/Types/Security/UserRealm.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Serverless.Fluent; +using Elastic.Clients.Elasticsearch.Serverless.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Serverless.Security; + +public sealed partial class UserRealm +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch.Shared/Serialization/SingleOrManySerializationHelper.cs b/src/Elastic.Clients.Elasticsearch.Shared/Serialization/SingleOrManySerializationHelper.cs index 27e976980c7..c7b6e6f25b1 100644 --- a/src/Elastic.Clients.Elasticsearch.Shared/Serialization/SingleOrManySerializationHelper.cs +++ b/src/Elastic.Clients.Elasticsearch.Shared/Serialization/SingleOrManySerializationHelper.cs @@ -14,7 +14,7 @@ namespace Elastic.Clients.Elasticsearch.Serialization; internal static class SingleOrManySerializationHelper { - public static IList Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options) + public static List Deserialize(ref Utf8JsonReader reader, JsonSerializerOptions options) { switch (reader.TokenType) { diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs index b31d881cc58..5d13d50a126 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs @@ -293,6 +293,58 @@ internal static class ApiUrlLookup internal static ApiUrls SearchApplicationPut = new ApiUrls(new[] { "_application/search_application/{name}" }); internal static ApiUrls SearchApplicationPutBehavioralAnalytics = new ApiUrls(new[] { "_application/analytics/{name}" }); internal static ApiUrls SearchApplicationSearch = new ApiUrls(new[] { "_application/search_application/{name}/_search" }); + internal static ApiUrls SecurityActivateUserProfile = new ApiUrls(new[] { "_security/profile/_activate" }); + internal static ApiUrls SecurityAuthenticate = new ApiUrls(new[] { "_security/_authenticate" }); + internal static ApiUrls SecurityChangePassword = new ApiUrls(new[] { "_security/user/{username}/_password", "_security/user/_password" }); + internal static ApiUrls SecurityClearApiKeyCache = new ApiUrls(new[] { "_security/api_key/{ids}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedPrivileges = new ApiUrls(new[] { "_security/privilege/{application}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedRealms = new ApiUrls(new[] { "_security/realm/{realms}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedRoles = new ApiUrls(new[] { "_security/role/{name}/_clear_cache" }); + internal static ApiUrls SecurityClearCachedServiceTokens = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}/_clear_cache" }); + internal static ApiUrls SecurityCreateApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityCreateServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}", "_security/service/{namespace}/{service}/credential/token" }); + internal static ApiUrls SecurityDeletePrivileges = new ApiUrls(new[] { "_security/privilege/{application}/{name}" }); + internal static ApiUrls SecurityDeleteRole = new ApiUrls(new[] { "_security/role/{name}" }); + internal static ApiUrls SecurityDeleteRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" }); + internal static ApiUrls SecurityDeleteServiceToken = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential/token/{name}" }); + internal static ApiUrls SecurityDeleteUser = new ApiUrls(new[] { "_security/user/{username}" }); + internal static ApiUrls SecurityDisableUser = new ApiUrls(new[] { "_security/user/{username}/_disable" }); + internal static ApiUrls SecurityDisableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_disable" }); + internal static ApiUrls SecurityEnableUser = new ApiUrls(new[] { "_security/user/{username}/_enable" }); + internal static ApiUrls SecurityEnableUserProfile = new ApiUrls(new[] { "_security/profile/{uid}/_enable" }); + internal static ApiUrls SecurityEnrollKibana = new ApiUrls(new[] { "_security/enroll/kibana" }); + internal static ApiUrls SecurityEnrollNode = new ApiUrls(new[] { "_security/enroll/node" }); + internal static ApiUrls SecurityGetApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityGetBuiltinPrivileges = new ApiUrls(new[] { "_security/privilege/_builtin" }); + internal static ApiUrls SecurityGetPrivileges = new ApiUrls(new[] { "_security/privilege", "_security/privilege/{application}", "_security/privilege/{application}/{name}" }); + internal static ApiUrls SecurityGetRole = new ApiUrls(new[] { "_security/role/{name}", "_security/role" }); + internal static ApiUrls SecurityGetRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}", "_security/role_mapping" }); + internal static ApiUrls SecurityGetServiceAccounts = new ApiUrls(new[] { "_security/service/{namespace}/{service}", "_security/service/{namespace}", "_security/service" }); + internal static ApiUrls SecurityGetServiceCredentials = new ApiUrls(new[] { "_security/service/{namespace}/{service}/credential" }); + internal static ApiUrls SecurityGetToken = new ApiUrls(new[] { "_security/oauth2/token" }); + internal static ApiUrls SecurityGetUser = new ApiUrls(new[] { "_security/user/{username}", "_security/user" }); + internal static ApiUrls SecurityGetUserPrivileges = new ApiUrls(new[] { "_security/user/_privileges" }); + internal static ApiUrls SecurityGetUserProfile = new ApiUrls(new[] { "_security/profile/{uid}" }); + internal static ApiUrls SecurityGrantApiKey = new ApiUrls(new[] { "_security/api_key/grant" }); + internal static ApiUrls SecurityHasPrivileges = new ApiUrls(new[] { "_security/user/_has_privileges", "_security/user/{user}/_has_privileges" }); + internal static ApiUrls SecurityHasPrivilegesUserProfile = new ApiUrls(new[] { "_security/profile/_has_privileges" }); + internal static ApiUrls SecurityInvalidateApiKey = new ApiUrls(new[] { "_security/api_key" }); + internal static ApiUrls SecurityInvalidateToken = new ApiUrls(new[] { "_security/oauth2/token" }); + internal static ApiUrls SecurityPutPrivileges = new ApiUrls(new[] { "_security/privilege" }); + internal static ApiUrls SecurityPutRole = new ApiUrls(new[] { "_security/role/{name}" }); + internal static ApiUrls SecurityPutRoleMapping = new ApiUrls(new[] { "_security/role_mapping/{name}" }); + internal static ApiUrls SecurityPutUser = new ApiUrls(new[] { "_security/user/{username}" }); + internal static ApiUrls SecurityQueryApiKeys = new ApiUrls(new[] { "_security/_query/api_key" }); + internal static ApiUrls SecurityQueryUser = new ApiUrls(new[] { "_security/_query/user" }); + internal static ApiUrls SecuritySamlAuthenticate = new ApiUrls(new[] { "_security/saml/authenticate" }); + internal static ApiUrls SecuritySamlCompleteLogout = new ApiUrls(new[] { "_security/saml/complete_logout" }); + internal static ApiUrls SecuritySamlInvalidate = new ApiUrls(new[] { "_security/saml/invalidate" }); + internal static ApiUrls SecuritySamlLogout = new ApiUrls(new[] { "_security/saml/logout" }); + internal static ApiUrls SecuritySamlPrepareAuthentication = new ApiUrls(new[] { "_security/saml/prepare" }); + internal static ApiUrls SecuritySamlServiceProviderMetadata = new ApiUrls(new[] { "_security/saml/metadata/{realm_name}" }); + internal static ApiUrls SecuritySuggestUserProfiles = new ApiUrls(new[] { "_security/profile/_suggest" }); + internal static ApiUrls SecurityUpdateApiKey = new ApiUrls(new[] { "_security/api_key/{id}" }); + internal static ApiUrls SecurityUpdateUserProfileData = new ApiUrls(new[] { "_security/profile/{uid}/_data" }); internal static ApiUrls SnapshotCleanupRepository = new ApiUrls(new[] { "_snapshot/{repository}/_cleanup" }); internal static ApiUrls SnapshotClone = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}" }); internal static ApiUrls SnapshotCreate = new ApiUrls(new[] { "_snapshot/{repository}/{snapshot}" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs new file mode 100644 index 00000000000..55679e7bad4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileRequest.g.cs @@ -0,0 +1,136 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ActivateUserProfileRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates or updates a user profile on behalf of another user. +/// +/// +public sealed partial class ActivateUserProfileRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.activate_user_profile"; + + [JsonInclude, JsonPropertyName("access_token")] + public string? AccessToken { get; set; } + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Security.GrantType GrantType { get; set; } + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + [JsonInclude, JsonPropertyName("username")] + public string? Username { get; set; } +} + +/// +/// +/// Creates or updates a user profile on behalf of another user. +/// +/// +public sealed partial class ActivateUserProfileRequestDescriptor : RequestDescriptor +{ + internal ActivateUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public ActivateUserProfileRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityActivateUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.activate_user_profile"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private string? UsernameValue { get; set; } + + public ActivateUserProfileRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + public ActivateUserProfileRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.GrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + public ActivateUserProfileRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + public ActivateUserProfileRequestDescriptor Username(string? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(UsernameValue)) + { + writer.WritePropertyName("username"); + writer.WriteStringValue(UsernameValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs new file mode 100644 index 00000000000..e3935e35022 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ActivateUserProfileResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ActivateUserProfileResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("_doc")] + public Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("last_synchronized")] + public long LastSynchronized { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs new file mode 100644 index 00000000000..186cd2ecac7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateRequest.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class AuthenticateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Authenticate a user. +/// Authenticates a user and returns information about the authenticated user. +/// Include the user information in a basic auth header. +/// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. +/// If the user cannot be authenticated, this API returns a 401 status code. +/// +/// +public sealed partial class AuthenticateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.authenticate"; +} + +/// +/// +/// Authenticate a user. +/// Authenticates a user and returns information about the authenticated user. +/// Include the user information in a basic auth header. +/// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. +/// If the user cannot be authenticated, this API returns a 401 status code. +/// +/// +public sealed partial class AuthenticateRequestDescriptor : RequestDescriptor +{ + internal AuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + + public AuthenticateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.authenticate"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs new file mode 100644 index 00000000000..dc51b50bb4d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/AuthenticateResponse.g.cs @@ -0,0 +1,53 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class AuthenticateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_key")] + public Elastic.Clients.Elasticsearch.Security.ApiKey? ApiKey { get; init; } + [JsonInclude, JsonPropertyName("authentication_realm")] + public Elastic.Clients.Elasticsearch.Security.RealmInfo AuthenticationRealm { get; init; } + [JsonInclude, JsonPropertyName("authentication_type")] + public string AuthenticationType { get; init; } + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("lookup_realm")] + public Elastic.Clients.Elasticsearch.Security.RealmInfo LookupRealm { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("token")] + public Elastic.Clients.Elasticsearch.Security.AuthenticateToken? Token { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs new file mode 100644 index 00000000000..4bc433d2031 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordRequest.g.cs @@ -0,0 +1,171 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ChangePasswordRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Changes the passwords of users in the native realm and built-in users. +/// +/// +public sealed partial class ChangePasswordRequest : PlainRequest +{ + public ChangePasswordRequest() + { + } + + public ChangePasswordRequest(Elastic.Clients.Elasticsearch.Username? username) : base(r => r.Optional("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityChangePassword; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.change_password"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// The new password value. Passwords must be at least 6 characters long. + /// + /// + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + + /// + /// + /// A hash of the new password value. This must be produced using the same + /// hashing algorithm as has been configured for password storage. For more details, + /// see the explanation of the xpack.security.authc.password_hashing.algorithm + /// setting. + /// + /// + [JsonInclude, JsonPropertyName("password_hash")] + public string? PasswordHash { get; set; } +} + +/// +/// +/// Changes the passwords of users in the native realm and built-in users. +/// +/// +public sealed partial class ChangePasswordRequestDescriptor : RequestDescriptor +{ + internal ChangePasswordRequestDescriptor(Action configure) => configure.Invoke(this); + + public ChangePasswordRequestDescriptor(Elastic.Clients.Elasticsearch.Username? username) : base(r => r.Optional("username", username)) + { + } + + public ChangePasswordRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityChangePassword; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.change_password"; + + public ChangePasswordRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public ChangePasswordRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + RouteValues.Optional("username", username); + return Self; + } + + private string? PasswordValue { get; set; } + private string? PasswordHashValue { get; set; } + + /// + /// + /// The new password value. Passwords must be at least 6 characters long. + /// + /// + public ChangePasswordRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + /// + /// + /// A hash of the new password value. This must be produced using the same + /// hashing algorithm as has been configured for password storage. For more details, + /// see the explanation of the xpack.security.authc.password_hashing.algorithm + /// setting. + /// + /// + public ChangePasswordRequestDescriptor PasswordHash(string? passwordHash) + { + PasswordHashValue = passwordHash; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(PasswordHashValue)) + { + writer.WritePropertyName("password_hash"); + writer.WriteStringValue(PasswordHashValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs new file mode 100644 index 00000000000..00c66d00ff6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ChangePasswordResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ChangePasswordResponse : ElasticsearchResponse +{ +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs new file mode 100644 index 00000000000..db6a20d7fab --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheRequest.g.cs @@ -0,0 +1,88 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearApiKeyCacheRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts a subset of all entries from the API key cache. +/// The cache is also automatically cleared on state changes of the security index. +/// +/// +public sealed partial class ClearApiKeyCacheRequest : PlainRequest +{ + public ClearApiKeyCacheRequest(Elastic.Clients.Elasticsearch.Ids ids) : base(r => r.Required("ids", ids)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_api_key_cache"; +} + +/// +/// +/// Evicts a subset of all entries from the API key cache. +/// The cache is also automatically cleared on state changes of the security index. +/// +/// +public sealed partial class ClearApiKeyCacheRequestDescriptor : RequestDescriptor +{ + internal ClearApiKeyCacheRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearApiKeyCacheRequestDescriptor(Elastic.Clients.Elasticsearch.Ids ids) : base(r => r.Required("ids", ids)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearApiKeyCache; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_api_key_cache"; + + public ClearApiKeyCacheRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + { + RouteValues.Required("ids", ids); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs new file mode 100644 index 00000000000..65cdf04e9b0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearApiKeyCacheResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearApiKeyCacheResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs new file mode 100644 index 00000000000..35cb210f26f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts application privileges from the native application privileges cache. +/// +/// +public sealed partial class ClearCachedPrivilegesRequest : PlainRequest +{ + public ClearCachedPrivilegesRequest(Elastic.Clients.Elasticsearch.Name application) : base(r => r.Required("application", application)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_privileges"; +} + +/// +/// +/// Evicts application privileges from the native application privileges cache. +/// +/// +public sealed partial class ClearCachedPrivilegesRequestDescriptor : RequestDescriptor +{ + internal ClearCachedPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application) : base(r => r.Required("application", application)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_privileges"; + + public ClearCachedPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name application) + { + RouteValues.Required("application", application); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs new file mode 100644 index 00000000000..d912eaa3cfd --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs new file mode 100644 index 00000000000..d10e676048e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedRealmsRequestParameters : RequestParameters +{ + /// + /// + /// Comma-separated list of usernames to clear from the cache + /// + /// + public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } +} + +/// +/// +/// Evicts users from the user cache. Can completely clear the cache or evict specific users. +/// +/// +public sealed partial class ClearCachedRealmsRequest : PlainRequest +{ + public ClearCachedRealmsRequest(Elastic.Clients.Elasticsearch.Names realms) : base(r => r.Required("realms", realms)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_realms"; + + /// + /// + /// Comma-separated list of usernames to clear from the cache + /// + /// + [JsonIgnore] + public ICollection? Usernames { get => Q?>("usernames"); set => Q("usernames", value); } +} + +/// +/// +/// Evicts users from the user cache. Can completely clear the cache or evict specific users. +/// +/// +public sealed partial class ClearCachedRealmsRequestDescriptor : RequestDescriptor +{ + internal ClearCachedRealmsRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedRealmsRequestDescriptor(Elastic.Clients.Elasticsearch.Names realms) : base(r => r.Required("realms", realms)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRealms; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_realms"; + + public ClearCachedRealmsRequestDescriptor Usernames(ICollection? usernames) => Qs("usernames", usernames); + + public ClearCachedRealmsRequestDescriptor Realms(Elastic.Clients.Elasticsearch.Names realms) + { + RouteValues.Required("realms", realms); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs new file mode 100644 index 00000000000..7f2e195891e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRealmsResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedRealmsResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs new file mode 100644 index 00000000000..236c3e471d7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedRolesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts roles from the native role cache. +/// +/// +public sealed partial class ClearCachedRolesRequest : PlainRequest +{ + public ClearCachedRolesRequest(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_roles"; +} + +/// +/// +/// Evicts roles from the native role cache. +/// +/// +public sealed partial class ClearCachedRolesRequestDescriptor : RequestDescriptor +{ + internal ClearCachedRolesRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedRolesRequestDescriptor(Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedRoles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_roles"; + + public ClearCachedRolesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs new file mode 100644 index 00000000000..5257f5d7b69 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedRolesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedRolesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs new file mode 100644 index 00000000000..3335cd52ea1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensRequest.g.cs @@ -0,0 +1,98 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedServiceTokensRequestParameters : RequestParameters +{ +} + +/// +/// +/// Evicts tokens from the service account token caches. +/// +/// +public sealed partial class ClearCachedServiceTokensRequest : PlainRequest +{ + public ClearCachedServiceTokensRequest(string ns, string service, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_service_tokens"; +} + +/// +/// +/// Evicts tokens from the service account token caches. +/// +/// +public sealed partial class ClearCachedServiceTokensRequestDescriptor : RequestDescriptor +{ + internal ClearCachedServiceTokensRequestDescriptor(Action configure) => configure.Invoke(this); + + public ClearCachedServiceTokensRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityClearCachedServiceTokens; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.clear_cached_service_tokens"; + + public ClearCachedServiceTokensRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + public ClearCachedServiceTokensRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public ClearCachedServiceTokensRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs new file mode 100644 index 00000000000..b1b33e09cf9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/ClearCachedServiceTokensResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClearCachedServiceTokensResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster_name")] + public string ClusterName { get; init; } + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary Nodes { get; init; } + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics NodeStats { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs new file mode 100644 index 00000000000..a435b2e2d3e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyRequest.g.cs @@ -0,0 +1,314 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class CreateApiKeyRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// Specifies the name for this API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Name? Name { get; set; } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IDictionary? RoleDescriptors { get; set; } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor, CreateApiKeyRequestParameters> +{ + internal CreateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public CreateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } + private IDictionary> RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Specifies the name for this API key. + /// + /// + public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public CreateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Create an API key. +/// Creates an API key for access without requiring basic authentication. +/// A successful request returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class CreateApiKeyRequestDescriptor : RequestDescriptor +{ + internal CreateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public CreateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.create_api_key"; + + public CreateApiKeyRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } + private IDictionary RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public CreateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public CreateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Specifies the name for this API key. + /// + /// + public CreateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public CreateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs new file mode 100644 index 00000000000..440179df1b5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateApiKeyResponse.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class CreateApiKeyResponse : ElasticsearchResponse +{ + /// + /// + /// Generated API key. + /// + /// + [JsonInclude, JsonPropertyName("api_key")] + public string ApiKey { get; init; } + + /// + /// + /// API key credentials which is the base64-encoding of + /// the UTF-8 representation of id and api_key joined + /// by a colon (:). + /// + /// + [JsonInclude, JsonPropertyName("encoded")] + public string Encoded { get; init; } + + /// + /// + /// Expiration in milliseconds for the API key. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + + /// + /// + /// Unique ID for this API key. + /// + /// + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + + /// + /// + /// Specifies the name for this API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs new file mode 100644 index 00000000000..66c4cdf3077 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenRequest.g.cs @@ -0,0 +1,122 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class CreateServiceTokenRequestParameters : RequestParameters +{ + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates a service accounts token for access without requiring basic authentication. +/// +/// +public sealed partial class CreateServiceTokenRequest : PlainRequest +{ + public CreateServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + { + } + + public CreateServiceTokenRequest(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.create_service_token"; + + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates a service accounts token for access without requiring basic authentication. +/// +/// +public sealed partial class CreateServiceTokenRequestDescriptor : RequestDescriptor +{ + internal CreateServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public CreateServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) : base(r => r.Required("namespace", ns).Required("service", service).Optional("name", name)) + { + } + + public CreateServiceTokenRequestDescriptor(string ns, string service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityCreateServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.create_service_token"; + + public CreateServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public CreateServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + { + RouteValues.Optional("name", name); + return Self; + } + + public CreateServiceTokenRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public CreateServiceTokenRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs new file mode 100644 index 00000000000..925204e9e00 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/CreateServiceTokenResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class CreateServiceTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("created")] + public bool Created { get; init; } + [JsonInclude, JsonPropertyName("token")] + public Elastic.Clients.Elasticsearch.Security.ServiceToken Token { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs new file mode 100644 index 00000000000..05be0c4c031 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesRequest.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeletePrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes application privileges. +/// +/// +public sealed partial class DeletePrivilegesRequest : PlainRequest +{ + public DeletePrivilegesRequest(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("application", application).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_privileges"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes application privileges. +/// +/// +public sealed partial class DeletePrivilegesRequestDescriptor : RequestDescriptor +{ + internal DeletePrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeletePrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) : base(r => r.Required("application", application).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeletePrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_privileges"; + + public DeletePrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DeletePrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name application) + { + RouteValues.Required("application", application); + return Self; + } + + public DeletePrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs new file mode 100644 index 00000000000..53deacbb7d4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeletePrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeletePrivilegesResponse : DictionaryResponse> +{ + public DeletePrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public DeletePrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs new file mode 100644 index 00000000000..ab3c2fb6a40 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteRoleMappingRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes role mappings. +/// +/// +public sealed partial class DeleteRoleMappingRequest : PlainRequest +{ + public DeleteRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role_mapping"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes role mappings. +/// +/// +public sealed partial class DeleteRoleMappingRequestDescriptor : RequestDescriptor +{ + internal DeleteRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role_mapping"; + + public DeleteRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs new file mode 100644 index 00000000000..ba9829eeecf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleMappingResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteRoleMappingResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs new file mode 100644 index 00000000000..786ba657268 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes roles in the native realm. +/// +/// +public sealed partial class DeleteRoleRequest : PlainRequest +{ + public DeleteRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Removes roles in the native realm. +/// +/// +public sealed partial class DeleteRoleRequestDescriptor : RequestDescriptor +{ + internal DeleteRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_role"; + + public DeleteRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs new file mode 100644 index 00000000000..8733410e218 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteRoleResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteRoleResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs new file mode 100644 index 00000000000..ebc4ea9867c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenRequest.g.cs @@ -0,0 +1,114 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteServiceTokenRequestParameters : RequestParameters +{ + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes a service account token. +/// +/// +public sealed partial class DeleteServiceTokenRequest : PlainRequest +{ + public DeleteServiceTokenRequest(string ns, string service, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_service_token"; + + /// + /// + /// If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes a service account token. +/// +/// +public sealed partial class DeleteServiceTokenRequestDescriptor : RequestDescriptor +{ + internal DeleteServiceTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteServiceTokenRequestDescriptor(string ns, string service, Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("namespace", ns).Required("service", service).Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteServiceToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_service_token"; + + public DeleteServiceTokenRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteServiceTokenRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + public DeleteServiceTokenRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public DeleteServiceTokenRequestDescriptor Service(string service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs new file mode 100644 index 00000000000..a9ad6329929 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteServiceTokenResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteServiceTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs new file mode 100644 index 00000000000..10f7b9e77d2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteUserRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes users from the native realm. +/// +/// +public sealed partial class DeleteUserRequest : PlainRequest +{ + public DeleteUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_user"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Deletes users from the native realm. +/// +/// +public sealed partial class DeleteUserRequestDescriptor : RequestDescriptor +{ + internal DeleteUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public DeleteUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDeleteUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.delete_user"; + + public DeleteUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DeleteUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + { + RouteValues.Required("username", username); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs new file mode 100644 index 00000000000..3ccd3bafba1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DeleteUserResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DeleteUserResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs new file mode 100644 index 00000000000..fe1f12b7d2d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileRequest.g.cs @@ -0,0 +1,106 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DisableUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables a user profile so it's not visible in user profile searches. +/// +/// +public sealed partial class DisableUserProfileRequest : PlainRequest +{ + public DisableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user_profile"; + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables a user profile so it's not visible in user profile searches. +/// +/// +public sealed partial class DisableUserProfileRequestDescriptor : RequestDescriptor +{ + internal DisableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public DisableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user_profile"; + + public DisableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DisableUserProfileRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs new file mode 100644 index 00000000000..b6a983cec33 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserProfileResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DisableUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs new file mode 100644 index 00000000000..da3859780cf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DisableUserRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables users in the native realm. +/// +/// +public sealed partial class DisableUserRequest : PlainRequest +{ + public DisableUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Disables users in the native realm. +/// +/// +public sealed partial class DisableUserRequestDescriptor : RequestDescriptor +{ + internal DisableUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public DisableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityDisableUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.disable_user"; + + public DisableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public DisableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + { + RouteValues.Required("username", username); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs new file mode 100644 index 00000000000..91cd0736f94 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/DisableUserResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class DisableUserResponse : ElasticsearchResponse +{ +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs new file mode 100644 index 00000000000..ea1e8851737 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileRequest.g.cs @@ -0,0 +1,106 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnableUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables a user profile so it's visible in user profile searches. +/// +/// +public sealed partial class EnableUserProfileRequest : PlainRequest +{ + public EnableUserProfileRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user_profile"; + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables a user profile so it's visible in user profile searches. +/// +/// +public sealed partial class EnableUserProfileRequestDescriptor : RequestDescriptor +{ + internal EnableUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public EnableUserProfileRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user_profile"; + + public EnableUserProfileRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public EnableUserProfileRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs new file mode 100644 index 00000000000..01d90498655 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserProfileResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnableUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs new file mode 100644 index 00000000000..a475c6e3315 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserRequest.g.cs @@ -0,0 +1,102 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnableUserRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables users in the native realm. +/// +/// +public sealed partial class EnableUserRequest : PlainRequest +{ + public EnableUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Enables users in the native realm. +/// +/// +public sealed partial class EnableUserRequestDescriptor : RequestDescriptor +{ + internal EnableUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public EnableUserRequestDescriptor(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnableUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enable_user"; + + public EnableUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public EnableUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username username) + { + RouteValues.Required("username", username); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs new file mode 100644 index 00000000000..e839c5abf6f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnableUserResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnableUserResponse : ElasticsearchResponse +{ +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs new file mode 100644 index 00000000000..5ba28f335d2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaRequest.g.cs @@ -0,0 +1,76 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnrollKibanaRequestParameters : RequestParameters +{ +} + +/// +/// +/// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. +/// +/// +public sealed partial class EnrollKibanaRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollKibana; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enroll_kibana"; +} + +/// +/// +/// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. +/// +/// +public sealed partial class EnrollKibanaRequestDescriptor : RequestDescriptor +{ + internal EnrollKibanaRequestDescriptor(Action configure) => configure.Invoke(this); + + public EnrollKibanaRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollKibana; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enroll_kibana"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs new file mode 100644 index 00000000000..79907207140 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollKibanaResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnrollKibanaResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("http_ca")] + public string HttpCa { get; init; } + [JsonInclude, JsonPropertyName("token")] + public Elastic.Clients.Elasticsearch.Security.KibanaToken Token { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs new file mode 100644 index 00000000000..3e79a389c1b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeRequest.g.cs @@ -0,0 +1,76 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnrollNodeRequestParameters : RequestParameters +{ +} + +/// +/// +/// Allows a new node to join an existing cluster with security features enabled. +/// +/// +public sealed partial class EnrollNodeRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollNode; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enroll_node"; +} + +/// +/// +/// Allows a new node to join an existing cluster with security features enabled. +/// +/// +public sealed partial class EnrollNodeRequestDescriptor : RequestDescriptor +{ + internal EnrollNodeRequestDescriptor(Action configure) => configure.Invoke(this); + + public EnrollNodeRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityEnrollNode; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.enroll_node"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs new file mode 100644 index 00000000000..5d34b09a546 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/EnrollNodeResponse.g.cs @@ -0,0 +1,43 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class EnrollNodeResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("http_ca_cert")] + public string HttpCaCert { get; init; } + [JsonInclude, JsonPropertyName("http_ca_key")] + public string HttpCaKey { get; init; } + [JsonInclude, JsonPropertyName("nodes_addresses")] + public IReadOnlyCollection NodesAddresses { get; init; } + [JsonInclude, JsonPropertyName("transport_ca_cert")] + public string TransportCaCert { get; init; } + [JsonInclude, JsonPropertyName("transport_cert")] + public string TransportCert { get; init; } + [JsonInclude, JsonPropertyName("transport_key")] + public string TransportKey { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs new file mode 100644 index 00000000000..3b531462d74 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyRequest.g.cs @@ -0,0 +1,228 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetApiKeyRequestParameters : RequestParameters +{ + /// + /// + /// A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as owner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. + /// + /// + public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } + + /// + /// + /// An API key id. + /// This parameter cannot be used with any of name, realm_name or username. + /// + /// + public Elastic.Clients.Elasticsearch.Id? Id { get => Q("id"); set => Q("id", value); } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of id, realm_name or username. + /// It supports prefix search with wildcard. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Name { get => Q("name"); set => Q("name", value); } + + /// + /// + /// A boolean flag that can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + public bool? Owner { get => Q("owner"); set => Q("owner", value); } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Name? RealmName { get => Q("realm_name"); set => Q("realm_name", value); } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + public Elastic.Clients.Elasticsearch.Username? Username { get => Q("username"); set => Q("username", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors + /// associated with the API key. An API key's actual + /// permission is the intersection of its assigned role + /// descriptors and the owner user's role descriptors. + /// + /// + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Get API key information. +/// Retrieves information for one or more API keys. +/// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. +/// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. +/// +/// +public sealed partial class GetApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_api_key"; + + /// + /// + /// A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as owner or name. If active_only is false, the response will include both active and inactive (expired or invalidated) keys. + /// + /// + [JsonIgnore] + public bool? ActiveOnly { get => Q("active_only"); set => Q("active_only", value); } + + /// + /// + /// An API key id. + /// This parameter cannot be used with any of name, realm_name or username. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Id? Id { get => Q("id"); set => Q("id", value); } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of id, realm_name or username. + /// It supports prefix search with wildcard. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Name? Name { get => Q("name"); set => Q("name", value); } + + /// + /// + /// A boolean flag that can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + [JsonIgnore] + public bool? Owner { get => Q("owner"); set => Q("owner", value); } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Name? RealmName { get => Q("realm_name"); set => Q("realm_name", value); } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either id or name or when owner flag is set to true. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Username? Username { get => Q("username"); set => Q("username", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors + /// associated with the API key. An API key's actual + /// permission is the intersection of its assigned role + /// descriptors and the owner user's role descriptors. + /// + /// + [JsonIgnore] + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Get API key information. +/// Retrieves information for one or more API keys. +/// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. +/// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. +/// +/// +public sealed partial class GetApiKeyRequestDescriptor : RequestDescriptor +{ + internal GetApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_api_key"; + + public GetApiKeyRequestDescriptor ActiveOnly(bool? activeOnly = true) => Qs("active_only", activeOnly); + public GetApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) => Qs("id", id); + public GetApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) => Qs("name", name); + public GetApiKeyRequestDescriptor Owner(bool? owner = true) => Qs("owner", owner); + public GetApiKeyRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? realmName) => Qs("realm_name", realmName); + public GetApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) => Qs("username", username); + public GetApiKeyRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public GetApiKeyRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs new file mode 100644 index 00000000000..39e7a09e307 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetApiKeyResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_keys")] + public IReadOnlyCollection ApiKeys { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs new file mode 100644 index 00000000000..b93260c3b73 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesRequest.g.cs @@ -0,0 +1,76 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetBuiltinPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. +/// +/// +public sealed partial class GetBuiltinPrivilegesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_builtin_privileges"; +} + +/// +/// +/// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. +/// +/// +public sealed partial class GetBuiltinPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetBuiltinPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetBuiltinPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetBuiltinPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_builtin_privileges"; + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs new file mode 100644 index 00000000000..5b7b58c3030 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetBuiltinPrivilegesResponse.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetBuiltinPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("index")] + [SingleOrManyCollectionConverter(typeof(string))] + public IReadOnlyCollection Indices { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs new file mode 100644 index 00000000000..d7471e4e322 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesRequest.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves application privileges. +/// +/// +public sealed partial class GetPrivilegesRequest : PlainRequest +{ + public GetPrivilegesRequest() + { + } + + public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application) : base(r => r.Optional("application", application)) + { + } + + public GetPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_privileges"; +} + +/// +/// +/// Retrieves application privileges. +/// +/// +public sealed partial class GetPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("application", application).Optional("name", name)) + { + } + + public GetPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_privileges"; + + public GetPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? application) + { + RouteValues.Optional("application", application); + return Self; + } + + public GetPrivilegesRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs new file mode 100644 index 00000000000..c9440766cdc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetPrivilegesResponse : DictionaryResponse> +{ + public GetPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public GetPrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs new file mode 100644 index 00000000000..24ba915b714 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingRequest.g.cs @@ -0,0 +1,94 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetRoleMappingRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves role mappings. +/// +/// +public sealed partial class GetRoleMappingRequest : PlainRequest +{ + public GetRoleMappingRequest() + { + } + + public GetRoleMappingRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role_mapping"; +} + +/// +/// +/// Retrieves role mappings. +/// +/// +public sealed partial class GetRoleMappingRequestDescriptor : RequestDescriptor +{ + internal GetRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } + + public GetRoleMappingRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role_mapping"; + + public GetRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs new file mode 100644 index 00000000000..58fa5183eff --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleMappingResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetRoleMappingResponse : DictionaryResponse +{ + public GetRoleMappingResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetRoleMappingResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs new file mode 100644 index 00000000000..fa84192133a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleRequest.g.cs @@ -0,0 +1,96 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetRoleRequestParameters : RequestParameters +{ +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The get roles API cannot retrieve roles that are defined in roles files. +/// +/// +public sealed partial class GetRoleRequest : PlainRequest +{ + public GetRoleRequest() + { + } + + public GetRoleRequest(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role"; +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The get roles API cannot retrieve roles that are defined in roles files. +/// +/// +public sealed partial class GetRoleRequestDescriptor : RequestDescriptor +{ + internal GetRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Names? name) : base(r => r.Optional("name", name)) + { + } + + public GetRoleRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_role"; + + public GetRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Names? name) + { + RouteValues.Optional("name", name); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs new file mode 100644 index 00000000000..3ed23466f8d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetRoleResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetRoleResponse : DictionaryResponse +{ + public GetRoleResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetRoleResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs new file mode 100644 index 00000000000..fb27a85b150 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsRequest.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetServiceAccountsRequestParameters : RequestParameters +{ +} + +/// +/// +/// This API returns a list of service accounts that match the provided path parameter(s). +/// +/// +public sealed partial class GetServiceAccountsRequest : PlainRequest +{ + public GetServiceAccountsRequest() + { + } + + public GetServiceAccountsRequest(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + { + } + + public GetServiceAccountsRequest(string? ns) : base(r => r.Optional("namespace", ns)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_accounts"; +} + +/// +/// +/// This API returns a list of service accounts that match the provided path parameter(s). +/// +/// +public sealed partial class GetServiceAccountsRequestDescriptor : RequestDescriptor +{ + internal GetServiceAccountsRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetServiceAccountsRequestDescriptor(string? ns, string? service) : base(r => r.Optional("namespace", ns).Optional("service", service)) + { + } + + public GetServiceAccountsRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceAccounts; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_accounts"; + + public GetServiceAccountsRequestDescriptor Namespace(string? ns) + { + RouteValues.Optional("namespace", ns); + return Self; + } + + public GetServiceAccountsRequestDescriptor Service(string? service) + { + RouteValues.Optional("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs new file mode 100644 index 00000000000..a9dc12e37ea --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceAccountsResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetServiceAccountsResponse : DictionaryResponse +{ + public GetServiceAccountsResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetServiceAccountsResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs new file mode 100644 index 00000000000..59a139b14a3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsRequest.g.cs @@ -0,0 +1,92 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetServiceCredentialsRequestParameters : RequestParameters +{ +} + +/// +/// +/// Retrieves information of all service credentials for a service account. +/// +/// +public sealed partial class GetServiceCredentialsRequest : PlainRequest +{ + public GetServiceCredentialsRequest(string ns, Elastic.Clients.Elasticsearch.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_credentials"; +} + +/// +/// +/// Retrieves information of all service credentials for a service account. +/// +/// +public sealed partial class GetServiceCredentialsRequestDescriptor : RequestDescriptor +{ + internal GetServiceCredentialsRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetServiceCredentialsRequestDescriptor(string ns, Elastic.Clients.Elasticsearch.Name service) : base(r => r.Required("namespace", ns).Required("service", service)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetServiceCredentials; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_service_credentials"; + + public GetServiceCredentialsRequestDescriptor Namespace(string ns) + { + RouteValues.Required("namespace", ns); + return Self; + } + + public GetServiceCredentialsRequestDescriptor Service(Elastic.Clients.Elasticsearch.Name service) + { + RouteValues.Required("service", service); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs new file mode 100644 index 00000000000..7fa558776e9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetServiceCredentialsResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetServiceCredentialsResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// Contains service account credentials collected from all nodes of the cluster + /// + /// + [JsonInclude, JsonPropertyName("nodes_credentials")] + public Elastic.Clients.Elasticsearch.Security.NodesCredentials NodesCredentials { get; init; } + [JsonInclude, JsonPropertyName("service_account")] + public string ServiceAccount { get; init; } + [JsonInclude, JsonPropertyName("tokens")] + public IReadOnlyDictionary> Tokens { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs new file mode 100644 index 00000000000..dc8331d6fe7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenRequest.g.cs @@ -0,0 +1,170 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetTokenRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates a bearer token for access without requiring basic authentication. +/// +/// +public sealed partial class GetTokenRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.get_token"; + + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? GrantType { get; set; } + [JsonInclude, JsonPropertyName("kerberos_ticket")] + public string? KerberosTicket { get; set; } + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + [JsonInclude, JsonPropertyName("scope")] + public string? Scope { get; set; } + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Username? Username { get; set; } +} + +/// +/// +/// Creates a bearer token for access without requiring basic authentication. +/// +/// +public sealed partial class GetTokenRequestDescriptor : RequestDescriptor +{ + internal GetTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetTokenRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.get_token"; + + private Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? GrantTypeValue { get; set; } + private string? KerberosTicketValue { get; set; } + private string? PasswordValue { get; set; } + private string? RefreshTokenValue { get; set; } + private string? ScopeValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + public GetTokenRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.AccessTokenGrantType? grantType) + { + GrantTypeValue = grantType; + return Self; + } + + public GetTokenRequestDescriptor KerberosTicket(string? kerberosTicket) + { + KerberosTicketValue = kerberosTicket; + return Self; + } + + public GetTokenRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + public GetTokenRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + public GetTokenRequestDescriptor Scope(string? scope) + { + ScopeValue = scope; + return Self; + } + + public GetTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (GrantTypeValue is not null) + { + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + } + + if (!string.IsNullOrEmpty(KerberosTicketValue)) + { + writer.WritePropertyName("kerberos_ticket"); + writer.WriteStringValue(KerberosTicketValue); + } + + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + if (!string.IsNullOrEmpty(ScopeValue)) + { + writer.WritePropertyName("scope"); + writer.WriteStringValue(ScopeValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs new file mode 100644 index 00000000000..07fd75ec184 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetTokenResponse.g.cs @@ -0,0 +1,45 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("access_token")] + public string AccessToken { get; init; } + [JsonInclude, JsonPropertyName("authentication")] + public Elastic.Clients.Elasticsearch.Security.AuthenticatedUser Authentication { get; init; } + [JsonInclude, JsonPropertyName("expires_in")] + public long ExpiresIn { get; init; } + [JsonInclude, JsonPropertyName("kerberos_authentication_response_token")] + public string? KerberosAuthenticationResponseToken { get; init; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; init; } + [JsonInclude, JsonPropertyName("scope")] + public string? Scope { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs new file mode 100644 index 00000000000..2644b772f56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesRequest.g.cs @@ -0,0 +1,112 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserPrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Application { get => Q("application"); set => Q("application", value); } + + /// + /// + /// The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + public Elastic.Clients.Elasticsearch.Name? Priviledge { get => Q("priviledge"); set => Q("priviledge", value); } + public Elastic.Clients.Elasticsearch.Name? Username { get => Q("username"); set => Q("username", value); } +} + +/// +/// +/// Retrieves security privileges for the logged in user. +/// +/// +public sealed partial class GetUserPrivilegesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_privileges"; + + /// + /// + /// The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Name? Application { get => Q("application"); set => Q("application", value); } + + /// + /// + /// The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Name? Priviledge { get => Q("priviledge"); set => Q("priviledge", value); } + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Name? Username { get => Q("username"); set => Q("username", value); } +} + +/// +/// +/// Retrieves security privileges for the logged in user. +/// +/// +public sealed partial class GetUserPrivilegesRequestDescriptor : RequestDescriptor +{ + internal GetUserPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetUserPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_privileges"; + + public GetUserPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Name? application) => Qs("application", application); + public GetUserPrivilegesRequestDescriptor Priviledge(Elastic.Clients.Elasticsearch.Name? priviledge) => Qs("priviledge", priviledge); + public GetUserPrivilegesRequestDescriptor Username(Elastic.Clients.Elasticsearch.Name? username) => Qs("username", username); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs new file mode 100644 index 00000000000..521ec2a00f5 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserPrivilegesResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("applications")] + public IReadOnlyCollection Applications { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("global")] + public IReadOnlyCollection Global { get; init; } + [JsonInclude, JsonPropertyName("indices")] + public IReadOnlyCollection Indices { get; init; } + [JsonInclude, JsonPropertyName("run_as")] + public IReadOnlyCollection RunAs { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs new file mode 100644 index 00000000000..85685d66fbe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileRequest.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserProfileRequestParameters : RequestParameters +{ + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public ICollection? Data { get => Q?>("data"); set => Q("data", value); } +} + +/// +/// +/// Retrieves a user's profile using the unique profile ID. +/// +/// +public sealed partial class GetUserProfileRequest : PlainRequest +{ + public GetUserProfileRequest(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_profile"; + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + [JsonIgnore] + public ICollection? Data { get => Q?>("data"); set => Q("data", value); } +} + +/// +/// +/// Retrieves a user's profile using the unique profile ID. +/// +/// +public sealed partial class GetUserProfileRequestDescriptor : RequestDescriptor +{ + internal GetUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetUserProfileRequestDescriptor(IReadOnlyCollection uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user_profile"; + + public GetUserProfileRequestDescriptor Data(ICollection? data) => Qs("data", data); + + public GetUserProfileRequestDescriptor Uid(IReadOnlyCollection uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs new file mode 100644 index 00000000000..71e2118cb2b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserProfileResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserProfileResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Security.GetUserProfileErrors? Errors { get; init; } + [JsonInclude, JsonPropertyName("profiles")] + public IReadOnlyCollection Profiles { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs new file mode 100644 index 00000000000..bedc1ce683e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserRequest.g.cs @@ -0,0 +1,110 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserRequestParameters : RequestParameters +{ + /// + /// + /// If true will return the User Profile ID for a user, if any. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Retrieves information about users in the native realm and built-in users. +/// +/// +public sealed partial class GetUserRequest : PlainRequest +{ + public GetUserRequest() + { + } + + public GetUserRequest(IReadOnlyCollection? username) : base(r => r.Optional("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user"; + + /// + /// + /// If true will return the User Profile ID for a user, if any. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Retrieves information about users in the native realm and built-in users. +/// +/// +public sealed partial class GetUserRequestDescriptor : RequestDescriptor +{ + internal GetUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetUserRequestDescriptor(IReadOnlyCollection? username) : base(r => r.Optional("username", username)) + { + } + + public GetUserRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGetUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.get_user"; + + public GetUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + public GetUserRequestDescriptor Username(IReadOnlyCollection? username) + { + RouteValues.Optional("username", username); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs new file mode 100644 index 00000000000..3b694bc7c42 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GetUserResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserResponse : DictionaryResponse +{ + public GetUserResponse(IReadOnlyDictionary dictionary) : base(dictionary) + { + } + + public GetUserResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs new file mode 100644 index 00000000000..ac32cc917fe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyRequest.g.cs @@ -0,0 +1,484 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GrantApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("access_token")] + public string? AccessToken { get; set; } + + /// + /// + /// Defines the API key. + /// + /// + [JsonInclude, JsonPropertyName("api_key")] + public Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKey { get; set; } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + [JsonInclude, JsonPropertyName("grant_type")] + public Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantType { get; set; } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + [JsonInclude, JsonPropertyName("run_as")] + public Elastic.Clients.Elasticsearch.Username? RunAs { get; set; } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Username? Username { get; set; } +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor, GrantApiKeyRequestParameters> +{ + internal GrantApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public GrantApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKeyValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } + private Action> ApiKeyDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? RunAsValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + /// + /// + /// Defines the API key. + /// + /// + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey apiKey) + { + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = null; + ApiKeyValue = apiKey; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) + { + ApiKeyValue = null; + ApiKeyDescriptorAction = null; + ApiKeyDescriptor = descriptor; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Action> configure) + { + ApiKeyValue = null; + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = configure; + return Self; + } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + if (ApiKeyDescriptor is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); + } + else if (ApiKeyDescriptorAction is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); + } + else + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyValue, options); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Creates an API key on behalf of another user. +/// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. +/// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. +/// It is not possible to use this API to create an API key without that user’s credentials. +/// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. +/// In this case, the API key will be created on behalf of the impersonated user. +/// +/// +/// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. +/// +/// +/// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. +/// If applicable, it also returns expiration information for the API key in milliseconds. +/// +/// +/// By default, API keys never expire. You can specify expiration information when you create the API keys. +/// +/// +public sealed partial class GrantApiKeyRequestDescriptor : RequestDescriptor +{ + internal GrantApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public GrantApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityGrantApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.grant_api_key"; + + private string? AccessTokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GrantApiKey ApiKeyValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor ApiKeyDescriptor { get; set; } + private Action ApiKeyDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType GrantTypeValue { get; set; } + private string? PasswordValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? RunAsValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + /// + /// + /// The user’s access token. + /// If you specify the access_token grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor AccessToken(string? accessToken) + { + AccessTokenValue = accessToken; + return Self; + } + + /// + /// + /// Defines the API key. + /// + /// + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKey apiKey) + { + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = null; + ApiKeyValue = apiKey; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor descriptor) + { + ApiKeyValue = null; + ApiKeyDescriptorAction = null; + ApiKeyDescriptor = descriptor; + return Self; + } + + public GrantApiKeyRequestDescriptor ApiKey(Action configure) + { + ApiKeyValue = null; + ApiKeyDescriptor = null; + ApiKeyDescriptorAction = configure; + return Self; + } + + /// + /// + /// The type of grant. Supported grant types are: access_token, password. + /// + /// + public GrantApiKeyRequestDescriptor GrantType(Elastic.Clients.Elasticsearch.Security.ApiKeyGrantType grantType) + { + GrantTypeValue = grantType; + return Self; + } + + /// + /// + /// The user’s password. If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + /// + /// + /// The name of the user to be impersonated. + /// + /// + public GrantApiKeyRequestDescriptor RunAs(Elastic.Clients.Elasticsearch.Username? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// The user name that identifies the user. + /// If you specify the password grant type, this parameter is required. + /// It is not valid with other grant types. + /// + /// + public GrantApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AccessTokenValue)) + { + writer.WritePropertyName("access_token"); + writer.WriteStringValue(AccessTokenValue); + } + + if (ApiKeyDescriptor is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyDescriptor, options); + } + else if (ApiKeyDescriptorAction is not null) + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GrantApiKeyDescriptor(ApiKeyDescriptorAction), options); + } + else + { + writer.WritePropertyName("api_key"); + JsonSerializer.Serialize(writer, ApiKeyValue, options); + } + + writer.WritePropertyName("grant_type"); + JsonSerializer.Serialize(writer, GrantTypeValue, options); + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs new file mode 100644 index 00000000000..9644b9b2a5a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/GrantApiKeyResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GrantApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("api_key")] + public string ApiKey { get; init; } + [JsonInclude, JsonPropertyName("encoded")] + public string Encoded { get; init; } + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs new file mode 100644 index 00000000000..30169672946 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesRequest.g.cs @@ -0,0 +1,272 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class HasPrivilegesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Check user privileges. +/// Determines whether the specified user has a specified list of privileges. +/// +/// +public sealed partial class HasPrivilegesRequest : PlainRequest +{ + public HasPrivilegesRequest() + { + } + + public HasPrivilegesRequest(Elastic.Clients.Elasticsearch.Name? user) : base(r => r.Optional("user", user)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges"; + + [JsonInclude, JsonPropertyName("application")] + public ICollection? Application { get; set; } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + [JsonInclude, JsonPropertyName("index")] + public ICollection? Index { get; set; } +} + +/// +/// +/// Check user privileges. +/// Determines whether the specified user has a specified list of privileges. +/// +/// +public sealed partial class HasPrivilegesRequestDescriptor : RequestDescriptor +{ + internal HasPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public HasPrivilegesRequestDescriptor(Elastic.Clients.Elasticsearch.Name? user) : base(r => r.Optional("user", user)) + { + } + + public HasPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges"; + + public HasPrivilegesRequestDescriptor User(Elastic.Clients.Elasticsearch.Name? user) + { + RouteValues.Optional("user", user); + return Self; + } + + private ICollection? ApplicationValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } + private Action ApplicationDescriptorAction { get; set; } + private Action[] ApplicationDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private ICollection? IndexValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } + private Action IndexDescriptorAction { get; set; } + private Action[] IndexDescriptorActions { get; set; } + + public HasPrivilegesRequestDescriptor Application(ICollection? application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationValue = application; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorActions = null; + ApplicationDescriptorAction = configure; + return Self; + } + + public HasPrivilegesRequestDescriptor Application(params Action[] configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public HasPrivilegesRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(ICollection? index) + { + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexValue = index; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor descriptor) + { + IndexValue = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexDescriptor = descriptor; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(Action configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorActions = null; + IndexDescriptorAction = configure; + return Self; + } + + public HasPrivilegesRequestDescriptor Index(params Action[] configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorActions is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + foreach (var action in ApplicationDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationValue is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (IndexDescriptor is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndexDescriptor, options); + writer.WriteEndArray(); + } + else if (IndexDescriptorAction is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndexDescriptorActions is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + foreach (var action in IndexDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndexValue is not null) + { + writer.WritePropertyName("index"); + JsonSerializer.Serialize(writer, IndexValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs new file mode 100644 index 00000000000..024488da85d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesResponse.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class HasPrivilegesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("application")] + public IReadOnlyDictionary>> Application { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyDictionary Cluster { get; init; } + [JsonInclude, JsonPropertyName("has_all_requested")] + public bool HasAllRequested { get; init; } + [JsonInclude, JsonPropertyName("index")] + [ReadOnlyIndexNameDictionaryConverter(typeof(IReadOnlyDictionary))] + public IReadOnlyDictionary> Index { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs new file mode 100644 index 00000000000..3d7a11691aa --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileRequest.g.cs @@ -0,0 +1,147 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class HasPrivilegesUserProfileRequestParameters : RequestParameters +{ +} + +/// +/// +/// Determines whether the users associated with the specified profile IDs have all the requested privileges. +/// +/// +public sealed partial class HasPrivilegesUserProfileRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges_user_profile"; + + [JsonInclude, JsonPropertyName("privileges")] + public Elastic.Clients.Elasticsearch.Security.PrivilegesCheck Privileges { get; set; } + + /// + /// + /// A list of profile IDs. The privileges are checked for associated users of the profiles. + /// + /// + [JsonInclude, JsonPropertyName("uids")] + public ICollection Uids { get; set; } +} + +/// +/// +/// Determines whether the users associated with the specified profile IDs have all the requested privileges. +/// +/// +public sealed partial class HasPrivilegesUserProfileRequestDescriptor : RequestDescriptor +{ + internal HasPrivilegesUserProfileRequestDescriptor(Action configure) => configure.Invoke(this); + + public HasPrivilegesUserProfileRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityHasPrivilegesUserProfile; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.has_privileges_user_profile"; + + private Elastic.Clients.Elasticsearch.Security.PrivilegesCheck PrivilegesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor PrivilegesDescriptor { get; set; } + private Action PrivilegesDescriptorAction { get; set; } + private ICollection UidsValue { get; set; } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Security.PrivilegesCheck privileges) + { + PrivilegesDescriptor = null; + PrivilegesDescriptorAction = null; + PrivilegesValue = privileges; + return Self; + } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor descriptor) + { + PrivilegesValue = null; + PrivilegesDescriptorAction = null; + PrivilegesDescriptor = descriptor; + return Self; + } + + public HasPrivilegesUserProfileRequestDescriptor Privileges(Action configure) + { + PrivilegesValue = null; + PrivilegesDescriptor = null; + PrivilegesDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of profile IDs. The privileges are checked for associated users of the profiles. + /// + /// + public HasPrivilegesUserProfileRequestDescriptor Uids(ICollection uids) + { + UidsValue = uids; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (PrivilegesDescriptor is not null) + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesDescriptor, options); + } + else if (PrivilegesDescriptorAction is not null) + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.PrivilegesCheckDescriptor(PrivilegesDescriptorAction), options); + } + else + { + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + } + + writer.WritePropertyName("uids"); + JsonSerializer.Serialize(writer, UidsValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs new file mode 100644 index 00000000000..04b7b2fd847 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/HasPrivilegesUserProfileResponse.g.cs @@ -0,0 +1,50 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class HasPrivilegesUserProfileResponse : ElasticsearchResponse +{ + /// + /// + /// The subset of the requested profile IDs for which an error + /// was encountered. It does not include the missing profile IDs + /// or the profile IDs of the users that do not have all the + /// requested privileges. This field is absent if empty. + /// + /// + [JsonInclude, JsonPropertyName("errors")] + public Elastic.Clients.Elasticsearch.Security.HasPrivilegesUserProfileErrors? Errors { get; init; } + + /// + /// + /// The subset of the requested profile IDs of the users that + /// have all the requested privileges. + /// + /// + [JsonInclude, JsonPropertyName("has_privilege_uids")] + public IReadOnlyCollection HasPrivilegeUids { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs new file mode 100644 index 00000000000..a9c57aeb9a6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyRequest.g.cs @@ -0,0 +1,277 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class InvalidateApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Invalidate API keys. +/// Invalidates one or more API keys. +/// The manage_api_key privilege allows deleting any API keys. +/// The manage_own_api_key only allows deleting API keys that are owned by the user. +/// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: +/// +/// +/// +/// +/// Set the parameter owner=true. +/// +/// +/// +/// +/// Or, set both username and realm_name to match the user’s identity. +/// +/// +/// +/// +/// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. +/// +/// +/// +/// +public sealed partial class InvalidateApiKeyRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_api_key"; + + [JsonInclude, JsonPropertyName("id")] + public Elastic.Clients.Elasticsearch.Id? Id { get; set; } + + /// + /// + /// A list of API key ids. + /// This parameter cannot be used with any of name, realm_name, or username. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public ICollection? Ids { get; set; } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of ids, realm_name or username. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Name? Name { get; set; } + + /// + /// + /// Can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + [JsonInclude, JsonPropertyName("owner")] + public bool? Owner { get; set; } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + [JsonInclude, JsonPropertyName("realm_name")] + public string? RealmName { get; set; } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Username? Username { get; set; } +} + +/// +/// +/// Invalidate API keys. +/// Invalidates one or more API keys. +/// The manage_api_key privilege allows deleting any API keys. +/// The manage_own_api_key only allows deleting API keys that are owned by the user. +/// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: +/// +/// +/// +/// +/// Set the parameter owner=true. +/// +/// +/// +/// +/// Or, set both username and realm_name to match the user’s identity. +/// +/// +/// +/// +/// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. +/// +/// +/// +/// +public sealed partial class InvalidateApiKeyRequestDescriptor : RequestDescriptor +{ + internal InvalidateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public InvalidateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_api_key"; + + private Elastic.Clients.Elasticsearch.Id? IdValue { get; set; } + private ICollection? IdsValue { get; set; } + private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } + private bool? OwnerValue { get; set; } + private string? RealmNameValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + public InvalidateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id) + { + IdValue = id; + return Self; + } + + /// + /// + /// A list of API key ids. + /// This parameter cannot be used with any of name, realm_name, or username. + /// + /// + public InvalidateApiKeyRequestDescriptor Ids(ICollection? ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// An API key name. + /// This parameter cannot be used with any of ids, realm_name or username. + /// + /// + public InvalidateApiKeyRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// Can be used to query API keys owned by the currently authenticated user. + /// The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones. + /// + /// + public InvalidateApiKeyRequestDescriptor Owner(bool? owner = true) + { + OwnerValue = owner; + return Self; + } + + /// + /// + /// The name of an authentication realm. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + public InvalidateApiKeyRequestDescriptor RealmName(string? realmName) + { + RealmNameValue = realmName; + return Self; + } + + /// + /// + /// The username of a user. + /// This parameter cannot be used with either ids or name, or when owner flag is set to true. + /// + /// + public InvalidateApiKeyRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (IdValue is not null) + { + writer.WritePropertyName("id"); + JsonSerializer.Serialize(writer, IdValue, options); + } + + if (IdsValue is not null) + { + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + if (OwnerValue.HasValue) + { + writer.WritePropertyName("owner"); + writer.WriteBooleanValue(OwnerValue.Value); + } + + if (!string.IsNullOrEmpty(RealmNameValue)) + { + writer.WritePropertyName("realm_name"); + writer.WriteStringValue(RealmNameValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs new file mode 100644 index 00000000000..c46e96aaf8b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateApiKeyResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class InvalidateApiKeyResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("error_count")] + public int ErrorCount { get; init; } + [JsonInclude, JsonPropertyName("error_details")] + public IReadOnlyCollection? ErrorDetails { get; init; } + [JsonInclude, JsonPropertyName("invalidated_api_keys")] + public IReadOnlyCollection InvalidatedApiKeys { get; init; } + [JsonInclude, JsonPropertyName("previously_invalidated_api_keys")] + public IReadOnlyCollection PreviouslyInvalidatedApiKeys { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs new file mode 100644 index 00000000000..f226fbef4e9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenRequest.g.cs @@ -0,0 +1,140 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class InvalidateTokenRequestParameters : RequestParameters +{ +} + +/// +/// +/// Invalidates one or more access tokens or refresh tokens. +/// +/// +public sealed partial class InvalidateTokenRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_token"; + + [JsonInclude, JsonPropertyName("realm_name")] + public Elastic.Clients.Elasticsearch.Name? RealmName { get; set; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + [JsonInclude, JsonPropertyName("token")] + public string? Token { get; set; } + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Username? Username { get; set; } +} + +/// +/// +/// Invalidates one or more access tokens or refresh tokens. +/// +/// +public sealed partial class InvalidateTokenRequestDescriptor : RequestDescriptor +{ + internal InvalidateTokenRequestDescriptor(Action configure) => configure.Invoke(this); + + public InvalidateTokenRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityInvalidateToken; + + protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.invalidate_token"; + + private Elastic.Clients.Elasticsearch.Name? RealmNameValue { get; set; } + private string? RefreshTokenValue { get; set; } + private string? TokenValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + public InvalidateTokenRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name? realmName) + { + RealmNameValue = realmName; + return Self; + } + + public InvalidateTokenRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + public InvalidateTokenRequestDescriptor Token(string? token) + { + TokenValue = token; + return Self; + } + + public InvalidateTokenRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (RealmNameValue is not null) + { + writer.WritePropertyName("realm_name"); + JsonSerializer.Serialize(writer, RealmNameValue, options); + } + + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + if (!string.IsNullOrEmpty(TokenValue)) + { + writer.WritePropertyName("token"); + writer.WriteStringValue(TokenValue); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs new file mode 100644 index 00000000000..d014871850b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/InvalidateTokenResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class InvalidateTokenResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("error_count")] + public long ErrorCount { get; init; } + [JsonInclude, JsonPropertyName("error_details")] + public IReadOnlyCollection? ErrorDetails { get; init; } + [JsonInclude, JsonPropertyName("invalidated_tokens")] + public long InvalidatedTokens { get; init; } + [JsonInclude, JsonPropertyName("previously_invalidated_tokens")] + public long PreviouslyInvalidatedTokens { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs new file mode 100644 index 00000000000..2ce5e12e334 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesRequest.g.cs @@ -0,0 +1,109 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutPrivilegesRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Adds or updates application privileges. +/// +/// +public sealed partial class PutPrivilegesRequest : PlainRequest, ISelfSerializable +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_privileges"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + public Dictionary> Privileges { get; set; } + + void ISelfSerializable.Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, Privileges, options); + } +} + +/// +/// +/// Adds or updates application privileges. +/// +/// +public sealed partial class PutPrivilegesRequestDescriptor : RequestDescriptor, ISelfSerializable +{ + internal PutPrivilegesRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutPrivilegesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutPrivileges; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_privileges"; + + public PutPrivilegesRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + JsonSerializer.Serialize(writer, _items, options); + } + + Dictionary> _items = new(); + + public PutPrivilegesRequestDescriptor AddPrivileges(string key, Dictionary value) + { + _items.Add(key, value); + return this; + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs new file mode 100644 index 00000000000..a5656b6d3a8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutPrivilegesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutPrivilegesResponse : DictionaryResponse> +{ + public PutPrivilegesResponse(IReadOnlyDictionary> dictionary) : base(dictionary) + { + } + + public PutPrivilegesResponse() : base() + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs new file mode 100644 index 00000000000..41c648f5abb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingRequest.g.cs @@ -0,0 +1,283 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutRoleMappingRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Creates and updates role mappings. +/// +/// +public sealed partial class PutRoleMappingRequest : PlainRequest +{ + public PutRoleMappingRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role_mapping"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("roles")] + public ICollection? Roles { get; set; } + [JsonInclude, JsonPropertyName("role_templates")] + public ICollection? RoleTemplates { get; set; } + [JsonInclude, JsonPropertyName("rules")] + public Elastic.Clients.Elasticsearch.Security.RoleMappingRule? Rules { get; set; } + [JsonInclude, JsonPropertyName("run_as")] + public ICollection? RunAs { get; set; } +} + +/// +/// +/// Creates and updates role mappings. +/// +/// +public sealed partial class PutRoleMappingRequestDescriptor : RequestDescriptor +{ + internal PutRoleMappingRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutRoleMappingRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRoleMapping; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role_mapping"; + + public PutRoleMappingRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleMappingRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private bool? EnabledValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RolesValue { get; set; } + private ICollection? RoleTemplatesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor RoleTemplatesDescriptor { get; set; } + private Action RoleTemplatesDescriptorAction { get; set; } + private Action[] RoleTemplatesDescriptorActions { get; set; } + private Elastic.Clients.Elasticsearch.Security.RoleMappingRule? RulesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor RulesDescriptor { get; set; } + private Action RulesDescriptorAction { get; set; } + private ICollection? RunAsValue { get; set; } + + public PutRoleMappingRequestDescriptor Enabled(bool? enabled = true) + { + EnabledValue = enabled; + return Self; + } + + public PutRoleMappingRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PutRoleMappingRequestDescriptor Roles(ICollection? roles) + { + RolesValue = roles; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(ICollection? roleTemplates) + { + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesValue = roleTemplates; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor descriptor) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesDescriptor = descriptor; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(Action configure) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorActions = null; + RoleTemplatesDescriptorAction = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor RoleTemplates(params Action[] configure) + { + RoleTemplatesValue = null; + RoleTemplatesDescriptor = null; + RoleTemplatesDescriptorAction = null; + RoleTemplatesDescriptorActions = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRule? rules) + { + RulesDescriptor = null; + RulesDescriptorAction = null; + RulesValue = rules; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor descriptor) + { + RulesValue = null; + RulesDescriptorAction = null; + RulesDescriptor = descriptor; + return Self; + } + + public PutRoleMappingRequestDescriptor Rules(Action configure) + { + RulesValue = null; + RulesDescriptor = null; + RulesDescriptorAction = configure; + return Self; + } + + public PutRoleMappingRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (EnabledValue.HasValue) + { + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(EnabledValue.Value); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RolesValue is not null) + { + writer.WritePropertyName("roles"); + JsonSerializer.Serialize(writer, RolesValue, options); + } + + if (RoleTemplatesDescriptor is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, RoleTemplatesDescriptor, options); + writer.WriteEndArray(); + } + else if (RoleTemplatesDescriptorAction is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(RoleTemplatesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (RoleTemplatesDescriptorActions is not null) + { + writer.WritePropertyName("role_templates"); + writer.WriteStartArray(); + foreach (var action in RoleTemplatesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleTemplateDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (RoleTemplatesValue is not null) + { + writer.WritePropertyName("role_templates"); + JsonSerializer.Serialize(writer, RoleTemplatesValue, options); + } + + if (RulesDescriptor is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, RulesDescriptor, options); + } + else if (RulesDescriptorAction is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.RoleMappingRuleDescriptor(RulesDescriptorAction), options); + } + else if (RulesValue is not null) + { + writer.WritePropertyName("rules"); + JsonSerializer.Serialize(writer, RulesValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs new file mode 100644 index 00000000000..c3a0d4a12ce --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleMappingResponse.g.cs @@ -0,0 +1,35 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutRoleMappingResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("created")] + public bool? Created { get; init; } + [JsonInclude, JsonPropertyName("role_mapping")] + public Elastic.Clients.Elasticsearch.Security.CreatedStatus RoleMapping { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs new file mode 100644 index 00000000000..ac3f5420753 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleRequest.g.cs @@ -0,0 +1,729 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutRoleRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequest : PlainRequest +{ + public PutRoleRequest(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// A list of application privilege entries. + /// + /// + [JsonInclude, JsonPropertyName("applications")] + public ICollection? Applications { get; set; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + [JsonInclude, JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + [JsonInclude, JsonPropertyName("global")] + public IDictionary? Global { get; set; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + [JsonInclude, JsonPropertyName("indices")] + public ICollection? Indices { get; set; } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + [JsonInclude, JsonPropertyName("run_as")] + public ICollection? RunAs { get; set; } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + [JsonInclude, JsonPropertyName("transient_metadata")] + public IDictionary? TransientMetadata { get; set; } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequestDescriptor : RequestDescriptor, PutRoleRequestParameters> +{ + internal PutRoleRequestDescriptor(Action> configure) => configure.Invoke(this); + + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private IDictionary? GlobalValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action> IndicesDescriptorAction { get; set; } + private Action>[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries. + /// + /// + public PutRoleRequestDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public PutRoleRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public PutRoleRequestDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public PutRoleRequestDescriptor Global(Func, FluentDictionary> selector) + { + GlobalValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public PutRoleRequestDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Indices(Action> configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Indices(params Action>[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public PutRoleRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (GlobalValue is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, GlobalValue, options); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. +/// The create or update roles API cannot update roles that are defined in roles files. +/// +/// +public sealed partial class PutRoleRequestDescriptor : RequestDescriptor +{ + internal PutRoleRequestDescriptor(Action configure) => configure.Invoke(this); + + public PutRoleRequestDescriptor(Elastic.Clients.Elasticsearch.Name name) : base(r => r.Required("name", name)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutRole; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_role"; + + public PutRoleRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public PutRoleRequestDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + RouteValues.Required("name", name); + return Self; + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private IDictionary? GlobalValue { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action IndicesDescriptorAction { get; set; } + private Action[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries. + /// + /// + public PutRoleRequestDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public PutRoleRequestDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster-level actions for users with this role. + /// + /// + public PutRoleRequestDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public PutRoleRequestDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public PutRoleRequestDescriptor Global(Func, FluentDictionary> selector) + { + GlobalValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public PutRoleRequestDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public PutRoleRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public PutRoleRequestDescriptor Indices(Action configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public PutRoleRequestDescriptor Indices(params Action[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use. + /// + /// + public PutRoleRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the owners of this role can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public PutRoleRequestDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + /// + /// + /// Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API. + /// + /// + public PutRoleRequestDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (GlobalValue is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, GlobalValue, options); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs new file mode 100644 index 00000000000..6c6b329cdb4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutRoleResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutRoleResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("role")] + public Elastic.Clients.Elasticsearch.Security.CreatedStatus Role { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs new file mode 100644 index 00000000000..25305c9241e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserRequest.g.cs @@ -0,0 +1,215 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutUserRequestParameters : RequestParameters +{ + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Adds and updates users in the native realm. These users are commonly referred to as native users. +/// +/// +public sealed partial class PutUserRequest : PlainRequest +{ + public PutUserRequest(Elastic.Clients.Elasticsearch.Username username) : base(r => r.Required("username", username)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_user"; + + /// + /// + /// If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; set; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; set; } + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("password")] + public string? Password { get; set; } + [JsonInclude, JsonPropertyName("password_hash")] + public string? PasswordHash { get; set; } + [JsonInclude, JsonPropertyName("roles")] + public ICollection? Roles { get; set; } + [JsonInclude, JsonPropertyName("username")] + public Elastic.Clients.Elasticsearch.Username? Username { get; set; } +} + +/// +/// +/// Adds and updates users in the native realm. These users are commonly referred to as native users. +/// +/// +public sealed partial class PutUserRequestDescriptor : RequestDescriptor +{ + internal PutUserRequestDescriptor(Action configure) => configure.Invoke(this); + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityPutUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.put_user"; + + public PutUserRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + private string? EmailValue { get; set; } + private bool? EnabledValue { get; set; } + private string? FullNameValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private string? PasswordValue { get; set; } + private string? PasswordHashValue { get; set; } + private ICollection? RolesValue { get; set; } + private Elastic.Clients.Elasticsearch.Username? UsernameValue { get; set; } + + public PutUserRequestDescriptor Email(string? email) + { + EmailValue = email; + return Self; + } + + public PutUserRequestDescriptor Enabled(bool? enabled = true) + { + EnabledValue = enabled; + return Self; + } + + public PutUserRequestDescriptor FullName(string? fullName) + { + FullNameValue = fullName; + return Self; + } + + public PutUserRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PutUserRequestDescriptor Password(string? password) + { + PasswordValue = password; + return Self; + } + + public PutUserRequestDescriptor PasswordHash(string? passwordHash) + { + PasswordHashValue = passwordHash; + return Self; + } + + public PutUserRequestDescriptor Roles(ICollection? roles) + { + RolesValue = roles; + return Self; + } + + public PutUserRequestDescriptor Username(Elastic.Clients.Elasticsearch.Username? username) + { + UsernameValue = username; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(EmailValue)) + { + writer.WritePropertyName("email"); + writer.WriteStringValue(EmailValue); + } + + if (EnabledValue.HasValue) + { + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(EnabledValue.Value); + } + + if (!string.IsNullOrEmpty(FullNameValue)) + { + writer.WritePropertyName("full_name"); + writer.WriteStringValue(FullNameValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (!string.IsNullOrEmpty(PasswordValue)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(PasswordValue); + } + + if (!string.IsNullOrEmpty(PasswordHashValue)) + { + writer.WritePropertyName("password_hash"); + writer.WriteStringValue(PasswordHashValue); + } + + if (RolesValue is not null) + { + writer.WritePropertyName("roles"); + JsonSerializer.Serialize(writer, RolesValue, options); + } + + if (UsernameValue is not null) + { + writer.WritePropertyName("username"); + JsonSerializer.Serialize(writer, UsernameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs new file mode 100644 index 00000000000..5941437d1cc --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/PutUserResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PutUserResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("created")] + public bool Created { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs new file mode 100644 index 00000000000..22060338953 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysRequest.g.cs @@ -0,0 +1,745 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class QueryApiKeysRequestParameters : RequestParameters +{ + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. + /// + /// + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +internal sealed partial class QueryApiKeysRequestConverter : JsonConverter +{ + public override QueryApiKeysRequest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new QueryApiKeysRequest(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "aggregations" || property == "aggs") + { + variant.Aggregations = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "from") + { + variant.From = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "query") + { + variant.Query = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "search_after") + { + variant.SearchAfter = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "size") + { + variant.Size = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "sort") + { + variant.Sort = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, QueryApiKeysRequest value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + if (value.From.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(value.From.Value); + } + + if (value.Query is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, value.Query, options); + } + + if (value.SearchAfter is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, value.SearchAfter, options); + } + + if (value.Size.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(value.Size.Value); + } + + if (value.Sort is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, value.Sort, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +[JsonConverter(typeof(QueryApiKeysRequestConverter))] +public sealed partial class QueryApiKeysRequest : PlainRequest +{ + public QueryApiKeysRequest() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + /// + /// + /// Determines whether aggregation names are prefixed by their respective types in the response. + /// + /// + [JsonIgnore] + public bool? TypedKeys { get => Q("typed_keys"); set => Q("typed_keys", value); } + + /// + /// + /// Return the snapshot of the owner user's role descriptors associated with the API key. + /// An API key's actual permission is the intersection of its assigned role descriptors and the owner user's role descriptors. + /// + /// + [JsonIgnore] + public bool? WithLimitedBy { get => Q("with_limited_by"); set => Q("with_limited_by", value); } + + /// + /// + /// Determines whether to also retrieve the profile uid, for the API key owner principal, if it exists. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public IDictionary? Aggregations { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("from")] + public int? From { get; set; } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? Query { get; set; } + + /// + /// + /// Search after definition + /// + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public int? Size { get; set; } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] + public ICollection? Sort { get; set; } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor, QueryApiKeysRequestParameters> +{ + internal QueryApiKeysRequestDescriptor(Action> configure) => configure.Invoke(this); + + public QueryApiKeysRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private IDictionary> AggregationsValue { get; set; } + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public QueryApiKeysRequestDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Query API keys. +/// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryApiKeysRequestDescriptor : RequestDescriptor +{ + internal QueryApiKeysRequestDescriptor(Action configure) => configure.Invoke(this); + + public QueryApiKeysRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryApiKeys; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_api_keys"; + + public QueryApiKeysRequestDescriptor TypedKeys(bool? typedKeys = true) => Qs("typed_keys", typedKeys); + public QueryApiKeysRequestDescriptor WithLimitedBy(bool? withLimitedBy = true) => Qs("with_limited_by", withLimitedBy); + public QueryApiKeysRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private IDictionary AggregationsValue { get; set; } + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + + /// + /// + /// Any aggregations to run over the corpus of returned API keys. + /// Aggregations and queries work together. Aggregations are computed only on the API keys that match the query. + /// This supports only a subset of aggregation types, namely: terms, range, date_range, missing, + /// cardinality, value_count, composite, filter, and filters. + /// Additionally, aggregations only run over the same subset of fields that query works with. + /// + /// + public QueryApiKeysRequestDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which API keys to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following public information associated with an API key: id, type, name, + /// creation, expiration, invalidated, invalidation, username, realm, and metadata. + /// + /// + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryApiKeysRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryApiKeysRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Other than id, all public fields of an API key are eligible for sorting. + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryApiKeysRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryApiKeysRequestDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApiKeyQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs new file mode 100644 index 00000000000..89b4746dbc8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryApiKeysResponse.g.cs @@ -0,0 +1,62 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class QueryApiKeysResponse : ElasticsearchResponse +{ + /// + /// + /// The aggregations result, if requested. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public Elastic.Clients.Elasticsearch.Aggregations.AggregateDictionary? Aggregations { get; init; } + + /// + /// + /// A list of API key information. + /// + /// + [JsonInclude, JsonPropertyName("api_keys")] + public IReadOnlyCollection ApiKeys { get; init; } + + /// + /// + /// The number of API keys returned in the response. + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// The total number of API keys found. + /// + /// + [JsonInclude, JsonPropertyName("total")] + public int Total { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs new file mode 100644 index 00000000000..475ab9b6758 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserRequest.g.cs @@ -0,0 +1,546 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class QueryUserRequestParameters : RequestParameters +{ + /// + /// + /// If true will return the User Profile ID for the users in the query result, if any. + /// + /// + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + /// + /// + /// If true will return the User Profile ID for the users in the query result, if any. + /// + /// + [JsonIgnore] + public bool? WithProfileUid { get => Q("with_profile_uid"); set => Q("with_profile_uid", value); } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("from")] + public int? From { get; set; } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + [JsonInclude, JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Security.UserQuery? Query { get; set; } + + /// + /// + /// Search after definition + /// + /// + [JsonInclude, JsonPropertyName("search_after")] + public ICollection? SearchAfter { get; set; } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public int? Size { get; set; } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + [JsonInclude, JsonPropertyName("sort")] + [SingleOrManyCollectionConverter(typeof(Elastic.Clients.Elasticsearch.SortOptions))] + public ICollection? Sort { get; set; } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequestDescriptor : RequestDescriptor, QueryUserRequestParameters> +{ + internal QueryUserRequestDescriptor(Action> configure) => configure.Invoke(this); + + public QueryUserRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.UserQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor QueryDescriptor { get; set; } + private Action> QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } + private Action> SortDescriptorAction { get; set; } + private Action>[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Query(Action> configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryUserRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Sort(Action> configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryUserRequestDescriptor Sort(params Action>[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. +/// +/// +public sealed partial class QueryUserRequestDescriptor : RequestDescriptor +{ + internal QueryUserRequestDescriptor(Action configure) => configure.Invoke(this); + + public QueryUserRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityQueryUser; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.query_user"; + + public QueryUserRequestDescriptor WithProfileUid(bool? withProfileUid = true) => Qs("with_profile_uid", withProfileUid); + + private int? FromValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.UserQuery? QueryValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor QueryDescriptor { get; set; } + private Action QueryDescriptorAction { get; set; } + private ICollection? SearchAfterValue { get; set; } + private int? SizeValue { get; set; } + private ICollection? SortValue { get; set; } + private Elastic.Clients.Elasticsearch.SortOptionsDescriptor SortDescriptor { get; set; } + private Action SortDescriptorAction { get; set; } + private Action[] SortDescriptorActions { get; set; } + + /// + /// + /// Starting document offset. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor From(int? from) + { + FromValue = from; + return Self; + } + + /// + /// + /// A query to filter which users to return. + /// If the query parameter is missing, it is equivalent to a match_all query. + /// The query supports a subset of query types, including match_all, bool, term, terms, match, + /// ids, prefix, wildcard, exists, range, and simple_query_string. + /// You can query the following information associated with user: username, roles, enabled + /// + /// + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQuery? query) + { + QueryDescriptor = null; + QueryDescriptorAction = null; + QueryValue = query; + return Self; + } + + public QueryUserRequestDescriptor Query(Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor descriptor) + { + QueryValue = null; + QueryDescriptorAction = null; + QueryDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Query(Action configure) + { + QueryValue = null; + QueryDescriptor = null; + QueryDescriptorAction = configure; + return Self; + } + + /// + /// + /// Search after definition + /// + /// + public QueryUserRequestDescriptor SearchAfter(ICollection? searchAfter) + { + SearchAfterValue = searchAfter; + return Self; + } + + /// + /// + /// The number of hits to return. + /// By default, you cannot page through more than 10,000 hits using the from and size parameters. + /// To page through more hits, use the search_after parameter. + /// + /// + public QueryUserRequestDescriptor Size(int? size) + { + SizeValue = size; + return Self; + } + + /// + /// + /// Fields eligible for sorting are: username, roles, enabled + /// In addition, sort can also be applied to the _doc field to sort by index order. + /// + /// + public QueryUserRequestDescriptor Sort(ICollection? sort) + { + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortValue = sort; + return Self; + } + + public QueryUserRequestDescriptor Sort(Elastic.Clients.Elasticsearch.SortOptionsDescriptor descriptor) + { + SortValue = null; + SortDescriptorAction = null; + SortDescriptorActions = null; + SortDescriptor = descriptor; + return Self; + } + + public QueryUserRequestDescriptor Sort(Action configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorActions = null; + SortDescriptorAction = configure; + return Self; + } + + public QueryUserRequestDescriptor Sort(params Action[] configure) + { + SortValue = null; + SortDescriptor = null; + SortDescriptorAction = null; + SortDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FromValue.HasValue) + { + writer.WritePropertyName("from"); + writer.WriteNumberValue(FromValue.Value); + } + + if (QueryDescriptor is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryDescriptor, options); + } + else if (QueryDescriptorAction is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.UserQueryDescriptor(QueryDescriptorAction), options); + } + else if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + if (SearchAfterValue is not null) + { + writer.WritePropertyName("search_after"); + JsonSerializer.Serialize(writer, SearchAfterValue, options); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + if (SortDescriptor is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, SortDescriptor, options); + } + else if (SortDescriptorAction is not null) + { + writer.WritePropertyName("sort"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(SortDescriptorAction), options); + } + else if (SortDescriptorActions is not null) + { + writer.WritePropertyName("sort"); + if (SortDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in SortDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.SortOptionsDescriptor(action), options); + } + + if (SortDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (SortValue is not null) + { + writer.WritePropertyName("sort"); + SingleOrManySerializationHelper.Serialize(SortValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs new file mode 100644 index 00000000000..36090081fc3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/QueryUserResponse.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class QueryUserResponse : ElasticsearchResponse +{ + /// + /// + /// The number of users returned in the response. + /// + /// + [JsonInclude, JsonPropertyName("count")] + public int Count { get; init; } + + /// + /// + /// The total number of users found. + /// + /// + [JsonInclude, JsonPropertyName("total")] + public int Total { get; init; } + + /// + /// + /// A list of user information. + /// + /// + [JsonInclude, JsonPropertyName("users")] + public IReadOnlyCollection Users { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs new file mode 100644 index 00000000000..40f3938107b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateRequest.g.cs @@ -0,0 +1,149 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlAuthenticateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a SAML Response message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlAuthenticateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_authenticate"; + + /// + /// + /// The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. + /// + /// + [JsonInclude, JsonPropertyName("content")] + public string Content { get; set; } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public Elastic.Clients.Elasticsearch.Ids Ids { get; set; } + + /// + /// + /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } +} + +/// +/// +/// Submits a SAML Response message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlAuthenticateRequestDescriptor : RequestDescriptor +{ + internal SamlAuthenticateRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlAuthenticateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlAuthenticate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_authenticate"; + + private string ContentValue { get; set; } + private Elastic.Clients.Elasticsearch.Ids IdsValue { get; set; } + private string? RealmValue { get; set; } + + /// + /// + /// The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document. + /// + /// + public SamlAuthenticateRequestDescriptor Content(string content) + { + ContentValue = content; + return Self; + } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + public SamlAuthenticateRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. + /// + /// + public SamlAuthenticateRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("content"); + writer.WriteStringValue(ContentValue); + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs new file mode 100644 index 00000000000..563c505d691 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlAuthenticateResponse.g.cs @@ -0,0 +1,41 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlAuthenticateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("access_token")] + public string AccessToken { get; init; } + [JsonInclude, JsonPropertyName("expires_in")] + public int ExpiresIn { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("refresh_token")] + public string RefreshToken { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs new file mode 100644 index 00000000000..d3063cdfca1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutRequest.g.cs @@ -0,0 +1,175 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlCompleteLogoutRequestParameters : RequestParameters +{ +} + +/// +/// +/// Verifies the logout response sent from the SAML IdP. +/// +/// +public sealed partial class SamlCompleteLogoutRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_complete_logout"; + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. + /// + /// + [JsonInclude, JsonPropertyName("content")] + public string? Content { get; set; } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + [JsonInclude, JsonPropertyName("ids")] + public Elastic.Clients.Elasticsearch.Ids Ids { get; set; } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. + /// + /// + [JsonInclude, JsonPropertyName("query_string")] + public string? QueryString { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; set; } +} + +/// +/// +/// Verifies the logout response sent from the SAML IdP. +/// +/// +public sealed partial class SamlCompleteLogoutRequestDescriptor : RequestDescriptor +{ + internal SamlCompleteLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlCompleteLogoutRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlCompleteLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_complete_logout"; + + private string? ContentValue { get; set; } + private Elastic.Clients.Elasticsearch.Ids IdsValue { get; set; } + private string? QueryStringValue { get; set; } + private string RealmValue { get; set; } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response. + /// + /// + public SamlCompleteLogoutRequestDescriptor Content(string? content) + { + ContentValue = content; + return Self; + } + + /// + /// + /// A json array with all the valid SAML Request Ids that the caller of the API has for the current user. + /// + /// + public SamlCompleteLogoutRequestDescriptor Ids(Elastic.Clients.Elasticsearch.Ids ids) + { + IdsValue = ids; + return Self; + } + + /// + /// + /// If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI. + /// + /// + public SamlCompleteLogoutRequestDescriptor QueryString(string? queryString) + { + QueryStringValue = queryString; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. + /// + /// + public SamlCompleteLogoutRequestDescriptor Realm(string realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContentValue)) + { + writer.WritePropertyName("content"); + writer.WriteStringValue(ContentValue); + } + + writer.WritePropertyName("ids"); + JsonSerializer.Serialize(writer, IdsValue, options); + if (!string.IsNullOrEmpty(QueryStringValue)) + { + writer.WritePropertyName("query_string"); + writer.WriteStringValue(QueryStringValue); + } + + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs new file mode 100644 index 00000000000..e9b3fb8a04d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlCompleteLogoutResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlCompleteLogoutResponse : ElasticsearchResponse +{ +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs new file mode 100644 index 00000000000..a4fda7b3fa0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateRequest.g.cs @@ -0,0 +1,161 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlInvalidateRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a SAML LogoutRequest message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlInvalidateRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_invalidate"; + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. + /// + /// + [JsonInclude, JsonPropertyName("acs")] + public string? Acs { get; set; } + + /// + /// + /// The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. + /// This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. + /// If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. + /// In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. + /// The client application must not attempt to parse or process the string in any way. + /// + /// + [JsonInclude, JsonPropertyName("query_string")] + public string QueryString { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } +} + +/// +/// +/// Submits a SAML LogoutRequest message to Elasticsearch for consumption. +/// +/// +public sealed partial class SamlInvalidateRequestDescriptor : RequestDescriptor +{ + internal SamlInvalidateRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlInvalidateRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlInvalidate; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_invalidate"; + + private string? AcsValue { get; set; } + private string QueryStringValue { get; set; } + private string? RealmValue { get; set; } + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter. + /// + /// + public SamlInvalidateRequestDescriptor Acs(string? acs) + { + AcsValue = acs; + return Self; + } + + /// + /// + /// The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. + /// This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. + /// If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. + /// In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. + /// The client application must not attempt to parse or process the string in any way. + /// + /// + public SamlInvalidateRequestDescriptor QueryString(string queryString) + { + QueryStringValue = queryString; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter. + /// + /// + public SamlInvalidateRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AcsValue)) + { + writer.WritePropertyName("acs"); + writer.WriteStringValue(AcsValue); + } + + writer.WritePropertyName("query_string"); + writer.WriteStringValue(QueryStringValue); + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs new file mode 100644 index 00000000000..afb8237ad22 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlInvalidateResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlInvalidateResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("invalidated")] + public int Invalidated { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs new file mode 100644 index 00000000000..f9e3c658f8a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutRequest.g.cs @@ -0,0 +1,131 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlLogoutRequestParameters : RequestParameters +{ +} + +/// +/// +/// Submits a request to invalidate an access token and refresh token. +/// +/// +public sealed partial class SamlLogoutRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_logout"; + + /// + /// + /// The refresh token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent refresh token that was received after refreshing the original access token. + /// + /// + [JsonInclude, JsonPropertyName("refresh_token")] + public string? RefreshToken { get; set; } + + /// + /// + /// The access token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. + /// + /// + [JsonInclude, JsonPropertyName("token")] + public string Token { get; set; } +} + +/// +/// +/// Submits a request to invalidate an access token and refresh token. +/// +/// +public sealed partial class SamlLogoutRequestDescriptor : RequestDescriptor +{ + internal SamlLogoutRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlLogoutRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlLogout; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_logout"; + + private string? RefreshTokenValue { get; set; } + private string TokenValue { get; set; } + + /// + /// + /// The refresh token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent refresh token that was received after refreshing the original access token. + /// + /// + public SamlLogoutRequestDescriptor RefreshToken(string? refreshToken) + { + RefreshTokenValue = refreshToken; + return Self; + } + + /// + /// + /// The access token that was returned as a response to calling the SAML authenticate API. + /// Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token. + /// + /// + public SamlLogoutRequestDescriptor Token(string token) + { + TokenValue = token; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(RefreshTokenValue)) + { + writer.WritePropertyName("refresh_token"); + writer.WriteStringValue(RefreshTokenValue); + } + + writer.WritePropertyName("token"); + writer.WriteStringValue(TokenValue); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs new file mode 100644 index 00000000000..07e111b2a2b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlLogoutResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlLogoutResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs new file mode 100644 index 00000000000..268c99d9459 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationRequest.g.cs @@ -0,0 +1,163 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlPrepareAuthenticationRequestParameters : RequestParameters +{ +} + +/// +/// +/// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +/// +/// +public sealed partial class SamlPrepareAuthenticationRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_prepare_authentication"; + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. + /// The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. + /// + /// + [JsonInclude, JsonPropertyName("acs")] + public string? Acs { get; set; } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. + /// You must specify either this parameter or the acs parameter. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; set; } + + /// + /// + /// A string that will be included in the redirect URL that this API returns as the RelayState query parameter. + /// If the Authentication Request is signed, this value is used as part of the signature computation. + /// + /// + [JsonInclude, JsonPropertyName("relay_state")] + public string? RelayState { get; set; } +} + +/// +/// +/// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. +/// +/// +public sealed partial class SamlPrepareAuthenticationRequestDescriptor : RequestDescriptor +{ + internal SamlPrepareAuthenticationRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlPrepareAuthenticationRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlPrepareAuthentication; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.saml_prepare_authentication"; + + private string? AcsValue { get; set; } + private string? RealmValue { get; set; } + private string? RelayStateValue { get; set; } + + /// + /// + /// The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. + /// The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor Acs(string? acs) + { + AcsValue = acs; + return Self; + } + + /// + /// + /// The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. + /// You must specify either this parameter or the acs parameter. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor Realm(string? realm) + { + RealmValue = realm; + return Self; + } + + /// + /// + /// A string that will be included in the redirect URL that this API returns as the RelayState query parameter. + /// If the Authentication Request is signed, this value is used as part of the signature computation. + /// + /// + public SamlPrepareAuthenticationRequestDescriptor RelayState(string? relayState) + { + RelayStateValue = relayState; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(AcsValue)) + { + writer.WritePropertyName("acs"); + writer.WriteStringValue(AcsValue); + } + + if (!string.IsNullOrEmpty(RealmValue)) + { + writer.WritePropertyName("realm"); + writer.WriteStringValue(RealmValue); + } + + if (!string.IsNullOrEmpty(RelayStateValue)) + { + writer.WritePropertyName("relay_state"); + writer.WriteStringValue(RelayStateValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs new file mode 100644 index 00000000000..dd6dd3b5d56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlPrepareAuthenticationResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlPrepareAuthenticationResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + [JsonInclude, JsonPropertyName("realm")] + public string Realm { get; init; } + [JsonInclude, JsonPropertyName("redirect")] + public string Redirect { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs new file mode 100644 index 00000000000..55aa654e277 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataRequest.g.cs @@ -0,0 +1,86 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlServiceProviderMetadataRequestParameters : RequestParameters +{ +} + +/// +/// +/// Generate SAML metadata for a SAML 2.0 Service Provider. +/// +/// +public sealed partial class SamlServiceProviderMetadataRequest : PlainRequest +{ + public SamlServiceProviderMetadataRequest(Elastic.Clients.Elasticsearch.Name realmName) : base(r => r.Required("realm_name", realmName)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.saml_service_provider_metadata"; +} + +/// +/// +/// Generate SAML metadata for a SAML 2.0 Service Provider. +/// +/// +public sealed partial class SamlServiceProviderMetadataRequestDescriptor : RequestDescriptor +{ + internal SamlServiceProviderMetadataRequestDescriptor(Action configure) => configure.Invoke(this); + + public SamlServiceProviderMetadataRequestDescriptor(Elastic.Clients.Elasticsearch.Name realmName) : base(r => r.Required("realm_name", realmName)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySamlServiceProviderMetadata; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + internal override string OperationName => "security.saml_service_provider_metadata"; + + public SamlServiceProviderMetadataRequestDescriptor RealmName(Elastic.Clients.Elasticsearch.Name realmName) + { + RouteValues.Required("realm_name", realmName); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs new file mode 100644 index 00000000000..b64c8776d95 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SamlServiceProviderMetadataResponse.g.cs @@ -0,0 +1,33 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SamlServiceProviderMetadataResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("metadata")] + public string Metadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs new file mode 100644 index 00000000000..33e4f77a8fe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesRequest.g.cs @@ -0,0 +1,228 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SuggestUserProfilesRequestParameters : RequestParameters +{ +} + +/// +/// +/// Get suggestions for user profiles that match specified search criteria. +/// +/// +public sealed partial class SuggestUserProfilesRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.suggest_user_profiles"; + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + [JsonInclude, JsonPropertyName("data")] + [SingleOrManyCollectionConverter(typeof(string))] + public ICollection? Data { get; set; } + + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint don't exclude the profile from the response + /// as long as the profile matches the name field query. + /// + /// + [JsonInclude, JsonPropertyName("hint")] + public Elastic.Clients.Elasticsearch.Security.Hint? Hint { get; set; } + + /// + /// + /// Query string used to match name-related fields in user profile documents. + /// Name-related fields are the user's username, full_name, and email. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// + /// Number of profiles to return. + /// + /// + [JsonInclude, JsonPropertyName("size")] + public long? Size { get; set; } +} + +/// +/// +/// Get suggestions for user profiles that match specified search criteria. +/// +/// +public sealed partial class SuggestUserProfilesRequestDescriptor : RequestDescriptor +{ + internal SuggestUserProfilesRequestDescriptor(Action configure) => configure.Invoke(this); + + public SuggestUserProfilesRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecuritySuggestUserProfiles; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.suggest_user_profiles"; + + private ICollection? DataValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.Hint? HintValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.HintDescriptor HintDescriptor { get; set; } + private Action HintDescriptorAction { get; set; } + private string? NameValue { get; set; } + private long? SizeValue { get; set; } + + /// + /// + /// List of filters for the data field of the profile document. + /// To return all content use data=*. To return a subset of content + /// use data=<key> to retrieve content nested under the specified <key>. + /// By default returns no data content. + /// + /// + public SuggestUserProfilesRequestDescriptor Data(ICollection? data) + { + DataValue = data; + return Self; + } + + /// + /// + /// Extra search criteria to improve relevance of the suggestion result. + /// Profiles matching the spcified hint are ranked higher in the response. + /// Profiles not matching the hint don't exclude the profile from the response + /// as long as the profile matches the name field query. + /// + /// + public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Security.Hint? hint) + { + HintDescriptor = null; + HintDescriptorAction = null; + HintValue = hint; + return Self; + } + + public SuggestUserProfilesRequestDescriptor Hint(Elastic.Clients.Elasticsearch.Security.HintDescriptor descriptor) + { + HintValue = null; + HintDescriptorAction = null; + HintDescriptor = descriptor; + return Self; + } + + public SuggestUserProfilesRequestDescriptor Hint(Action configure) + { + HintValue = null; + HintDescriptor = null; + HintDescriptorAction = configure; + return Self; + } + + /// + /// + /// Query string used to match name-related fields in user profile documents. + /// Name-related fields are the user's username, full_name, and email. + /// + /// + public SuggestUserProfilesRequestDescriptor Name(string? name) + { + NameValue = name; + return Self; + } + + /// + /// + /// Number of profiles to return. + /// + /// + public SuggestUserProfilesRequestDescriptor Size(long? size) + { + SizeValue = size; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DataValue is not null) + { + writer.WritePropertyName("data"); + SingleOrManySerializationHelper.Serialize(DataValue, writer, options); + } + + if (HintDescriptor is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, HintDescriptor, options); + } + else if (HintDescriptorAction is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.HintDescriptor(HintDescriptorAction), options); + } + else if (HintValue is not null) + { + writer.WritePropertyName("hint"); + JsonSerializer.Serialize(writer, HintValue, options); + } + + if (!string.IsNullOrEmpty(NameValue)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(NameValue); + } + + if (SizeValue.HasValue) + { + writer.WritePropertyName("size"); + writer.WriteNumberValue(SizeValue.Value); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs new file mode 100644 index 00000000000..9ab634abb11 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SuggestUserProfilesResponse.g.cs @@ -0,0 +1,37 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class SuggestUserProfilesResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("profiles")] + public IReadOnlyCollection Profiles { get; init; } + [JsonInclude, JsonPropertyName("took")] + public long Took { get; init; } + [JsonInclude, JsonPropertyName("total")] + public Elastic.Clients.Elasticsearch.Security.TotalUserProfiles Total { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs new file mode 100644 index 00000000000..0bb9d8738ad --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyRequest.g.cs @@ -0,0 +1,295 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UpdateApiKeyRequestParameters : RequestParameters +{ +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequest : PlainRequest +{ + public UpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + /// + /// + /// Expiration time for the API key. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public Elastic.Clients.Elasticsearch.Duration? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IDictionary? RoleDescriptors { get; set; } +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor, UpdateApiKeyRequestParameters> +{ + internal UpdateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private IDictionary> RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. + /// + /// + public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public UpdateApiKeyRequestDescriptor RoleDescriptors(Func>, FluentDescriptorDictionary>> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} + +/// +/// +/// Update an API key. +/// Updates attributes of an existing API key. +/// Users can only update API keys that they created or that were granted to them. +/// Use this API to update API keys created by the create API Key or grant API Key APIs. +/// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. +/// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. +/// This API supports updates to an API key’s access scope and metadata. +/// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. +/// The snapshot of the owner’s permissions is updated automatically on every call. +/// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. +/// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. +/// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. +/// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. +/// To update an API key, the owner user’s credentials are required. +/// +/// +public sealed partial class UpdateApiKeyRequestDescriptor : RequestDescriptor +{ + internal UpdateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + + public UpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateApiKey; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_api_key"; + + public UpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Elastic.Clients.Elasticsearch.Duration? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private IDictionary RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. + /// + /// + public UpdateApiKeyRequestDescriptor Expiration(Elastic.Clients.Elasticsearch.Duration? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public UpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API. + /// + /// + public UpdateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDescriptorDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExpirationValue is not null) + { + writer.WritePropertyName("expiration"); + JsonSerializer.Serialize(writer, ExpirationValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs new file mode 100644 index 00000000000..ceeb922e33e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateApiKeyResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UpdateApiKeyResponse : ElasticsearchResponse +{ + /// + /// + /// If true, the API key was updated. + /// If false, the API key didn’t change because no change was detected. + /// + /// + [JsonInclude, JsonPropertyName("updated")] + public bool Updated { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs new file mode 100644 index 00000000000..e71721fa22d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataRequest.g.cs @@ -0,0 +1,197 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UpdateUserProfileDataRequestParameters : RequestParameters +{ + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } +} + +/// +/// +/// Updates specific data for the user profile that's associated with the specified unique ID. +/// +/// +public sealed partial class UpdateUserProfileDataRequest : PlainRequest +{ + public UpdateUserProfileDataRequest(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_user_profile_data"; + + /// + /// + /// Only perform the operation if the document has this primary term. + /// + /// + [JsonIgnore] + public long? IfPrimaryTerm { get => Q("if_primary_term"); set => Q("if_primary_term", value); } + + /// + /// + /// Only perform the operation if the document has this sequence number. + /// + /// + [JsonIgnore] + public long? IfSeqNo { get => Q("if_seq_no"); set => Q("if_seq_no", value); } + + /// + /// + /// If 'true', Elasticsearch refreshes the affected shards to make this operation + /// visible to search, if 'wait_for' then wait for a refresh to make this operation + /// visible to search, if 'false' do nothing with refreshes. + /// + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Refresh? Refresh { get => Q("refresh"); set => Q("refresh", value); } + + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// + /// + [JsonInclude, JsonPropertyName("data")] + public IDictionary? Data { get; set; } + + /// + /// + /// Searchable data that you want to associate with the user profile. This + /// field supports a nested data structure. + /// + /// + [JsonInclude, JsonPropertyName("labels")] + public IDictionary? Labels { get; set; } +} + +/// +/// +/// Updates specific data for the user profile that's associated with the specified unique ID. +/// +/// +public sealed partial class UpdateUserProfileDataRequestDescriptor : RequestDescriptor +{ + internal UpdateUserProfileDataRequestDescriptor(Action configure) => configure.Invoke(this); + + public UpdateUserProfileDataRequestDescriptor(string uid) : base(r => r.Required("uid", uid)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.SecurityUpdateUserProfileData; + + protected override HttpMethod StaticHttpMethod => HttpMethod.PUT; + + internal override bool SupportsBody => true; + + internal override string OperationName => "security.update_user_profile_data"; + + public UpdateUserProfileDataRequestDescriptor IfPrimaryTerm(long? ifPrimaryTerm) => Qs("if_primary_term", ifPrimaryTerm); + public UpdateUserProfileDataRequestDescriptor IfSeqNo(long? ifSeqNo) => Qs("if_seq_no", ifSeqNo); + public UpdateUserProfileDataRequestDescriptor Refresh(Elastic.Clients.Elasticsearch.Refresh? refresh) => Qs("refresh", refresh); + + public UpdateUserProfileDataRequestDescriptor Uid(string uid) + { + RouteValues.Required("uid", uid); + return Self; + } + + private IDictionary? DataValue { get; set; } + private IDictionary? LabelsValue { get; set; } + + /// + /// + /// Non-searchable data that you want to associate with the user profile. + /// This field supports a nested data structure. + /// + /// + public UpdateUserProfileDataRequestDescriptor Data(Func, FluentDictionary> selector) + { + DataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// Searchable data that you want to associate with the user profile. This + /// field supports a nested data structure. + /// + /// + public UpdateUserProfileDataRequestDescriptor Labels(Func, FluentDictionary> selector) + { + LabelsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (DataValue is not null) + { + writer.WritePropertyName("data"); + JsonSerializer.Serialize(writer, DataValue, options); + } + + if (LabelsValue is not null) + { + writer.WritePropertyName("labels"); + JsonSerializer.Serialize(writer, LabelsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs new file mode 100644 index 00000000000..1d47f41e31d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/UpdateUserProfileDataResponse.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UpdateUserProfileDataResponse : ElasticsearchResponse +{ + /// + /// + /// For a successful response, this value is always true. On failure, an exception is returned instead. + /// + /// + [JsonInclude, JsonPropertyName("acknowledged")] + public bool Acknowledged { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs new file mode 100644 index 00000000000..082b0e1a4af --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs @@ -0,0 +1,7163 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch.Security; + +public partial class SecurityNamespacedClient : NamespacedClientProxy +{ + /// + /// + /// Initializes a new instance of the class for mocking. + /// + /// + protected SecurityNamespacedClient() : base() + { + } + + internal SecurityNamespacedClient(ElasticsearchClient client) : base(client) + { + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ActivateUserProfileResponse ActivateUserProfile(ActivateUserProfileRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ActivateUserProfileResponse ActivateUserProfile(ActivateUserProfileRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ActivateUserProfileResponse ActivateUserProfile() + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ActivateUserProfileResponse ActivateUserProfile(Action configureRequest) + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(ActivateUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(CancellationToken cancellationToken = default) + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates or updates a user profile on behalf of another user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ActivateUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ActivateUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual AuthenticateResponse Authenticate(AuthenticateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(AuthenticateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual AuthenticateResponse Authenticate(AuthenticateRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual AuthenticateResponse Authenticate() + { + var descriptor = new AuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual AuthenticateResponse Authenticate(Action configureRequest) + { + var descriptor = new AuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(AuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new AuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Authenticate a user. + /// Authenticates a user and returns information about the authenticated user. + /// Include the user information in a basic auth header. + /// A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + /// If the user cannot be authenticated, this API returns a 401 status code. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task AuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new AuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword(ChangePasswordRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(ChangePasswordRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword(ChangePasswordRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username) + { + var descriptor = new ChangePasswordRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword(Elastic.Clients.Elasticsearch.Username? username, Action configureRequest) + { + var descriptor = new ChangePasswordRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword() + { + var descriptor = new ChangePasswordRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ChangePasswordResponse ChangePassword(Action configureRequest) + { + var descriptor = new ChangePasswordRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(ChangePasswordRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, CancellationToken cancellationToken = default) + { + var descriptor = new ChangePasswordRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(Elastic.Clients.Elasticsearch.Username? username, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ChangePasswordRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(CancellationToken cancellationToken = default) + { + var descriptor = new ChangePasswordRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Changes the passwords of users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ChangePasswordAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ChangePasswordRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearApiKeyCacheResponse ClearApiKeyCache(ClearApiKeyCacheRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearApiKeyCacheResponse ClearApiKeyCache(ClearApiKeyCacheRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearApiKeyCacheResponse ClearApiKeyCache(Elastic.Clients.Elasticsearch.Ids ids, Action configureRequest) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(ClearApiKeyCacheRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, CancellationToken cancellationToken = default) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts a subset of all entries from the API key cache. + /// The cache is also automatically cleared on state changes of the security index. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearApiKeyCacheAsync(Elastic.Clients.Elasticsearch.Ids ids, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearApiKeyCacheRequestDescriptor(ids); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(ClearCachedPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(ClearCachedPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedPrivilegesResponse ClearCachedPrivileges(Elastic.Clients.Elasticsearch.Name application, Action configureRequest) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(ClearCachedPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts application privileges from the native application privileges cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedPrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedPrivilegesRequestDescriptor(application); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRealmsResponse ClearCachedRealms(ClearCachedRealmsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRealmsResponse ClearCachedRealms(ClearCachedRealmsRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRealmsResponse ClearCachedRealms(Elastic.Clients.Elasticsearch.Names realms, Action configureRequest) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(ClearCachedRealmsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts users from the user cache. Can completely clear the cache or evict specific users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRealmsAsync(Elastic.Clients.Elasticsearch.Names realms, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRealmsRequestDescriptor(realms); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRolesResponse ClearCachedRoles(ClearCachedRolesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRolesResponse ClearCachedRoles(ClearCachedRolesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedRolesResponse ClearCachedRoles(Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(ClearCachedRolesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts roles from the native role cache. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedRolesAsync(Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedRolesRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(ClearCachedServiceTokensRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(ClearCachedServiceTokensRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(string ns, string service, Elastic.Clients.Elasticsearch.Names name) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual ClearCachedServiceTokensResponse ClearCachedServiceTokens(string ns, string service, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(ClearCachedServiceTokensRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Evicts tokens from the service account token caches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ClearCachedServiceTokensAsync(string ns, string service, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ClearCachedServiceTokensRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey() + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey(Action> configureRequest) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey(CreateApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey() + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateApiKeyResponse CreateApiKey(Action configureRequest) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, CreateApiKeyResponse, CreateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CreateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Create an API key. + /// Creates an API key for access without requiring basic authentication. + /// A successful request returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(CreateServiceTokenRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(CreateServiceTokenRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name? name) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, Action configureRequest) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual CreateServiceTokenResponse CreateServiceToken(string ns, string service, Action configureRequest) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(CreateServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a service accounts token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CreateServiceTokenAsync(string ns, string service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CreateServiceTokenRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeletePrivilegesResponse DeletePrivileges(DeletePrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeletePrivilegesResponse DeletePrivileges(DeletePrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeletePrivilegesResponse DeletePrivileges(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, Action configureRequest) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(DeletePrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, CancellationToken cancellationToken = default) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeletePrivilegesAsync(Elastic.Clients.Elasticsearch.Name application, Elastic.Clients.Elasticsearch.Names name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeletePrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleResponse DeleteRole(DeleteRoleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(DeleteRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleResponse DeleteRole(DeleteRoleRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleResponse DeleteRole(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(DeleteRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes roles in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleMappingResponse DeleteRoleMapping(DeleteRoleMappingRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleMappingResponse DeleteRoleMapping(DeleteRoleMappingRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteRoleMappingResponse DeleteRoleMapping(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(DeleteRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Removes role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteServiceTokenResponse DeleteServiceToken(DeleteServiceTokenRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteServiceTokenResponse DeleteServiceToken(DeleteServiceTokenRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteServiceTokenResponse DeleteServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteServiceTokenResponse DeleteServiceToken(string ns, string service, Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(DeleteServiceTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes a service account token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteServiceTokenAsync(string ns, string service, Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteServiceTokenRequestDescriptor(ns, service, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteUserResponse DeleteUser(DeleteUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteUserAsync(DeleteUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteUserResponse DeleteUser(DeleteUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username) + { + var descriptor = new DeleteUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DeleteUserResponse DeleteUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + { + var descriptor = new DeleteUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteUserAsync(DeleteUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Deletes users from the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DeleteUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DeleteUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserResponse DisableUser(DisableUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserAsync(DisableUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserResponse DisableUser(DisableUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username) + { + var descriptor = new DisableUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserResponse DisableUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + { + var descriptor = new DisableUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserAsync(DisableUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserProfileResponse DisableUserProfile(DisableUserProfileRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(DisableUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserProfileResponse DisableUserProfile(DisableUserProfileRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserProfileResponse DisableUserProfile(string uid) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual DisableUserProfileResponse DisableUserProfile(string uid, Action configureRequest) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(DisableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Disables a user profile so it's not visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task DisableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new DisableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserResponse EnableUser(EnableUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserAsync(EnableUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserResponse EnableUser(EnableUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username) + { + var descriptor = new EnableUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserResponse EnableUser(Elastic.Clients.Elasticsearch.Username username, Action configureRequest) + { + var descriptor = new EnableUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserAsync(EnableUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables users in the native realm. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserAsync(Elastic.Clients.Elasticsearch.Username username, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserProfileResponse EnableUserProfile(EnableUserProfileRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(EnableUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserProfileResponse EnableUserProfile(EnableUserProfileRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserProfileResponse EnableUserProfile(string uid) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnableUserProfileResponse EnableUserProfile(string uid, Action configureRequest) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(EnableUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a user profile so it's visible in user profile searches. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnableUserProfileAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new EnableUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollKibanaResponse EnrollKibana(EnrollKibanaRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollKibanaAsync(EnrollKibanaRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollKibanaResponse EnrollKibana(EnrollKibanaRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollKibanaResponse EnrollKibana() + { + var descriptor = new EnrollKibanaRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollKibanaResponse EnrollKibana(Action configureRequest) + { + var descriptor = new EnrollKibanaRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollKibanaAsync(EnrollKibanaRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollKibanaAsync(CancellationToken cancellationToken = default) + { + var descriptor = new EnrollKibanaRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Enables a Kibana instance to configure itself for communication with a secured Elasticsearch cluster. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollKibanaAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new EnrollKibanaRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollNodeResponse EnrollNode(EnrollNodeRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollNodeAsync(EnrollNodeRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollNodeResponse EnrollNode(EnrollNodeRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollNodeResponse EnrollNode() + { + var descriptor = new EnrollNodeRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual EnrollNodeResponse EnrollNode(Action configureRequest) + { + var descriptor = new EnrollNodeRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollNodeAsync(EnrollNodeRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollNodeAsync(CancellationToken cancellationToken = default) + { + var descriptor = new EnrollNodeRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Allows a new node to join an existing cluster with security features enabled. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task EnrollNodeAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new EnrollNodeRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetApiKeyResponse GetApiKey(GetApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(GetApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetApiKeyResponse GetApiKey(GetApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetApiKeyResponse GetApiKey() + { + var descriptor = new GetApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetApiKeyResponse GetApiKey(Action configureRequest) + { + var descriptor = new GetApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(GetApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get API key information. + /// Retrieves information for one or more API keys. + /// NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + /// If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(GetBuiltinPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(GetBuiltinPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges() + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetBuiltinPrivilegesResponse GetBuiltinPrivileges(Action configureRequest) + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(GetBuiltinPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetBuiltinPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetBuiltinPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges(GetPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(GetPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges(GetPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges() + { + var descriptor = new GetPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetPrivilegesResponse GetPrivileges(Action configureRequest) + { + var descriptor = new GetPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(GetPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? application, Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(application, name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole(GetRoleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(GetRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole(GetRoleRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name) + { + var descriptor = new GetRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + { + var descriptor = new GetRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole() + { + var descriptor = new GetRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleResponse GetRole(Action configureRequest) + { + var descriptor = new GetRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(GetRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The get roles API cannot retrieve roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping(GetRoleMappingRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(GetRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping(GetRoleMappingRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping() + { + var descriptor = new GetRoleMappingRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetRoleMappingResponse GetRoleMapping(Action configureRequest) + { + var descriptor = new GetRoleMappingRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(GetRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Elastic.Clients.Elasticsearch.Names? name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetRoleMappingAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetRoleMappingRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts(GetServiceAccountsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts(GetServiceAccountsRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts(string? ns, string? service) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts(string? ns, string? service, Action configureRequest) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts() + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceAccountsResponse GetServiceAccounts(Action configureRequest) + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(GetServiceAccountsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(string? ns, string? service, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(string? ns, string? service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// This API returns a list of service accounts that match the provided path parameter(s). + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceAccountsAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceAccountsRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceCredentialsResponse GetServiceCredentials(GetServiceCredentialsRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceCredentialsResponse GetServiceCredentials(GetServiceCredentialsRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceCredentialsResponse GetServiceCredentials(string ns, Elastic.Clients.Elasticsearch.Name service) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetServiceCredentialsResponse GetServiceCredentials(string ns, Elastic.Clients.Elasticsearch.Name service, Action configureRequest) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(GetServiceCredentialsRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Name service, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information of all service credentials for a service account. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetServiceCredentialsAsync(string ns, Elastic.Clients.Elasticsearch.Name service, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetServiceCredentialsRequestDescriptor(ns, service); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetTokenResponse GetToken(GetTokenRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(GetTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetTokenResponse GetToken(GetTokenRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetTokenResponse GetToken() + { + var descriptor = new GetTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetTokenResponse GetToken(Action configureRequest) + { + var descriptor = new GetTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(GetTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a bearer token for access without requiring basic authentication. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser(GetUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(GetUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser(GetUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser(IReadOnlyCollection? username) + { + var descriptor = new GetUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser(IReadOnlyCollection? username, Action configureRequest) + { + var descriptor = new GetUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser() + { + var descriptor = new GetUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserResponse GetUser(Action configureRequest) + { + var descriptor = new GetUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(GetUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(IReadOnlyCollection? username, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserRequestDescriptor(username); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(IReadOnlyCollection? username, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserRequestDescriptor(username); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information about users in the native realm and built-in users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserPrivilegesResponse GetUserPrivileges(GetUserPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserPrivilegesResponse GetUserPrivileges(GetUserPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserPrivilegesResponse GetUserPrivileges() + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserPrivilegesResponse GetUserPrivileges(Action configureRequest) + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(GetUserPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves security privileges for the logged in user. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserProfileResponse GetUserProfile(GetUserProfileRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(GetUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserProfileResponse GetUserProfile(GetUserProfileRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserProfileResponse GetUserProfile(IReadOnlyCollection uid) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GetUserProfileResponse GetUserProfile(IReadOnlyCollection uid, Action configureRequest) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(GetUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves a user's profile using the unique profile ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetUserProfileAsync(IReadOnlyCollection uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetUserProfileRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey() + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey(Action> configureRequest) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey(GrantApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey() + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual GrantApiKeyResponse GrantApiKey(Action configureRequest) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, GrantApiKeyResponse, GrantApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(GrantApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates an API key on behalf of another user. + /// This API is similar to Create API keys, however it creates the API key for a user that is different than the user that runs the API. + /// The caller must have authentication credentials (either an access token, or a username and password) for the user on whose behalf the API key will be created. + /// It is not possible to use this API to create an API key without that user’s credentials. + /// The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + /// In this case, the API key will be created on behalf of the impersonated user. + /// + /// + /// This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + /// + /// + /// A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + /// If applicable, it also returns expiration information for the API key in milliseconds. + /// + /// + /// By default, API keys never expire. You can specify expiration information when you create the API keys. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GrantApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GrantApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges(HasPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(HasPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges(HasPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges(Elastic.Clients.Elasticsearch.Name? user, Action configureRequest) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges() + { + var descriptor = new HasPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesResponse HasPrivileges(Action configureRequest) + { + var descriptor = new HasPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(HasPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Elastic.Clients.Elasticsearch.Name? user, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(user); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Check user privileges. + /// Determines whether the specified user has a specified list of privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(HasPrivilegesUserProfileRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(HasPrivilegesUserProfileRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile() + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual HasPrivilegesUserProfileResponse HasPrivilegesUserProfile(Action configureRequest) + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(HasPrivilegesUserProfileRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Determines whether the users associated with the specified profile IDs have all the requested privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task HasPrivilegesUserProfileAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new HasPrivilegesUserProfileRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateApiKeyResponse InvalidateApiKey(InvalidateApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateApiKeyResponse InvalidateApiKey(InvalidateApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateApiKeyResponse InvalidateApiKey() + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateApiKeyResponse InvalidateApiKey(Action configureRequest) + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(InvalidateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidate API keys. + /// Invalidates one or more API keys. + /// The manage_api_key privilege allows deleting any API keys. + /// The manage_own_api_key only allows deleting API keys that are owned by the user. + /// In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats: + /// + /// + /// + /// + /// Set the parameter owner=true. + /// + /// + /// + /// + /// Or, set both username and realm_name to match the user’s identity. + /// + /// + /// + /// + /// Or, if the request is issued by an API key, i.e. an API key invalidates itself, specify its ID in the ids field. + /// + /// + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateApiKeyAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateApiKeyRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateTokenResponse InvalidateToken(InvalidateTokenRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(InvalidateTokenRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateTokenResponse InvalidateToken(InvalidateTokenRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateTokenResponse InvalidateToken() + { + var descriptor = new InvalidateTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual InvalidateTokenResponse InvalidateToken(Action configureRequest) + { + var descriptor = new InvalidateTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(InvalidateTokenRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateTokenRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Invalidates one or more access tokens or refresh tokens. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task InvalidateTokenAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new InvalidateTokenRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutPrivilegesResponse PutPrivileges(PutPrivilegesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(PutPrivilegesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutPrivilegesResponse PutPrivileges(PutPrivilegesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutPrivilegesResponse PutPrivileges() + { + var descriptor = new PutPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutPrivilegesResponse PutPrivileges(Action configureRequest) + { + var descriptor = new PutPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(PutPrivilegesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new PutPrivilegesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds or updates application privileges. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutPrivilegesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutPrivilegesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(PutRoleRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(PutRoleRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, PutRoleResponse, PutRoleRequestParameters>(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(PutRoleRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleResponse PutRole(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, PutRoleResponse, PutRoleRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(PutRoleRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + /// The create or update roles API cannot update roles that are defined in roles files. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleMappingResponse PutRoleMapping(PutRoleMappingRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(PutRoleMappingRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleMappingResponse PutRoleMapping(PutRoleMappingRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutRoleMappingResponse PutRoleMapping(Elastic.Clients.Elasticsearch.Name name, Action configureRequest) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(PutRoleMappingRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates and updates role mappings. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutRoleMappingAsync(Elastic.Clients.Elasticsearch.Name name, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new PutRoleMappingRequestDescriptor(name); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Adds and updates users in the native realm. These users are commonly referred to as native users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutUserResponse PutUser(PutUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Adds and updates users in the native realm. These users are commonly referred to as native users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutUserAsync(PutUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Adds and updates users in the native realm. These users are commonly referred to as native users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual PutUserResponse PutUser(PutUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Adds and updates users in the native realm. These users are commonly referred to as native users. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task PutUserAsync(PutUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys() + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys(Action> configureRequest) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys(QueryApiKeysRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys() + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryApiKeysResponse QueryApiKeys(Action configureRequest) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryApiKeysResponse, QueryApiKeysRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(QueryApiKeysRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Query API keys. + /// Retrieves a paginated list of API keys and their information. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryApiKeysAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryApiKeysRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser(QueryUserRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser(QueryUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser() + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser(Action> configureRequest) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, QueryUserResponse, QueryUserRequestParameters>(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser(QueryUserRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser() + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual QueryUserResponse QueryUser(Action configureRequest) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, QueryUserResponse, QueryUserRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(QueryUserRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Retrieves information for Users in a paginated manner. You can optionally filter the results with a query. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task QueryUserAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new QueryUserRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlAuthenticateResponse SamlAuthenticate(SamlAuthenticateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlAuthenticateResponse SamlAuthenticate(SamlAuthenticateRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlAuthenticateResponse SamlAuthenticate() + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlAuthenticateResponse SamlAuthenticate(Action configureRequest) + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(SamlAuthenticateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML Response message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlAuthenticateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlAuthenticateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlCompleteLogoutResponse SamlCompleteLogout(SamlCompleteLogoutRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlCompleteLogoutResponse SamlCompleteLogout(SamlCompleteLogoutRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlCompleteLogoutResponse SamlCompleteLogout() + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlCompleteLogoutResponse SamlCompleteLogout(Action configureRequest) + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(SamlCompleteLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Verifies the logout response sent from the SAML IdP. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlCompleteLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlCompleteLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlInvalidateResponse SamlInvalidate(SamlInvalidateRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(SamlInvalidateRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlInvalidateResponse SamlInvalidate(SamlInvalidateRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlInvalidateResponse SamlInvalidate() + { + var descriptor = new SamlInvalidateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlInvalidateResponse SamlInvalidate(Action configureRequest) + { + var descriptor = new SamlInvalidateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(SamlInvalidateRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlInvalidateRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a SAML LogoutRequest message to Elasticsearch for consumption. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlInvalidateAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlInvalidateRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlLogoutResponse SamlLogout(SamlLogoutRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(SamlLogoutRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlLogoutResponse SamlLogout(SamlLogoutRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlLogoutResponse SamlLogout() + { + var descriptor = new SamlLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlLogoutResponse SamlLogout(Action configureRequest) + { + var descriptor = new SamlLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(SamlLogoutRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlLogoutRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Submits a request to invalidate an access token and refresh token. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlLogoutAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlLogoutRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(SamlPrepareAuthenticationRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(SamlPrepareAuthenticationRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication() + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlPrepareAuthenticationResponse SamlPrepareAuthentication(Action configureRequest) + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(SamlPrepareAuthenticationRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Creates a SAML authentication request (<AuthnRequest>) as a URL string, based on the configuration of the respective SAML realm in Elasticsearch. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlPrepareAuthenticationAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlPrepareAuthenticationRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(SamlServiceProviderMetadataRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(SamlServiceProviderMetadataRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SamlServiceProviderMetadataResponse SamlServiceProviderMetadata(Elastic.Clients.Elasticsearch.Name realmName, Action configureRequest) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(SamlServiceProviderMetadataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, CancellationToken cancellationToken = default) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Generate SAML metadata for a SAML 2.0 Service Provider. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SamlServiceProviderMetadataAsync(Elastic.Clients.Elasticsearch.Name realmName, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SamlServiceProviderMetadataRequestDescriptor(realmName); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SuggestUserProfilesResponse SuggestUserProfiles(SuggestUserProfilesRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SuggestUserProfilesResponse SuggestUserProfiles(SuggestUserProfilesRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SuggestUserProfilesResponse SuggestUserProfiles() + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual SuggestUserProfilesResponse SuggestUserProfiles(Action configureRequest) + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(SuggestUserProfilesRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(CancellationToken cancellationToken = default) + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Get suggestions for user profiles that match specified search criteria. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task SuggestUserProfilesAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SuggestUserProfilesRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(UpdateApiKeyRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, UpdateApiKeyResponse, UpdateApiKeyRequestParameters>(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(UpdateApiKeyRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Update an API key. + /// Updates attributes of an existing API key. + /// Users can only update API keys that they created or that were granted to them. + /// Use this API to update API keys created by the create API Key or grant API Key APIs. + /// If you need to apply the same update to many API keys, you can use bulk update API Keys to reduce overhead. + /// It’s not possible to update expired API keys, or API keys that have been invalidated by invalidate API Key. + /// This API supports updates to an API key’s access scope and metadata. + /// The access scope of an API key is derived from the role_descriptors you specify in the request, and a snapshot of the owner user’s permissions at the time of the request. + /// The snapshot of the owner’s permissions is updated automatically on every call. + /// If you don’t specify role_descriptors in the request, a call to this API might still change the API key’s access scope. + /// This change can occur if the owner user’s permissions have changed since the API key was created or last modified. + /// To update another user’s API key, use the run_as feature to submit a request on behalf of another user. + /// IMPORTANT: It’s not possible to use an API key as the authentication credential for this API. + /// To update an API key, the owner user’s credentials are required. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateUserProfileDataResponse UpdateUserProfileData(UpdateUserProfileDataRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateUserProfileDataResponse UpdateUserProfileData(UpdateUserProfileDataRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateUserProfileDataResponse UpdateUserProfileData(string uid) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + [Obsolete("Synchronous methods are deprecated and could be removed in the future.")] + public virtual UpdateUserProfileDataResponse UpdateUserProfileData(string uid, Action configureRequest) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(UpdateUserProfileDataRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(string uid, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } + + /// + /// + /// Updates specific data for the user profile that's associated with the specified unique ID. + /// + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task UpdateUserProfileDataAsync(string uid, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new UpdateUserProfileDataRequestDescriptor(uid); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor, cancellationToken); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs index 9439fd34de1..43473816c0c 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs @@ -37,6 +37,7 @@ using Elastic.Clients.Elasticsearch.Rollup; using Elastic.Clients.Elasticsearch.SearchableSnapshots; using Elastic.Clients.Elasticsearch.SearchApplication; +using Elastic.Clients.Elasticsearch.Security; using Elastic.Clients.Elasticsearch.Snapshot; using Elastic.Clients.Elasticsearch.SnapshotLifecycleManagement; using Elastic.Clients.Elasticsearch.Sql; @@ -74,6 +75,7 @@ public partial class ElasticsearchClient public virtual RollupNamespacedClient Rollup { get; private set; } public virtual SearchableSnapshotsNamespacedClient SearchableSnapshots { get; private set; } public virtual SearchApplicationNamespacedClient SearchApplication { get; private set; } + public virtual SecurityNamespacedClient Security { get; private set; } public virtual SnapshotNamespacedClient Snapshot { get; private set; } public virtual SnapshotLifecycleManagementNamespacedClient SnapshotLifecycleManagement { get; private set; } public virtual SqlNamespacedClient Sql { get; private set; } @@ -105,6 +107,7 @@ private partial void SetupNamespaces() Rollup = new RollupNamespacedClient(this); SearchableSnapshots = new SearchableSnapshotsNamespacedClient(this); SearchApplication = new SearchApplicationNamespacedClient(this); + Security = new SecurityNamespacedClient(this); Snapshot = new SnapshotNamespacedClient(this); SnapshotLifecycleManagement = new SnapshotLifecycleManagementNamespacedClient(this); Sql = new SqlNamespacedClient(this); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs index 8ad316d222e..3d7bb42a6de 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CardinalityAggregation.g.cs @@ -68,6 +68,7 @@ public sealed partial class CardinalityAggregation public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Cardinality(cardinalityAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(CardinalityAggregation cardinalityAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Cardinality(cardinalityAggregation); } public sealed partial class CardinalityAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs index 3cfcb876337..0c26808c4b1 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/CompositeAggregation.g.cs @@ -55,6 +55,7 @@ public sealed partial class CompositeAggregation public ICollection>? Sources { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Composite(compositeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(CompositeAggregation compositeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Composite(compositeAggregation); } public sealed partial class CompositeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs index a7b33392e97..50816038dd7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/DateRangeAggregation.g.cs @@ -71,6 +71,7 @@ public sealed partial class DateRangeAggregation public string? TimeZone { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.DateRange(dateRangeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(DateRangeAggregation dateRangeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.DateRange(dateRangeAggregation); } public sealed partial class DateRangeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs index 238864d41ac..a710b92bc9b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/MissingAggregation.g.cs @@ -40,6 +40,7 @@ public sealed partial class MissingAggregation public Elastic.Clients.Elasticsearch.FieldValue? Missing { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Missing(missingAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(MissingAggregation missingAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Missing(missingAggregation); } public sealed partial class MissingAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs index e3f55879c16..ea23eb6da79 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/RangeAggregation.g.cs @@ -59,6 +59,7 @@ public sealed partial class RangeAggregation public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Range(rangeAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(RangeAggregation rangeAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Range(rangeAggregation); } public sealed partial class RangeAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs index 3239f08c0e8..f49f740db06 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/TermsAggregation.g.cs @@ -149,6 +149,7 @@ public sealed partial class TermsAggregation public string? ValueType { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.Terms(termsAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Terms(termsAggregation); public static implicit operator Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy(TermsAggregation termsAggregation) => Elastic.Clients.Elasticsearch.TransformManagement.PivotGroupBy.Terms(termsAggregation); } diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs index ef59862b18a..6e0a16f85d7 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Aggregations/ValueCountAggregation.g.cs @@ -51,6 +51,7 @@ public sealed partial class ValueCountAggregation public Elastic.Clients.Elasticsearch.Script? Script { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.Aggregations.Aggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Aggregations.Aggregation.ValueCount(valueCountAggregation); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(ValueCountAggregation valueCountAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.ValueCount(valueCountAggregation); } public sealed partial class ValueCountAggregationDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs new file mode 100644 index 00000000000..5d86de5b198 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Security.g.cs @@ -0,0 +1,345 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Core; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Runtime.Serialization; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(AccessTokenGrantTypeConverter))] +public enum AccessTokenGrantType +{ + [EnumMember(Value = "refresh_token")] + RefreshToken, + [EnumMember(Value = "password")] + Password, + [EnumMember(Value = "_kerberos")] + Kerberos, + [EnumMember(Value = "client_credentials")] + ClientCredentials +} + +internal sealed class AccessTokenGrantTypeConverter : JsonConverter +{ + public override AccessTokenGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "refresh_token": + return AccessTokenGrantType.RefreshToken; + case "password": + return AccessTokenGrantType.Password; + case "_kerberos": + return AccessTokenGrantType.Kerberos; + case "client_credentials": + return AccessTokenGrantType.ClientCredentials; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, AccessTokenGrantType value, JsonSerializerOptions options) + { + switch (value) + { + case AccessTokenGrantType.RefreshToken: + writer.WriteStringValue("refresh_token"); + return; + case AccessTokenGrantType.Password: + writer.WriteStringValue("password"); + return; + case AccessTokenGrantType.Kerberos: + writer.WriteStringValue("_kerberos"); + return; + case AccessTokenGrantType.ClientCredentials: + writer.WriteStringValue("client_credentials"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(ApiKeyGrantTypeConverter))] +public enum ApiKeyGrantType +{ + [EnumMember(Value = "password")] + Password, + [EnumMember(Value = "access_token")] + AccessToken +} + +internal sealed class ApiKeyGrantTypeConverter : JsonConverter +{ + public override ApiKeyGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "password": + return ApiKeyGrantType.Password; + case "access_token": + return ApiKeyGrantType.AccessToken; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyGrantType value, JsonSerializerOptions options) + { + switch (value) + { + case ApiKeyGrantType.Password: + writer.WriteStringValue("password"); + return; + case ApiKeyGrantType.AccessToken: + writer.WriteStringValue("access_token"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(EnumStructConverter))] +public readonly partial struct ClusterPrivilege : IEnumStruct +{ + public ClusterPrivilege(string value) => Value = value; + + ClusterPrivilege IEnumStruct.Create(string value) => value; + + public readonly string Value { get; } + public static ClusterPrivilege WriteFleetSecrets { get; } = new ClusterPrivilege("write_fleet_secrets"); + public static ClusterPrivilege WriteConnectorSecrets { get; } = new ClusterPrivilege("write_connector_secrets"); + public static ClusterPrivilege TransportClient { get; } = new ClusterPrivilege("transport_client"); + public static ClusterPrivilege ReadSlm { get; } = new ClusterPrivilege("read_slm"); + public static ClusterPrivilege ReadSecurity { get; } = new ClusterPrivilege("read_security"); + public static ClusterPrivilege ReadPipeline { get; } = new ClusterPrivilege("read_pipeline"); + public static ClusterPrivilege ReadIlm { get; } = new ClusterPrivilege("read_ilm"); + public static ClusterPrivilege ReadFleetSecrets { get; } = new ClusterPrivilege("read_fleet_secrets"); + public static ClusterPrivilege ReadCcr { get; } = new ClusterPrivilege("read_ccr"); + public static ClusterPrivilege PostBehavioralAnalyticsEvent { get; } = new ClusterPrivilege("post_behavioral_analytics_event"); + public static ClusterPrivilege None { get; } = new ClusterPrivilege("none"); + public static ClusterPrivilege MonitorWatcher { get; } = new ClusterPrivilege("monitor_watcher"); + public static ClusterPrivilege MonitorTransform { get; } = new ClusterPrivilege("monitor_transform"); + public static ClusterPrivilege MonitorTextStructure { get; } = new ClusterPrivilege("monitor_text_structure"); + public static ClusterPrivilege MonitorSnapshot { get; } = new ClusterPrivilege("monitor_snapshot"); + public static ClusterPrivilege MonitorRollup { get; } = new ClusterPrivilege("monitor_rollup"); + public static ClusterPrivilege MonitorMl { get; } = new ClusterPrivilege("monitor_ml"); + public static ClusterPrivilege MonitorInference { get; } = new ClusterPrivilege("monitor_inference"); + public static ClusterPrivilege MonitorEnrich { get; } = new ClusterPrivilege("monitor_enrich"); + public static ClusterPrivilege MonitorDataStreamGlobalRetention { get; } = new ClusterPrivilege("monitor_data_stream_global_retention"); + public static ClusterPrivilege MonitorDataFrameTransforms { get; } = new ClusterPrivilege("monitor_data_frame_transforms"); + public static ClusterPrivilege Monitor { get; } = new ClusterPrivilege("monitor"); + public static ClusterPrivilege ManageWatcher { get; } = new ClusterPrivilege("manage_watcher"); + public static ClusterPrivilege ManageUserProfile { get; } = new ClusterPrivilege("manage_user_profile"); + public static ClusterPrivilege ManageTransform { get; } = new ClusterPrivilege("manage_transform"); + public static ClusterPrivilege ManageToken { get; } = new ClusterPrivilege("manage_token"); + public static ClusterPrivilege ManageSlm { get; } = new ClusterPrivilege("manage_slm"); + public static ClusterPrivilege ManageServiceAccount { get; } = new ClusterPrivilege("manage_service_account"); + public static ClusterPrivilege ManageSecurity { get; } = new ClusterPrivilege("manage_security"); + public static ClusterPrivilege ManageSearchSynonyms { get; } = new ClusterPrivilege("manage_search_synonyms"); + public static ClusterPrivilege ManageSearchQueryRules { get; } = new ClusterPrivilege("manage_search_query_rules"); + public static ClusterPrivilege ManageSearchApplication { get; } = new ClusterPrivilege("manage_search_application"); + public static ClusterPrivilege ManageSaml { get; } = new ClusterPrivilege("manage_saml"); + public static ClusterPrivilege ManageRollup { get; } = new ClusterPrivilege("manage_rollup"); + public static ClusterPrivilege ManagePipeline { get; } = new ClusterPrivilege("manage_pipeline"); + public static ClusterPrivilege ManageOwnApiKey { get; } = new ClusterPrivilege("manage_own_api_key"); + public static ClusterPrivilege ManageOidc { get; } = new ClusterPrivilege("manage_oidc"); + public static ClusterPrivilege ManageMl { get; } = new ClusterPrivilege("manage_ml"); + public static ClusterPrivilege ManageLogstashPipelines { get; } = new ClusterPrivilege("manage_logstash_pipelines"); + public static ClusterPrivilege ManageIngestPipelines { get; } = new ClusterPrivilege("manage_ingest_pipelines"); + public static ClusterPrivilege ManageInference { get; } = new ClusterPrivilege("manage_inference"); + public static ClusterPrivilege ManageIndexTemplates { get; } = new ClusterPrivilege("manage_index_templates"); + public static ClusterPrivilege ManageIlm { get; } = new ClusterPrivilege("manage_ilm"); + public static ClusterPrivilege ManageEnrich { get; } = new ClusterPrivilege("manage_enrich"); + public static ClusterPrivilege ManageDataStreamGlobalRetention { get; } = new ClusterPrivilege("manage_data_stream_global_retention"); + public static ClusterPrivilege ManageDataFrameTransforms { get; } = new ClusterPrivilege("manage_data_frame_transforms"); + public static ClusterPrivilege ManageCcr { get; } = new ClusterPrivilege("manage_ccr"); + public static ClusterPrivilege ManageBehavioralAnalytics { get; } = new ClusterPrivilege("manage_behavioral_analytics"); + public static ClusterPrivilege ManageAutoscaling { get; } = new ClusterPrivilege("manage_autoscaling"); + public static ClusterPrivilege ManageApiKey { get; } = new ClusterPrivilege("manage_api_key"); + public static ClusterPrivilege Manage { get; } = new ClusterPrivilege("manage"); + public static ClusterPrivilege GrantApiKey { get; } = new ClusterPrivilege("grant_api_key"); + public static ClusterPrivilege DelegatePki { get; } = new ClusterPrivilege("delegate_pki"); + public static ClusterPrivilege CrossClusterSearch { get; } = new ClusterPrivilege("cross_cluster_search"); + public static ClusterPrivilege CrossClusterReplication { get; } = new ClusterPrivilege("cross_cluster_replication"); + public static ClusterPrivilege CreateSnapshot { get; } = new ClusterPrivilege("create_snapshot"); + public static ClusterPrivilege CancelTask { get; } = new ClusterPrivilege("cancel_task"); + public static ClusterPrivilege All { get; } = new ClusterPrivilege("all"); + + public override string ToString() => Value ?? string.Empty; + + public static implicit operator string(ClusterPrivilege clusterPrivilege) => clusterPrivilege.Value; + public static implicit operator ClusterPrivilege(string value) => new(value); + + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is ClusterPrivilege other && this.Equals(other); + public bool Equals(ClusterPrivilege other) => Value == other.Value; + + public static bool operator ==(ClusterPrivilege a, ClusterPrivilege b) => a.Equals(b); + public static bool operator !=(ClusterPrivilege a, ClusterPrivilege b) => !(a == b); +} + +[JsonConverter(typeof(GrantTypeConverter))] +public enum GrantType +{ + /// + /// + /// In this type of grant, you must supply the user ID and password for which you want to create the API key. + /// + /// + [EnumMember(Value = "password")] + Password, + /// + /// + /// In this type of grant, you must supply an access token that was created by the Elasticsearch token service. + /// + /// + [EnumMember(Value = "access_token")] + AccessToken +} + +internal sealed class GrantTypeConverter : JsonConverter +{ + public override GrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "password": + return GrantType.Password; + case "access_token": + return GrantType.AccessToken; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, GrantType value, JsonSerializerOptions options) + { + switch (value) + { + case GrantType.Password: + writer.WriteStringValue("password"); + return; + case GrantType.AccessToken: + writer.WriteStringValue("access_token"); + return; + } + + writer.WriteNullValue(); + } +} + +[JsonConverter(typeof(EnumStructConverter))] +public readonly partial struct IndexPrivilege : IEnumStruct +{ + public IndexPrivilege(string value) => Value = value; + + IndexPrivilege IEnumStruct.Create(string value) => value; + + public readonly string Value { get; } + public static IndexPrivilege Write { get; } = new IndexPrivilege("write"); + public static IndexPrivilege ViewIndexMetadata { get; } = new IndexPrivilege("view_index_metadata"); + public static IndexPrivilege ReadCrossCluster { get; } = new IndexPrivilege("read_cross_cluster"); + public static IndexPrivilege Read { get; } = new IndexPrivilege("read"); + public static IndexPrivilege None { get; } = new IndexPrivilege("none"); + public static IndexPrivilege Monitor { get; } = new IndexPrivilege("monitor"); + public static IndexPrivilege ManageLeaderIndex { get; } = new IndexPrivilege("manage_leader_index"); + public static IndexPrivilege ManageIlm { get; } = new IndexPrivilege("manage_ilm"); + public static IndexPrivilege ManageFollowIndex { get; } = new IndexPrivilege("manage_follow_index"); + public static IndexPrivilege ManageDataStreamLifecycle { get; } = new IndexPrivilege("manage_data_stream_lifecycle"); + public static IndexPrivilege Manage { get; } = new IndexPrivilege("manage"); + public static IndexPrivilege Maintenance { get; } = new IndexPrivilege("maintenance"); + public static IndexPrivilege Index { get; } = new IndexPrivilege("index"); + public static IndexPrivilege DeleteIndex { get; } = new IndexPrivilege("delete_index"); + public static IndexPrivilege Delete { get; } = new IndexPrivilege("delete"); + public static IndexPrivilege CrossClusterReplicationInternal { get; } = new IndexPrivilege("cross_cluster_replication_internal"); + public static IndexPrivilege CrossClusterReplication { get; } = new IndexPrivilege("cross_cluster_replication"); + public static IndexPrivilege CreateIndex { get; } = new IndexPrivilege("create_index"); + public static IndexPrivilege CreateDoc { get; } = new IndexPrivilege("create_doc"); + public static IndexPrivilege Create { get; } = new IndexPrivilege("create"); + public static IndexPrivilege AutoConfigure { get; } = new IndexPrivilege("auto_configure"); + public static IndexPrivilege All { get; } = new IndexPrivilege("all"); + + public override string ToString() => Value ?? string.Empty; + + public static implicit operator string(IndexPrivilege indexPrivilege) => indexPrivilege.Value; + public static implicit operator IndexPrivilege(string value) => new(value); + + public override int GetHashCode() => Value.GetHashCode(); + public override bool Equals(object obj) => obj is IndexPrivilege other && this.Equals(other); + public bool Equals(IndexPrivilege other) => Value == other.Value; + + public static bool operator ==(IndexPrivilege a, IndexPrivilege b) => a.Equals(b); + public static bool operator !=(IndexPrivilege a, IndexPrivilege b) => !(a == b); +} + +[JsonConverter(typeof(TemplateFormatConverter))] +public enum TemplateFormat +{ + [EnumMember(Value = "string")] + String, + [EnumMember(Value = "json")] + Json +} + +internal sealed class TemplateFormatConverter : JsonConverter +{ + public override TemplateFormat Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "string": + return TemplateFormat.String; + case "json": + return TemplateFormat.Json; + } + + ThrowHelper.ThrowJsonException(); + return default; + } + + public override void Write(Utf8JsonWriter writer, TemplateFormat value, JsonSerializerOptions options) + { + switch (value) + { + case TemplateFormat.String: + writer.WriteStringValue("string"); + return; + case TemplateFormat.Json: + writer.WriteStringValue("json"); + return; + } + + writer.WriteNullValue(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs index 5993edf9a97..7f15c1861a2 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/BoolQuery.g.cs @@ -89,6 +89,8 @@ public sealed partial class BoolQuery public ICollection? Should { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Bool(boolQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Bool(boolQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(BoolQuery boolQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Bool(boolQuery); } public sealed partial class BoolQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs index 747a1048d9f..bfb513e3808 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/ExistsQuery.g.cs @@ -51,6 +51,8 @@ public sealed partial class ExistsQuery public string? QueryName { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Exists(existsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Exists(existsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(ExistsQuery existsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Exists(existsQuery); } public sealed partial class ExistsQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs index 2750b276048..7fc972890ad 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/IdsQuery.g.cs @@ -51,6 +51,8 @@ public sealed partial class IdsQuery public Elastic.Clients.Elasticsearch.Ids? Values { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Ids(idsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Ids(idsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(IdsQuery idsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Ids(idsQuery); } public sealed partial class IdsQueryDescriptor : SerializableDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs index d5aa761e15d..da8928ca40d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchAllQuery.g.cs @@ -43,6 +43,8 @@ public sealed partial class MatchAllQuery public string? QueryName { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.MatchAll(matchAllQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.MatchAll(matchAllQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(MatchAllQuery matchAllQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.MatchAll(matchAllQuery); } public sealed partial class MatchAllQueryDescriptor : SerializableDescriptor diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs index 6f79abe2a2a..960628ede3e 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/MatchQuery.g.cs @@ -333,6 +333,8 @@ public MatchQuery(Elastic.Clients.Elasticsearch.Field field) public Elastic.Clients.Elasticsearch.QueryDsl.ZeroTermsQuery? ZeroTermsQuery { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Match(matchQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Match(matchQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(MatchQuery matchQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Match(matchQuery); } public sealed partial class MatchQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs index 34776d67825..f1e7e200b2d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/PrefixQuery.g.cs @@ -163,6 +163,8 @@ public PrefixQuery(Elastic.Clients.Elasticsearch.Field field) public string Value { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Prefix(prefixQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Prefix(prefixQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(PrefixQuery prefixQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Prefix(prefixQuery); } public sealed partial class PrefixQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs index 99c7c81fcd0..97767321ddf 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/SimpleQueryStringQuery.g.cs @@ -151,6 +151,8 @@ public sealed partial class SimpleQueryStringQuery public string? QuoteFieldSuffix { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.SimpleQueryString(simpleQueryStringQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.SimpleQueryString(simpleQueryStringQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(SimpleQueryStringQuery simpleQueryStringQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.SimpleQueryString(simpleQueryStringQuery); } public sealed partial class SimpleQueryStringQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs index caeecdb5658..05ab38712f4 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermQuery.g.cs @@ -144,6 +144,8 @@ public TermQuery(Elastic.Clients.Elasticsearch.Field field) public Elastic.Clients.Elasticsearch.FieldValue Value { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(TermQuery termQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Term(termQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Term(termQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(TermQuery termQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Term(termQuery); } public sealed partial class TermQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs index e536d0cb43d..62cdca72499 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/TermsQuery.g.cs @@ -108,6 +108,8 @@ public sealed partial class TermsQuery public Elastic.Clients.Elasticsearch.QueryDsl.TermsQueryField Term { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Terms(termsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Terms(termsQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(TermsQuery termsQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Terms(termsQuery); } public sealed partial class TermsQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs index 3059637d5d3..9fdf7d25989 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/QueryDsl/WildcardQuery.g.cs @@ -185,6 +185,8 @@ public WildcardQuery(Elastic.Clients.Elasticsearch.Field field) public string? Wildcard { get; set; } public static implicit operator Elastic.Clients.Elasticsearch.QueryDsl.Query(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.QueryDsl.Query.Wildcard(wildcardQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Security.ApiKeyQuery.Wildcard(wildcardQuery); + public static implicit operator Elastic.Clients.Elasticsearch.Security.UserQuery(WildcardQuery wildcardQuery) => Elastic.Clients.Elasticsearch.Security.UserQuery.Wildcard(wildcardQuery); } public sealed partial class WildcardQueryDescriptor : SerializableDescriptor> diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs new file mode 100644 index 00000000000..472cadce332 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKey.g.cs @@ -0,0 +1,133 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ApiKey +{ + /// + /// + /// Creation time for the API key in milliseconds. + /// + /// + [JsonInclude, JsonPropertyName("creation")] + public long? Creation { get; init; } + + /// + /// + /// Expiration time for the API key in milliseconds. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public long? Expiration { get; init; } + + /// + /// + /// Id for the API key + /// + /// + [JsonInclude, JsonPropertyName("id")] + public string Id { get; init; } + + /// + /// + /// Invalidation status for the API key. + /// If the key has been invalidated, it has a value of true. Otherwise, it is false. + /// + /// + [JsonInclude, JsonPropertyName("invalidated")] + public bool? Invalidated { get; init; } + + /// + /// + /// The owner user’s permissions associated with the API key. + /// It is a point-in-time snapshot captured at creation and subsequent updates. + /// An API key’s effective permissions are an intersection of its assigned privileges and the owner user’s permissions. + /// + /// + [JsonInclude, JsonPropertyName("limited_by")] + public IReadOnlyCollection>? LimitedBy { get; init; } + + /// + /// + /// Metadata of the API key + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary? Metadata { get; init; } + + /// + /// + /// Name of the API key. + /// + /// + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + + /// + /// + /// The profile uid for the API key owner principal, if requested and if it exists + /// + /// + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + + /// + /// + /// Realm name of the principal for which this API key was created. + /// + /// + [JsonInclude, JsonPropertyName("realm")] + public string? Realm { get; init; } + + /// + /// + /// Realm type of the principal for which this API key was created + /// + /// + [JsonInclude, JsonPropertyName("realm_type")] + public string? RealmType { get; init; } + + /// + /// + /// The role descriptors assigned to this API key when it was created or last updated. + /// An empty role descriptor means the API key inherits the owner user’s permissions. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + public IReadOnlyDictionary? RoleDescriptors { get; init; } + [JsonInclude, JsonPropertyName("_sort")] + public IReadOnlyCollection? Sort { get; init; } + + /// + /// + /// Principal for which this API key was created + /// + /// + [JsonInclude, JsonPropertyName("username")] + public string? Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs new file mode 100644 index 00000000000..89c73ae7bc7 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyAggregation.g.cs @@ -0,0 +1,452 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(ApiKeyAggregationConverter))] +public sealed partial class ApiKeyAggregation +{ + internal ApiKeyAggregation(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static ApiKeyAggregation Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => new ApiKeyAggregation("cardinality", cardinalityAggregation); + public static ApiKeyAggregation Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => new ApiKeyAggregation("composite", compositeAggregation); + public static ApiKeyAggregation DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => new ApiKeyAggregation("date_range", dateRangeAggregation); + public static ApiKeyAggregation Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => new ApiKeyAggregation("filter", apiKeyQueryContainer); + public static ApiKeyAggregation Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => new ApiKeyAggregation("filters", apiKeyFiltersAggregation); + public static ApiKeyAggregation Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => new ApiKeyAggregation("missing", missingAggregation); + public static ApiKeyAggregation Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => new ApiKeyAggregation("range", rangeAggregation); + public static ApiKeyAggregation Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => new ApiKeyAggregation("terms", termsAggregation); + public static ApiKeyAggregation ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => new ApiKeyAggregation("value_count", valueCountAggregation); + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + [JsonInclude, JsonPropertyName("aggregations")] + public IDictionary? Aggregations { get; set; } + [JsonInclude, JsonPropertyName("meta")] + public IDictionary? Meta { get; set; } + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class ApiKeyAggregationConverter : JsonConverter +{ + public override ApiKeyAggregation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + IDictionary? aggregationsValue = default; + IDictionary? metaValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "aggregations") + { + aggregationsValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "meta") + { + metaValue = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (propertyName == "cardinality") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "composite") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "date_range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "filter") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "filters") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "missing") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "value_count") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyAggregation' from the response."); + } + + var result = new ApiKeyAggregation(variantNameValue, variantValue); + result.Aggregations = aggregationsValue; + result.Meta = metaValue; + return result; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyAggregation value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Aggregations is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, value.Aggregations, options); + } + + if (value.Meta is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, value.Meta, options); + } + + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "cardinality": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation)value.Variant, options); + break; + case "composite": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation)value.Variant, options); + break; + case "date_range": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation)value.Variant, options); + break; + case "filter": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.ApiKeyQuery)value.Variant, options); + break; + case "filters": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation)value.Variant, options); + break; + case "missing": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation)value.Variant, options); + break; + case "value_count": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor> +{ + internal ApiKeyAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyAggregationDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyAggregationDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private IDictionary> AggregationsValue { get; set; } + private IDictionary? MetaValue { get; set; } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public ApiKeyAggregationDescriptor Aggregations(Func>, FluentDescriptorDictionary>> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary>()); + return Self; + } + + public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); + public ApiKeyAggregationDescriptor Cardinality(Action> configure) => Set(configure, "cardinality"); + public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); + public ApiKeyAggregationDescriptor Composite(Action> configure) => Set(configure, "composite"); + public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); + public ApiKeyAggregationDescriptor DateRange(Action> configure) => Set(configure, "date_range"); + public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); + public ApiKeyAggregationDescriptor Filter(Action> configure) => Set(configure, "filter"); + public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); + public ApiKeyAggregationDescriptor Filters(Action> configure) => Set(configure, "filters"); + public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); + public ApiKeyAggregationDescriptor Missing(Action> configure) => Set(configure, "missing"); + public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); + public ApiKeyAggregationDescriptor Range(Action> configure) => Set(configure, "range"); + public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); + public ApiKeyAggregationDescriptor Terms(Action> configure) => Set(configure, "terms"); + public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); + public ApiKeyAggregationDescriptor ValueCount(Action> configure) => Set(configure, "value_count"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyAggregationDescriptor : SerializableDescriptor +{ + internal ApiKeyAggregationDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyAggregationDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyAggregationDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyAggregationDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + private IDictionary AggregationsValue { get; set; } + private IDictionary? MetaValue { get; set; } + + /// + /// + /// Sub-aggregations for this aggregation. + /// Only applies to bucket aggregations. + /// + /// + public ApiKeyAggregationDescriptor Aggregations(Func, FluentDescriptorDictionary> selector) + { + AggregationsValue = selector?.Invoke(new FluentDescriptorDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Meta(Func, FluentDictionary> selector) + { + MetaValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public ApiKeyAggregationDescriptor Cardinality(Elastic.Clients.Elasticsearch.Aggregations.CardinalityAggregation cardinalityAggregation) => Set(cardinalityAggregation, "cardinality"); + public ApiKeyAggregationDescriptor Cardinality(Action configure) => Set(configure, "cardinality"); + public ApiKeyAggregationDescriptor Composite(Elastic.Clients.Elasticsearch.Aggregations.CompositeAggregation compositeAggregation) => Set(compositeAggregation, "composite"); + public ApiKeyAggregationDescriptor Composite(Action configure) => Set(configure, "composite"); + public ApiKeyAggregationDescriptor DateRange(Elastic.Clients.Elasticsearch.Aggregations.DateRangeAggregation dateRangeAggregation) => Set(dateRangeAggregation, "date_range"); + public ApiKeyAggregationDescriptor DateRange(Action configure) => Set(configure, "date_range"); + public ApiKeyAggregationDescriptor Filter(Elastic.Clients.Elasticsearch.Security.ApiKeyQuery apiKeyQueryContainer) => Set(apiKeyQueryContainer, "filter"); + public ApiKeyAggregationDescriptor Filter(Action configure) => Set(configure, "filter"); + public ApiKeyAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Security.ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Set(apiKeyFiltersAggregation, "filters"); + public ApiKeyAggregationDescriptor Filters(Action configure) => Set(configure, "filters"); + public ApiKeyAggregationDescriptor Missing(Elastic.Clients.Elasticsearch.Aggregations.MissingAggregation missingAggregation) => Set(missingAggregation, "missing"); + public ApiKeyAggregationDescriptor Missing(Action configure) => Set(configure, "missing"); + public ApiKeyAggregationDescriptor Range(Elastic.Clients.Elasticsearch.Aggregations.RangeAggregation rangeAggregation) => Set(rangeAggregation, "range"); + public ApiKeyAggregationDescriptor Range(Action configure) => Set(configure, "range"); + public ApiKeyAggregationDescriptor Terms(Elastic.Clients.Elasticsearch.Aggregations.TermsAggregation termsAggregation) => Set(termsAggregation, "terms"); + public ApiKeyAggregationDescriptor Terms(Action configure) => Set(configure, "terms"); + public ApiKeyAggregationDescriptor ValueCount(Elastic.Clients.Elasticsearch.Aggregations.ValueCountAggregation valueCountAggregation) => Set(valueCountAggregation, "value_count"); + public ApiKeyAggregationDescriptor ValueCount(Action configure) => Set(configure, "value_count"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AggregationsValue is not null) + { + writer.WritePropertyName("aggregations"); + JsonSerializer.Serialize(writer, AggregationsValue, options); + } + + if (MetaValue is not null) + { + writer.WritePropertyName("meta"); + JsonSerializer.Serialize(writer, MetaValue, options); + } + + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs new file mode 100644 index 00000000000..0d576e3f567 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyFiltersAggregation.g.cs @@ -0,0 +1,244 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ApiKeyFiltersAggregation +{ + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + [JsonInclude, JsonPropertyName("filters")] + public Elastic.Clients.Elasticsearch.Aggregations.Buckets? Filters { get; set; } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + [JsonInclude, JsonPropertyName("keyed")] + public bool? Keyed { get; set; } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + [JsonInclude, JsonPropertyName("other_bucket")] + public bool? OtherBucket { get; set; } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + [JsonInclude, JsonPropertyName("other_bucket_key")] + public string? OtherBucketKey { get; set; } + + public static implicit operator Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation(ApiKeyFiltersAggregation apiKeyFiltersAggregation) => Elastic.Clients.Elasticsearch.Security.ApiKeyAggregation.Filters(apiKeyFiltersAggregation); +} + +public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor> +{ + internal ApiKeyFiltersAggregationDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyFiltersAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } + private bool? KeyedValue { get; set; } + private bool? OtherBucketValue { get; set; } + private string? OtherBucketKeyValue { get; set; } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + { + FiltersValue = filters; + return Self; + } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + { + OtherBucketValue = otherBucket; + return Self; + } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + { + OtherBucketKeyValue = otherBucketKey; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FiltersValue is not null) + { + writer.WritePropertyName("filters"); + JsonSerializer.Serialize(writer, FiltersValue, options); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (OtherBucketValue.HasValue) + { + writer.WritePropertyName("other_bucket"); + writer.WriteBooleanValue(OtherBucketValue.Value); + } + + if (!string.IsNullOrEmpty(OtherBucketKeyValue)) + { + writer.WritePropertyName("other_bucket_key"); + writer.WriteStringValue(OtherBucketKeyValue); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyFiltersAggregationDescriptor : SerializableDescriptor +{ + internal ApiKeyFiltersAggregationDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyFiltersAggregationDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Aggregations.Buckets? FiltersValue { get; set; } + private bool? KeyedValue { get; set; } + private bool? OtherBucketValue { get; set; } + private string? OtherBucketKeyValue { get; set; } + + /// + /// + /// Collection of queries from which to build buckets. + /// + /// + public ApiKeyFiltersAggregationDescriptor Filters(Elastic.Clients.Elasticsearch.Aggregations.Buckets? filters) + { + FiltersValue = filters; + return Self; + } + + /// + /// + /// By default, the named filters aggregation returns the buckets as an object. + /// Set to false to return the buckets as an array of objects. + /// + /// + public ApiKeyFiltersAggregationDescriptor Keyed(bool? keyed = true) + { + KeyedValue = keyed; + return Self; + } + + /// + /// + /// Set to true to add a bucket to the response which will contain all documents that do not match any of the given filters. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucket(bool? otherBucket = true) + { + OtherBucketValue = otherBucket; + return Self; + } + + /// + /// + /// The key with which the other bucket is returned. + /// + /// + public ApiKeyFiltersAggregationDescriptor OtherBucketKey(string? otherBucketKey) + { + OtherBucketKeyValue = otherBucketKey; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FiltersValue is not null) + { + writer.WritePropertyName("filters"); + JsonSerializer.Serialize(writer, FiltersValue, options); + } + + if (KeyedValue.HasValue) + { + writer.WritePropertyName("keyed"); + writer.WriteBooleanValue(KeyedValue.Value); + } + + if (OtherBucketValue.HasValue) + { + writer.WritePropertyName("other_bucket"); + writer.WriteBooleanValue(OtherBucketValue.Value); + } + + if (!string.IsNullOrEmpty(OtherBucketKeyValue)) + { + writer.WritePropertyName("other_bucket_key"); + writer.WriteStringValue(OtherBucketKeyValue); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs new file mode 100644 index 00000000000..c84a6c7b2b8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApiKeyQuery.g.cs @@ -0,0 +1,384 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(ApiKeyQueryConverter))] +public sealed partial class ApiKeyQuery +{ + internal ApiKeyQuery(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static ApiKeyQuery Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new ApiKeyQuery("bool", boolQuery); + public static ApiKeyQuery Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new ApiKeyQuery("exists", existsQuery); + public static ApiKeyQuery Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new ApiKeyQuery("ids", idsQuery); + public static ApiKeyQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new ApiKeyQuery("match", matchQuery); + public static ApiKeyQuery MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new ApiKeyQuery("match_all", matchAllQuery); + public static ApiKeyQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new ApiKeyQuery("prefix", prefixQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new ApiKeyQuery("range", rangeQuery); + public static ApiKeyQuery SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new ApiKeyQuery("simple_query_string", simpleQueryStringQuery); + public static ApiKeyQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new ApiKeyQuery("term", termQuery); + public static ApiKeyQuery Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new ApiKeyQuery("terms", termsQuery); + public static ApiKeyQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new ApiKeyQuery("wildcard", wildcardQuery); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class ApiKeyQueryConverter : JsonConverter +{ + public override ApiKeyQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "bool") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "exists") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "ids") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match_all") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "prefix") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "simple_query_string") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "term") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "wildcard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'ApiKeyQuery' from the response."); + } + + var result = new ApiKeyQuery(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, ApiKeyQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "bool": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); + break; + case "exists": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); + break; + case "ids": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); + break; + case "match": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); + break; + case "match_all": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); + break; + case "prefix": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); + break; + case "simple_query_string": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); + break; + case "wildcard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor> +{ + internal ApiKeyQueryDescriptor(Action> configure) => configure.Invoke(this); + + public ApiKeyQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public ApiKeyQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); + public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public ApiKeyQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); + public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public ApiKeyQueryDescriptor Match(Action> configure) => Set(configure, "match"); + public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public ApiKeyQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public ApiKeyQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); + public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public ApiKeyQueryDescriptor Term(Action> configure) => Set(configure, "term"); + public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public ApiKeyQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); + public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public ApiKeyQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class ApiKeyQueryDescriptor : SerializableDescriptor +{ + internal ApiKeyQueryDescriptor(Action configure) => configure.Invoke(this); + + public ApiKeyQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private ApiKeyQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private ApiKeyQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public ApiKeyQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public ApiKeyQueryDescriptor Bool(Action configure) => Set(configure, "bool"); + public ApiKeyQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public ApiKeyQueryDescriptor Exists(Action configure) => Set(configure, "exists"); + public ApiKeyQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public ApiKeyQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public ApiKeyQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public ApiKeyQueryDescriptor Match(Action configure) => Set(configure, "match"); + public ApiKeyQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public ApiKeyQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public ApiKeyQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public ApiKeyQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public ApiKeyQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public ApiKeyQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); + public ApiKeyQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public ApiKeyQueryDescriptor Term(Action configure) => Set(configure, "term"); + public ApiKeyQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public ApiKeyQueryDescriptor Terms(Action configure) => Set(configure, "terms"); + public ApiKeyQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public ApiKeyQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs new file mode 100644 index 00000000000..6c29ebc03a8 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs @@ -0,0 +1,93 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ApplicationGlobalUserPrivileges +{ + [JsonInclude, JsonPropertyName("manage")] + public Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Manage { get; set; } +} + +public sealed partial class ApplicationGlobalUserPrivilegesDescriptor : SerializableDescriptor +{ + internal ApplicationGlobalUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public ApplicationGlobalUserPrivilegesDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges ManageValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor ManageDescriptor { get; set; } + private Action ManageDescriptorAction { get; set; } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges manage) + { + ManageDescriptor = null; + ManageDescriptorAction = null; + ManageValue = manage; + return Self; + } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor descriptor) + { + ManageValue = null; + ManageDescriptorAction = null; + ManageDescriptor = descriptor; + return Self; + } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(Action configure) + { + ManageValue = null; + ManageDescriptor = null; + ManageDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ManageDescriptor is not null) + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, ManageDescriptor, options); + } + else if (ManageDescriptorAction is not null) + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ManageUserPrivilegesDescriptor(ManageDescriptorAction), options); + } + else + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, ManageValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs new file mode 100644 index 00000000000..8794e5e2679 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs @@ -0,0 +1,113 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ApplicationPrivileges +{ + /// + /// + /// The name of the application to which this entry applies. + /// + /// + [JsonInclude, JsonPropertyName("application")] + public string Application { get; set; } + + /// + /// + /// A list of strings, where each element is the name of an application privilege or action. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A list resources to which the privileges are applied. + /// + /// + [JsonInclude, JsonPropertyName("resources")] + public ICollection Resources { get; set; } +} + +public sealed partial class ApplicationPrivilegesDescriptor : SerializableDescriptor +{ + internal ApplicationPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public ApplicationPrivilegesDescriptor() : base() + { + } + + private string ApplicationValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private ICollection ResourcesValue { get; set; } + + /// + /// + /// The name of the application to which this entry applies. + /// + /// + public ApplicationPrivilegesDescriptor Application(string application) + { + ApplicationValue = application; + return Self; + } + + /// + /// + /// A list of strings, where each element is the name of an application privilege or action. + /// + /// + public ApplicationPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A list resources to which the privileges are applied. + /// + /// + public ApplicationPrivilegesDescriptor Resources(ICollection resources) + { + ResourcesValue = resources; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WritePropertyName("resources"); + JsonSerializer.Serialize(writer, ResourcesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs new file mode 100644 index 00000000000..1c8c7875f33 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivilegesCheck.g.cs @@ -0,0 +1,113 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ApplicationPrivilegesCheck +{ + /// + /// + /// The name of the application. + /// + /// + [JsonInclude, JsonPropertyName("application")] + public string Application { get; set; } + + /// + /// + /// A list of the privileges that you want to check for the specified resources. May be either application privilege names, or the names of actions that are granted by those privileges + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A list of resource names against which the privileges should be checked + /// + /// + [JsonInclude, JsonPropertyName("resources")] + public ICollection Resources { get; set; } +} + +public sealed partial class ApplicationPrivilegesCheckDescriptor : SerializableDescriptor +{ + internal ApplicationPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public ApplicationPrivilegesCheckDescriptor() : base() + { + } + + private string ApplicationValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private ICollection ResourcesValue { get; set; } + + /// + /// + /// The name of the application. + /// + /// + public ApplicationPrivilegesCheckDescriptor Application(string application) + { + ApplicationValue = application; + return Self; + } + + /// + /// + /// A list of the privileges that you want to check for the specified resources. May be either application privilege names, or the names of actions that are granted by those privileges + /// + /// + public ApplicationPrivilegesCheckDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A list of resource names against which the privileges should be checked + /// + /// + public ApplicationPrivilegesCheckDescriptor Resources(ICollection resources) + { + ResourcesValue = resources; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WritePropertyName("resources"); + JsonSerializer.Serialize(writer, ResourcesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs new file mode 100644 index 00000000000..650d249cefb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticateToken.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class AuthenticateToken +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string? Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs new file mode 100644 index 00000000000..ce94b486730 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticatedUser.g.cs @@ -0,0 +1,54 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class AuthenticatedUser +{ + [JsonInclude, JsonPropertyName("authentication_provider")] + public Elastic.Clients.Elasticsearch.Security.AuthenticationProvider? AuthenticationProvider { get; init; } + [JsonInclude, JsonPropertyName("authentication_realm")] + public Elastic.Clients.Elasticsearch.Security.UserRealm AuthenticationRealm { get; init; } + [JsonInclude, JsonPropertyName("authentication_type")] + public string AuthenticationType { get; init; } + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("lookup_realm")] + public Elastic.Clients.Elasticsearch.Security.UserRealm LookupRealm { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs new file mode 100644 index 00000000000..abe97c0156d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/AuthenticationProvider.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class AuthenticationProvider +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs new file mode 100644 index 00000000000..a31b4e2523f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ClusterNode.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ClusterNode +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs new file mode 100644 index 00000000000..28b905eca81 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/CreatedStatus.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class CreatedStatus +{ + [JsonInclude, JsonPropertyName("created")] + public bool Created { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs new file mode 100644 index 00000000000..60f44e7e5eb --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldRule.g.cs @@ -0,0 +1,251 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(FieldRuleConverter))] +public sealed partial class FieldRule +{ + internal FieldRule(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static FieldRule Dn(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("dn", names); + public static FieldRule Groups(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("groups", names); + public static FieldRule Username(Elastic.Clients.Elasticsearch.Names names) => new FieldRule("username", names); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class FieldRuleConverter : JsonConverter +{ + public override FieldRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "dn") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "groups") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "username") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'FieldRule' from the response."); + } + + var result = new FieldRule(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, FieldRule value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "dn": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); + break; + case "groups": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); + break; + case "username": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Names)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldRuleDescriptor : SerializableDescriptor> +{ + internal FieldRuleDescriptor(Action> configure) => configure.Invoke(this); + + public FieldRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private FieldRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Names names) => Set(names, "dn"); + public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Names names) => Set(names, "groups"); + public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Names names) => Set(names, "username"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldRuleDescriptor : SerializableDescriptor +{ + internal FieldRuleDescriptor(Action configure) => configure.Invoke(this); + + public FieldRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private FieldRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private FieldRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public FieldRuleDescriptor Dn(Elastic.Clients.Elasticsearch.Names names) => Set(names, "dn"); + public FieldRuleDescriptor Groups(Elastic.Clients.Elasticsearch.Names names) => Set(names, "groups"); + public FieldRuleDescriptor Username(Elastic.Clients.Elasticsearch.Names names) => Set(names, "username"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs new file mode 100644 index 00000000000..0876eb525c9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs @@ -0,0 +1,122 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class FieldSecurity +{ + [JsonInclude, JsonPropertyName("except")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Fields? Except { get; set; } + [JsonInclude, JsonPropertyName("grant")] + [JsonConverter(typeof(SingleOrManyFieldsConverter))] + public Elastic.Clients.Elasticsearch.Fields? Grant { get; set; } +} + +public sealed partial class FieldSecurityDescriptor : SerializableDescriptor> +{ + internal FieldSecurityDescriptor(Action> configure) => configure.Invoke(this); + + public FieldSecurityDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Fields? ExceptValue { get; set; } + private Elastic.Clients.Elasticsearch.Fields? GrantValue { get; set; } + + public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? grant) + { + GrantValue = grant; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExceptValue is not null) + { + writer.WritePropertyName("except"); + JsonSerializer.Serialize(writer, ExceptValue, options); + } + + if (GrantValue is not null) + { + writer.WritePropertyName("grant"); + JsonSerializer.Serialize(writer, GrantValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class FieldSecurityDescriptor : SerializableDescriptor +{ + internal FieldSecurityDescriptor(Action configure) => configure.Invoke(this); + + public FieldSecurityDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Fields? ExceptValue { get; set; } + private Elastic.Clients.Elasticsearch.Fields? GrantValue { get; set; } + + public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields? grant) + { + GrantValue = grant; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExceptValue is not null) + { + writer.WritePropertyName("except"); + JsonSerializer.Serialize(writer, ExceptValue, options); + } + + if (GrantValue is not null) + { + writer.WritePropertyName("grant"); + JsonSerializer.Serialize(writer, GrantValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs new file mode 100644 index 00000000000..d28bc0633ab --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FoundStatus.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class FoundStatus +{ + [JsonInclude, JsonPropertyName("found")] + public bool Found { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs new file mode 100644 index 00000000000..aff8aa94906 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GetUserProfileErrors.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GetUserProfileErrors +{ + [JsonInclude, JsonPropertyName("count")] + public long Count { get; init; } + [JsonInclude, JsonPropertyName("details")] + public IReadOnlyDictionary Details { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs new file mode 100644 index 00000000000..1b6be97614e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs @@ -0,0 +1,93 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GlobalPrivilege +{ + [JsonInclude, JsonPropertyName("application")] + public Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Application { get; set; } +} + +public sealed partial class GlobalPrivilegeDescriptor : SerializableDescriptor +{ + internal GlobalPrivilegeDescriptor(Action configure) => configure.Invoke(this); + + public GlobalPrivilegeDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges ApplicationValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor ApplicationDescriptor { get; set; } + private Action ApplicationDescriptorAction { get; set; } + + public GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationValue = application; + return Self; + } + + public GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public GlobalPrivilegeDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivilegesDescriptor(ApplicationDescriptorAction), options); + } + else + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs new file mode 100644 index 00000000000..1014fb194b1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GrantApiKey.g.cs @@ -0,0 +1,231 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class GrantApiKey +{ + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + [JsonInclude, JsonPropertyName("expiration")] + public string? Expiration { get; set; } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Name Name { get; set; } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + [JsonInclude, JsonPropertyName("role_descriptors")] + [SingleOrManyCollectionConverter(typeof(IReadOnlyDictionary))] + public ICollection>? RoleDescriptors { get; set; } +} + +public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor> +{ + internal GrantApiKeyDescriptor(Action> configure) => configure.Invoke(this); + + public GrantApiKeyDescriptor() : base() + { + } + + private string? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + private ICollection>? RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public GrantApiKeyDescriptor Expiration(string? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + NameValue = name; + return Self; + } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + { + RoleDescriptorsValue = roleDescriptors; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ExpirationValue)) + { + writer.WritePropertyName("expiration"); + writer.WriteStringValue(ExpirationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class GrantApiKeyDescriptor : SerializableDescriptor +{ + internal GrantApiKeyDescriptor(Action configure) => configure.Invoke(this); + + public GrantApiKeyDescriptor() : base() + { + } + + private string? ExpirationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Name NameValue { get; set; } + private ICollection>? RoleDescriptorsValue { get; set; } + + /// + /// + /// Expiration time for the API key. By default, API keys never expire. + /// + /// + public GrantApiKeyDescriptor Expiration(string? expiration) + { + ExpirationValue = expiration; + return Self; + } + + /// + /// + /// Arbitrary metadata that you want to associate with the API key. + /// It supports nested data structure. + /// Within the metadata object, keys beginning with _ are reserved for system usage. + /// + /// + public GrantApiKeyDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public GrantApiKeyDescriptor Name(Elastic.Clients.Elasticsearch.Name name) + { + NameValue = name; + return Self; + } + + /// + /// + /// The role descriptors for this API key. + /// This parameter is optional. + /// When it is not specified or is an empty array, the API key has a point in time snapshot of permissions of the specified user or access token. + /// If you supply role descriptors, the resultant permissions are an intersection of API keys permissions and the permissions of the user or access token. + /// + /// + public GrantApiKeyDescriptor RoleDescriptors(ICollection>? roleDescriptors) + { + RoleDescriptorsValue = roleDescriptors; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ExpirationValue)) + { + writer.WritePropertyName("expiration"); + writer.WriteStringValue(ExpirationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + SingleOrManySerializationHelper.Serialize>(RoleDescriptorsValue, writer, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs new file mode 100644 index 00000000000..4c5b2db4bc6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/HasPrivilegesUserProfileErrors.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class HasPrivilegesUserProfileErrors +{ + [JsonInclude, JsonPropertyName("count")] + public long Count { get; init; } + [JsonInclude, JsonPropertyName("details")] + public IReadOnlyDictionary Details { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs new file mode 100644 index 00000000000..c194b947807 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Hint.g.cs @@ -0,0 +1,103 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class Hint +{ + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + [JsonInclude, JsonPropertyName("labels")] + public IDictionary>>? Labels { get; set; } + + /// + /// + /// A list of Profile UIDs to match against. + /// + /// + [JsonInclude, JsonPropertyName("uids")] + public ICollection? Uids { get; set; } +} + +public sealed partial class HintDescriptor : SerializableDescriptor +{ + internal HintDescriptor(Action configure) => configure.Invoke(this); + + public HintDescriptor() : base() + { + } + + private IDictionary>>? LabelsValue { get; set; } + private ICollection? UidsValue { get; set; } + + /// + /// + /// A single key-value pair to match against the labels section + /// of a profile. A profile is considered matching if it matches + /// at least one of the strings. + /// + /// + public HintDescriptor Labels(Func>>, FluentDictionary>>> selector) + { + LabelsValue = selector?.Invoke(new FluentDictionary>>()); + return Self; + } + + /// + /// + /// A list of Profile UIDs to match against. + /// + /// + public HintDescriptor Uids(ICollection? uids) + { + UidsValue = uids; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (LabelsValue is not null) + { + writer.WritePropertyName("labels"); + JsonSerializer.Serialize(writer, LabelsValue, options); + } + + if (UidsValue is not null) + { + writer.WritePropertyName("uids"); + JsonSerializer.Serialize(writer, UidsValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs new file mode 100644 index 00000000000..1738636adc9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndexPrivilegesCheck.g.cs @@ -0,0 +1,121 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class IndexPrivilegesCheck +{ + /// + /// + /// This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. + /// Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. + /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. + /// + /// + [JsonInclude, JsonPropertyName("allow_restricted_indices")] + public bool? AllowRestrictedIndices { get; set; } + + /// + /// + /// A list of indices. + /// + /// + [JsonInclude, JsonPropertyName("names")] + public Elastic.Clients.Elasticsearch.Indices Names { get; set; } + + /// + /// + /// A list of the privileges that you want to check for the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } +} + +public sealed partial class IndexPrivilegesCheckDescriptor : SerializableDescriptor +{ + internal IndexPrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public IndexPrivilegesCheckDescriptor() : base() + { + } + + private bool? AllowRestrictedIndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + + /// + /// + /// This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. + /// Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. + /// If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices. + /// + /// + public IndexPrivilegesCheckDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + { + AllowRestrictedIndicesValue = allowRestrictedIndices; + return Self; + } + + /// + /// + /// A list of indices. + /// + /// + public IndexPrivilegesCheckDescriptor Names(Elastic.Clients.Elasticsearch.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// A list of the privileges that you want to check for the specified indices. + /// + /// + public IndexPrivilegesCheckDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AllowRestrictedIndicesValue.HasValue) + { + writer.WritePropertyName("allow_restricted_indices"); + writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs new file mode 100644 index 00000000000..1d94b492440 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs @@ -0,0 +1,327 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class IndicesPrivileges +{ + /// + /// + /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. + /// + /// + [JsonInclude, JsonPropertyName("allow_restricted_indices")] + public bool? AllowRestrictedIndices { get; set; } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + [JsonInclude, JsonPropertyName("field_security")] + public Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurity { get; set; } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + [JsonInclude, JsonPropertyName("names")] + public Elastic.Clients.Elasticsearch.Indices Names { get; set; } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public ICollection Privileges { get; set; } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public object? Query { get; set; } +} + +public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor> +{ + internal IndicesPrivilegesDescriptor(Action> configure) => configure.Invoke(this); + + public IndicesPrivilegesDescriptor() : base() + { + } + + private bool? AllowRestrictedIndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } + private Action> FieldSecurityDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private object? QueryValue { get; set; } + + /// + /// + /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. + /// + /// + public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + { + AllowRestrictedIndicesValue = allowRestrictedIndices; + return Self; + } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + { + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityValue = fieldSecurity; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + { + FieldSecurityValue = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptor = descriptor; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Action> configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public IndicesPrivilegesDescriptor Names(Elastic.Clients.Elasticsearch.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public IndicesPrivilegesDescriptor Query(object? query) + { + QueryValue = query; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AllowRestrictedIndicesValue.HasValue) + { + writer.WritePropertyName("allow_restricted_indices"); + writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); + } + + if (FieldSecurityDescriptor is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); + } + else if (FieldSecurityDescriptorAction is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); + } + else if (FieldSecurityValue is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityValue, options); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptor +{ + internal IndicesPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public IndicesPrivilegesDescriptor() : base() + { + } + + private bool? AllowRestrictedIndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.FieldSecurity? FieldSecurityValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } + private Action FieldSecurityDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.Indices NamesValue { get; set; } + private ICollection PrivilegesValue { get; set; } + private object? QueryValue { get; set; } + + /// + /// + /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. + /// + /// + public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + { + AllowRestrictedIndicesValue = allowRestrictedIndices; + return Self; + } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurity? fieldSecurity) + { + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityValue = fieldSecurity; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor descriptor) + { + FieldSecurityValue = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptor = descriptor; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Action configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = configure; + return Self; + } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + public IndicesPrivilegesDescriptor Names(Elastic.Clients.Elasticsearch.Indices names) + { + NamesValue = names; + return Self; + } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + public IndicesPrivilegesDescriptor Privileges(ICollection privileges) + { + PrivilegesValue = privileges; + return Self; + } + + /// + /// + /// A search query that defines the documents the owners of the role have access to. A document within the specified indices must match this query for it to be accessible by the owners of the role. + /// + /// + public IndicesPrivilegesDescriptor Query(object? query) + { + QueryValue = query; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AllowRestrictedIndicesValue.HasValue) + { + writer.WritePropertyName("allow_restricted_indices"); + writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); + } + + if (FieldSecurityDescriptor is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); + } + else if (FieldSecurityDescriptorAction is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); + } + else if (FieldSecurityValue is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityValue, options); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs new file mode 100644 index 00000000000..251936ca047 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/KibanaToken.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class KibanaToken +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("value")] + public string Value { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs new file mode 100644 index 00000000000..d0afcceeb18 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs @@ -0,0 +1,59 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ManageUserPrivileges +{ + [JsonInclude, JsonPropertyName("applications")] + public ICollection Applications { get; set; } +} + +public sealed partial class ManageUserPrivilegesDescriptor : SerializableDescriptor +{ + internal ManageUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); + + public ManageUserPrivilegesDescriptor() : base() + { + } + + private ICollection ApplicationsValue { get; set; } + + public ManageUserPrivilegesDescriptor Applications(ICollection applications) + { + ApplicationsValue = applications; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs new file mode 100644 index 00000000000..dd98a78661c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentials.g.cs @@ -0,0 +1,47 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class NodesCredentials +{ + /// + /// + /// File-backed tokens collected from all nodes + /// + /// + [JsonInclude, JsonPropertyName("file_tokens")] + public IReadOnlyDictionary FileTokens { get; init; } + + /// + /// + /// General status showing how nodes respond to the above collection request + /// + /// + [JsonInclude, JsonPropertyName("_nodes")] + public Elastic.Clients.Elasticsearch.NodeStatistics Nodes { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs new file mode 100644 index 00000000000..ad835da4388 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/NodesCredentialsFileToken.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class NodesCredentialsFileToken +{ + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyCollection Nodes { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs new file mode 100644 index 00000000000..d7c1368bee0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegeActions.g.cs @@ -0,0 +1,104 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PrivilegeActions +{ + [JsonInclude, JsonPropertyName("actions")] + public ICollection Actions { get; set; } + [JsonInclude, JsonPropertyName("application")] + public string? Application { get; set; } + [JsonInclude, JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } + [JsonInclude, JsonPropertyName("name")] + public Elastic.Clients.Elasticsearch.Name? Name { get; set; } +} + +public sealed partial class PrivilegeActionsDescriptor : SerializableDescriptor +{ + internal PrivilegeActionsDescriptor(Action configure) => configure.Invoke(this); + + public PrivilegeActionsDescriptor() : base() + { + } + + private ICollection ActionsValue { get; set; } + private string? ApplicationValue { get; set; } + private IDictionary? MetadataValue { get; set; } + private Elastic.Clients.Elasticsearch.Name? NameValue { get; set; } + + public PrivilegeActionsDescriptor Actions(ICollection actions) + { + ActionsValue = actions; + return Self; + } + + public PrivilegeActionsDescriptor Application(string? application) + { + ApplicationValue = application; + return Self; + } + + public PrivilegeActionsDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public PrivilegeActionsDescriptor Name(Elastic.Clients.Elasticsearch.Name? name) + { + NameValue = name; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("actions"); + JsonSerializer.Serialize(writer, ActionsValue, options); + if (!string.IsNullOrEmpty(ApplicationValue)) + { + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (NameValue is not null) + { + writer.WritePropertyName("name"); + JsonSerializer.Serialize(writer, NameValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs new file mode 100644 index 00000000000..d4fb8f4856a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/PrivilegesCheck.g.cs @@ -0,0 +1,220 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class PrivilegesCheck +{ + [JsonInclude, JsonPropertyName("application")] + public ICollection? Application { get; set; } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + [JsonInclude, JsonPropertyName("cluster")] + public ICollection? Cluster { get; set; } + [JsonInclude, JsonPropertyName("index")] + public ICollection? Index { get; set; } +} + +public sealed partial class PrivilegesCheckDescriptor : SerializableDescriptor +{ + internal PrivilegesCheckDescriptor(Action configure) => configure.Invoke(this); + + public PrivilegesCheckDescriptor() : base() + { + } + + private ICollection? ApplicationValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor ApplicationDescriptor { get; set; } + private Action ApplicationDescriptorAction { get; set; } + private Action[] ApplicationDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private ICollection? IndexValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor IndexDescriptor { get; set; } + private Action IndexDescriptorAction { get; set; } + private Action[] IndexDescriptorActions { get; set; } + + public PrivilegesCheckDescriptor Application(ICollection? application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationValue = application; + return Self; + } + + public PrivilegesCheckDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public PrivilegesCheckDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorActions = null; + ApplicationDescriptorAction = configure; + return Self; + } + + public PrivilegesCheckDescriptor Application(params Action[] configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of the cluster privileges that you want to check. + /// + /// + public PrivilegesCheckDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + public PrivilegesCheckDescriptor Index(ICollection? index) + { + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexValue = index; + return Self; + } + + public PrivilegesCheckDescriptor Index(Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor descriptor) + { + IndexValue = null; + IndexDescriptorAction = null; + IndexDescriptorActions = null; + IndexDescriptor = descriptor; + return Self; + } + + public PrivilegesCheckDescriptor Index(Action configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorActions = null; + IndexDescriptorAction = configure; + return Self; + } + + public PrivilegesCheckDescriptor Index(params Action[] configure) + { + IndexValue = null; + IndexDescriptor = null; + IndexDescriptorAction = null; + IndexDescriptorActions = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(ApplicationDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationDescriptorActions is not null) + { + writer.WritePropertyName("application"); + writer.WriteStartArray(); + foreach (var action in ApplicationDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationValue is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (IndexDescriptor is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndexDescriptor, options); + writer.WriteEndArray(); + } + else if (IndexDescriptorAction is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(IndexDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndexDescriptorActions is not null) + { + writer.WritePropertyName("index"); + writer.WriteStartArray(); + foreach (var action in IndexDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndexPrivilegesCheckDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndexValue is not null) + { + writer.WritePropertyName("index"); + JsonSerializer.Serialize(writer, IndexValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs new file mode 100644 index 00000000000..c3842d55b4a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/QueryUser.g.cs @@ -0,0 +1,48 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class QueryUser +{ + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("_sort")] + public IReadOnlyCollection? Sort { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs new file mode 100644 index 00000000000..e370a03ab76 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RealmInfo.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class RealmInfo +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs new file mode 100644 index 00000000000..052fb4203d0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/Role.g.cs @@ -0,0 +1,48 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class Role +{ + [JsonInclude, JsonPropertyName("applications")] + public IReadOnlyCollection Applications { get; init; } + [JsonInclude, JsonPropertyName("cluster")] + public IReadOnlyCollection Cluster { get; init; } + [JsonInclude, JsonPropertyName("global")] + public IReadOnlyDictionary>>>? Global { get; init; } + [JsonInclude, JsonPropertyName("indices")] + public IReadOnlyCollection Indices { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("role_templates")] + public IReadOnlyCollection? RoleTemplates { get; init; } + [JsonInclude, JsonPropertyName("run_as")] + public IReadOnlyCollection RunAs { get; init; } + [JsonInclude, JsonPropertyName("transient_metadata")] + public IReadOnlyDictionary? TransientMetadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs new file mode 100644 index 00000000000..1091a7fbe9b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs @@ -0,0 +1,856 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +internal sealed partial class RoleDescriptorConverter : JsonConverter +{ + public override RoleDescriptor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new RoleDescriptor(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + variant.Applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + variant.Cluster = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "description") + { + variant.Description = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "global") + { + variant.Global = SingleOrManySerializationHelper.Deserialize(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + variant.Indices = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "metadata") + { + variant.Metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "run_as") + { + variant.RunAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + variant.TransientMetadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, RoleDescriptor value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Applications is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, value.Applications, options); + } + + if (value.Cluster is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, value.Cluster, options); + } + + if (!string.IsNullOrEmpty(value.Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(value.Description); + } + + if (value.Global is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, value.Global, options); + } + + if (value.Indices is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, value.Indices, options); + } + + if (value.Metadata is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, value.Metadata, options); + } + + if (value.RunAs is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, value.RunAs, options); + } + + if (value.TransientMetadata is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, value.TransientMetadata, options); + } + + writer.WriteEndObject(); + } +} + +[JsonConverter(typeof(RoleDescriptorConverter))] +public sealed partial class RoleDescriptor +{ + /// + /// + /// A list of application privilege entries + /// + /// + public ICollection? Applications { get; set; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public ICollection? Cluster { get; set; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public string? Description { get; set; } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public ICollection? Global { get; set; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public ICollection? Indices { get; set; } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public IDictionary? Metadata { get; set; } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public ICollection? RunAs { get; set; } + public IDictionary? TransientMetadata { get; set; } +} + +public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor> +{ + internal RoleDescriptorDescriptor(Action> configure) => configure.Invoke(this); + + public RoleDescriptorDescriptor() : base() + { + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? GlobalValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor GlobalDescriptor { get; set; } + private Action GlobalDescriptorAction { get; set; } + private Action[] GlobalDescriptorActions { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action> IndicesDescriptorAction { get; set; } + private Action>[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries + /// + /// + public RoleDescriptorDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public RoleDescriptorDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public RoleDescriptorDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public RoleDescriptorDescriptor Global(ICollection? global) + { + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalValue = global; + return Self; + } + + public RoleDescriptorDescriptor Global(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor descriptor) + { + GlobalValue = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Global(Action configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorActions = null; + GlobalDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Global(params Action[] configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public RoleDescriptorDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Indices(Action> configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(params Action>[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public RoleDescriptorDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (GlobalDescriptor is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, GlobalDescriptor, options); + } + else if (GlobalDescriptorAction is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(GlobalDescriptorAction), options); + } + else if (GlobalDescriptorActions is not null) + { + writer.WritePropertyName("global"); + if (GlobalDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in GlobalDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(action), options); + } + + if (GlobalDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (GlobalValue is not null) + { + writer.WritePropertyName("global"); + SingleOrManySerializationHelper.Serialize(GlobalValue, writer, options); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleDescriptorDescriptor : SerializableDescriptor +{ + internal RoleDescriptorDescriptor(Action configure) => configure.Invoke(this); + + public RoleDescriptorDescriptor() : base() + { + } + + private ICollection? ApplicationsValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + private Action ApplicationsDescriptorAction { get; set; } + private Action[] ApplicationsDescriptorActions { get; set; } + private ICollection? ClusterValue { get; set; } + private string? DescriptionValue { get; set; } + private ICollection? GlobalValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor GlobalDescriptor { get; set; } + private Action GlobalDescriptorAction { get; set; } + private Action[] GlobalDescriptorActions { get; set; } + private ICollection? IndicesValue { get; set; } + private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + private Action IndicesDescriptorAction { get; set; } + private Action[] IndicesDescriptorActions { get; set; } + private IDictionary? MetadataValue { get; set; } + private ICollection? RunAsValue { get; set; } + private IDictionary? TransientMetadataValue { get; set; } + + /// + /// + /// A list of application privilege entries + /// + /// + public RoleDescriptorDescriptor Applications(ICollection? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public RoleDescriptorDescriptor Applications(Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public RoleDescriptorDescriptor Cluster(ICollection? cluster) + { + ClusterValue = cluster; + return Self; + } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public RoleDescriptorDescriptor Description(string? description) + { + DescriptionValue = description; + return Self; + } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public RoleDescriptorDescriptor Global(ICollection? global) + { + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalValue = global; + return Self; + } + + public RoleDescriptorDescriptor Global(Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor descriptor) + { + GlobalValue = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Global(Action configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorActions = null; + GlobalDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Global(params Action[] configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = configure; + return Self; + } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public RoleDescriptorDescriptor Indices(ICollection? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public RoleDescriptorDescriptor Indices(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Indices(Action configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(params Action[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + /// + /// + /// A list of users that the API keys can impersonate. Note: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty run_as field, but a non-empty list will be rejected. + /// + /// + public RoleDescriptorDescriptor RunAs(ICollection? runAs) + { + RunAsValue = runAs; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Func, FluentDictionary> selector) + { + TransientMetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (!string.IsNullOrEmpty(DescriptionValue)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(DescriptionValue); + } + + if (GlobalDescriptor is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, GlobalDescriptor, options); + } + else if (GlobalDescriptorAction is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(GlobalDescriptorAction), options); + } + else if (GlobalDescriptorActions is not null) + { + writer.WritePropertyName("global"); + if (GlobalDescriptorActions.Length != 1) + writer.WriteStartArray(); + foreach (var action in GlobalDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.GlobalPrivilegeDescriptor(action), options); + } + + if (GlobalDescriptorActions.Length != 1) + writer.WriteEndArray(); + } + else if (GlobalValue is not null) + { + writer.WritePropertyName("global"); + SingleOrManySerializationHelper.Serialize(GlobalValue, writer, options); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs new file mode 100644 index 00000000000..6df0ea3d1de --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorRead.g.cs @@ -0,0 +1,160 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +internal sealed partial class RoleDescriptorReadConverter : JsonConverter +{ + public override RoleDescriptorRead Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + IReadOnlyCollection? applications = default; + IReadOnlyCollection cluster = default; + string? description = default; + IReadOnlyCollection? global = default; + IReadOnlyCollection indices = default; + IReadOnlyDictionary? metadata = default; + IReadOnlyCollection? runAs = default; + IReadOnlyDictionary? transientMetadata = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + cluster = JsonSerializer.Deserialize>(ref reader, options); + continue; + } + + if (property == "description") + { + description = JsonSerializer.Deserialize(ref reader, options); + continue; + } + + if (property == "global") + { + global = SingleOrManySerializationHelper.Deserialize(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + indices = JsonSerializer.Deserialize>(ref reader, options); + continue; + } + + if (property == "metadata") + { + metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "run_as") + { + runAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + transientMetadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + } + } + + return new RoleDescriptorRead { Applications = applications, Cluster = cluster, Description = description, Global = global, Indices = indices, Metadata = metadata, RunAs = runAs, TransientMetadata = transientMetadata }; + } + + public override void Write(Utf8JsonWriter writer, RoleDescriptorRead value, JsonSerializerOptions options) + { + throw new NotImplementedException("'RoleDescriptorRead' is a readonly type, used only on responses and does not support being written to JSON."); + } +} + +[JsonConverter(typeof(RoleDescriptorReadConverter))] +public sealed partial class RoleDescriptorRead +{ + /// + /// + /// A list of application privilege entries + /// + /// + public IReadOnlyCollection? Applications { get; init; } + + /// + /// + /// A list of cluster privileges. These privileges define the cluster level actions that API keys are able to execute. + /// + /// + public IReadOnlyCollection Cluster { get; init; } + + /// + /// + /// Optional description of the role descriptor + /// + /// + public string? Description { get; init; } + + /// + /// + /// An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. + /// + /// + public IReadOnlyCollection? Global { get; init; } + + /// + /// + /// A list of indices permissions entries. + /// + /// + public IReadOnlyCollection Indices { get; init; } + + /// + /// + /// Optional meta-data. Within the metadata object, keys that begin with _ are reserved for system usage. + /// + /// + public IReadOnlyDictionary? Metadata { get; init; } + + /// + /// + /// A list of users that the API keys can impersonate. + /// + /// + public IReadOnlyCollection? RunAs { get; init; } + public IReadOnlyDictionary? TransientMetadata { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs new file mode 100644 index 00000000000..6357dea001a --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptorWrapper.g.cs @@ -0,0 +1,34 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class RoleDescriptorWrapper +{ + [JsonInclude, JsonPropertyName("role_descriptor")] + public Elastic.Clients.Elasticsearch.Security.RoleDescriptorRead RoleDescriptor { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs new file mode 100644 index 00000000000..6ed27c86cc1 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMapping.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class RoleMapping +{ + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection? Roles { get; init; } + [JsonInclude, JsonPropertyName("role_templates")] + public IReadOnlyCollection? RoleTemplates { get; init; } + [JsonInclude, JsonPropertyName("rules")] + public Elastic.Clients.Elasticsearch.Security.RoleMappingRule Rules { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs new file mode 100644 index 00000000000..6a2b8369ad0 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleMappingRule.g.cs @@ -0,0 +1,272 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(RoleMappingRuleConverter))] +public sealed partial class RoleMappingRule +{ + internal RoleMappingRule(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static RoleMappingRule All(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("all", roleMappingRule); + public static RoleMappingRule Any(IReadOnlyCollection roleMappingRule) => new RoleMappingRule("any", roleMappingRule); + public static RoleMappingRule Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => new RoleMappingRule("except", roleMappingRule); + public static RoleMappingRule Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => new RoleMappingRule("field", fieldRule); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class RoleMappingRuleConverter : JsonConverter +{ + public override RoleMappingRule Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "all") + { + variantValue = JsonSerializer.Deserialize?>(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "any") + { + variantValue = JsonSerializer.Deserialize?>(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "except") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "field") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'RoleMappingRule' from the response."); + } + + var result = new RoleMappingRule(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, RoleMappingRule value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "all": + JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); + break; + case "any": + JsonSerializer.Serialize>(writer, (IReadOnlyCollection)value.Variant, options); + break; + case "except": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.RoleMappingRule)value.Variant, options); + break; + case "field": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.Security.FieldRule)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor> +{ + internal RoleMappingRuleDescriptor(Action> configure) => configure.Invoke(this); + + public RoleMappingRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleMappingRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); + public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); + public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); + public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); + public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); + public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); + public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => Set(fieldRule, "field"); + public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class RoleMappingRuleDescriptor : SerializableDescriptor +{ + internal RoleMappingRuleDescriptor(Action configure) => configure.Invoke(this); + + public RoleMappingRuleDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private RoleMappingRuleDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private RoleMappingRuleDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public RoleMappingRuleDescriptor All(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "all"); + public RoleMappingRuleDescriptor All(Action configure) => Set(configure, "all"); + public RoleMappingRuleDescriptor Any(IReadOnlyCollection roleMappingRule) => Set(roleMappingRule, "any"); + public RoleMappingRuleDescriptor Any(Action configure) => Set(configure, "any"); + public RoleMappingRuleDescriptor Except(Elastic.Clients.Elasticsearch.Security.RoleMappingRule roleMappingRule) => Set(roleMappingRule, "except"); + public RoleMappingRuleDescriptor Except(Action configure) => Set(configure, "except"); + public RoleMappingRuleDescriptor Field(Elastic.Clients.Elasticsearch.Security.FieldRule fieldRule) => Set(fieldRule, "field"); + public RoleMappingRuleDescriptor Field(Action configure) => Set(configure, "field"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs new file mode 100644 index 00000000000..2e199816d95 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplate.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class RoleTemplate +{ + [JsonInclude, JsonPropertyName("format")] + public Elastic.Clients.Elasticsearch.Security.TemplateFormat? Format { get; set; } + [JsonInclude, JsonPropertyName("template")] + public Elastic.Clients.Elasticsearch.Script Template { get; set; } +} + +public sealed partial class RoleTemplateDescriptor : SerializableDescriptor +{ + internal RoleTemplateDescriptor(Action configure) => configure.Invoke(this); + + public RoleTemplateDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.TemplateFormat? FormatValue { get; set; } + private Elastic.Clients.Elasticsearch.Script TemplateValue { get; set; } + private Elastic.Clients.Elasticsearch.ScriptDescriptor TemplateDescriptor { get; set; } + private Action TemplateDescriptorAction { get; set; } + + public RoleTemplateDescriptor Format(Elastic.Clients.Elasticsearch.Security.TemplateFormat? format) + { + FormatValue = format; + return Self; + } + + public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.Script template) + { + TemplateDescriptor = null; + TemplateDescriptorAction = null; + TemplateValue = template; + return Self; + } + + public RoleTemplateDescriptor Template(Elastic.Clients.Elasticsearch.ScriptDescriptor descriptor) + { + TemplateValue = null; + TemplateDescriptorAction = null; + TemplateDescriptor = descriptor; + return Self; + } + + public RoleTemplateDescriptor Template(Action configure) + { + TemplateValue = null; + TemplateDescriptor = null; + TemplateDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FormatValue is not null) + { + writer.WritePropertyName("format"); + JsonSerializer.Serialize(writer, FormatValue, options); + } + + if (TemplateDescriptor is not null) + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, TemplateDescriptor, options); + } + else if (TemplateDescriptorAction is not null) + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, new Elastic.Clients.Elasticsearch.ScriptDescriptor(TemplateDescriptorAction), options); + } + else + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, TemplateValue, options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs new file mode 100644 index 00000000000..0fa2564b996 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ServiceToken.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class ServiceToken +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("value")] + public string Value { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs new file mode 100644 index 00000000000..1f3df93d64b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TotalUserProfiles.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class TotalUserProfiles +{ + [JsonInclude, JsonPropertyName("relation")] + public string Relation { get; init; } + [JsonInclude, JsonPropertyName("value")] + public long Value { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs new file mode 100644 index 00000000000..f3a06dc3855 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/User.g.cs @@ -0,0 +1,46 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class User +{ + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool Enabled { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("metadata")] + public IReadOnlyDictionary Metadata { get; init; } + [JsonInclude, JsonPropertyName("profile_uid")] + public string? ProfileUid { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs new file mode 100644 index 00000000000..5bacdaccaa6 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserIndicesPrivileges.g.cs @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserIndicesPrivileges +{ + /// + /// + /// Set to true if using wildcard or regular expressions for patterns that cover restricted indices. Implicitly, restricted indices have limited privileges that can cause pattern tests to fail. If restricted indices are explicitly included in the names list, Elasticsearch checks privileges against these indices regardless of the value set for allow_restricted_indices. + /// + /// + [JsonInclude, JsonPropertyName("allow_restricted_indices")] + public bool AllowRestrictedIndices { get; init; } + + /// + /// + /// The document fields that the owners of the role have read access to. + /// + /// + [JsonInclude, JsonPropertyName("field_security")] + public IReadOnlyCollection? FieldSecurity { get; init; } + + /// + /// + /// A list of indices (or index name patterns) to which the permissions in this entry apply. + /// + /// + [JsonInclude, JsonPropertyName("names")] + [SingleOrManyCollectionConverter(typeof(string))] + public IReadOnlyCollection Names { get; init; } + + /// + /// + /// The index level privileges that owners of the role have on the specified indices. + /// + /// + [JsonInclude, JsonPropertyName("privileges")] + public IReadOnlyCollection Privileges { get; init; } + + /// + /// + /// Search queries that define the documents the user has access to. A document within the specified indices must match these queries for it to be accessible by the owners of the role. + /// + /// + [JsonInclude, JsonPropertyName("query")] + public object? Query { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs new file mode 100644 index 00000000000..8745d1af77e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfile.g.cs @@ -0,0 +1,42 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserProfile +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs new file mode 100644 index 00000000000..b6edf632d5f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileHitMetadata.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserProfileHitMetadata +{ + [JsonInclude, JsonPropertyName("_primary_term")] + public long PrimaryTerm { get; init; } + [JsonInclude, JsonPropertyName("_seq_no")] + public long SeqNo { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs new file mode 100644 index 00000000000..0c841277199 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileUser.g.cs @@ -0,0 +1,44 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserProfileUser +{ + [JsonInclude, JsonPropertyName("email")] + public string? Email { get; init; } + [JsonInclude, JsonPropertyName("full_name")] + public string? FullName { get; init; } + [JsonInclude, JsonPropertyName("realm_domain")] + public string? RealmDomain { get; init; } + [JsonInclude, JsonPropertyName("realm_name")] + public string RealmName { get; init; } + [JsonInclude, JsonPropertyName("roles")] + public IReadOnlyCollection Roles { get; init; } + [JsonInclude, JsonPropertyName("username")] + public string Username { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs new file mode 100644 index 00000000000..fd3c5532dee --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserProfileWithMetadata.g.cs @@ -0,0 +1,46 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserProfileWithMetadata +{ + [JsonInclude, JsonPropertyName("data")] + public IReadOnlyDictionary Data { get; init; } + [JsonInclude, JsonPropertyName("_doc")] + public Elastic.Clients.Elasticsearch.Security.UserProfileHitMetadata Doc { get; init; } + [JsonInclude, JsonPropertyName("enabled")] + public bool? Enabled { get; init; } + [JsonInclude, JsonPropertyName("labels")] + public IReadOnlyDictionary Labels { get; init; } + [JsonInclude, JsonPropertyName("last_synchronized")] + public long LastSynchronized { get; init; } + [JsonInclude, JsonPropertyName("uid")] + public string Uid { get; init; } + [JsonInclude, JsonPropertyName("user")] + public Elastic.Clients.Elasticsearch.Security.UserProfileUser User { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs new file mode 100644 index 00000000000..28be18858ab --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserQuery.g.cs @@ -0,0 +1,384 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +[JsonConverter(typeof(UserQueryConverter))] +public sealed partial class UserQuery +{ + internal UserQuery(string variantName, object variant) + { + if (variantName is null) + throw new ArgumentNullException(nameof(variantName)); + if (variant is null) + throw new ArgumentNullException(nameof(variant)); + if (string.IsNullOrWhiteSpace(variantName)) + throw new ArgumentException("Variant name must not be empty or whitespace."); + VariantName = variantName; + Variant = variant; + } + + internal object Variant { get; } + internal string VariantName { get; } + + public static UserQuery Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => new UserQuery("bool", boolQuery); + public static UserQuery Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => new UserQuery("exists", existsQuery); + public static UserQuery Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => new UserQuery("ids", idsQuery); + public static UserQuery Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => new UserQuery("match", matchQuery); + public static UserQuery MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => new UserQuery("match_all", matchAllQuery); + public static UserQuery Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => new UserQuery("prefix", prefixQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => new UserQuery("range", rangeQuery); + public static UserQuery SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => new UserQuery("simple_query_string", simpleQueryStringQuery); + public static UserQuery Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => new UserQuery("term", termQuery); + public static UserQuery Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => new UserQuery("terms", termsQuery); + public static UserQuery Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => new UserQuery("wildcard", wildcardQuery); + + public bool TryGet([NotNullWhen(true)] out T? result) where T : class + { + result = default; + if (Variant is T variant) + { + result = variant; + return true; + } + + return false; + } +} + +internal sealed partial class UserQueryConverter : JsonConverter +{ + public override UserQuery Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException("Expected start token."); + } + + object? variantValue = default; + string? variantNameValue = default; + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token."); + } + + if (reader.TokenType != JsonTokenType.PropertyName) + { + throw new JsonException("Expected a property name token representing the name of an Elasticsearch field."); + } + + var propertyName = reader.GetString(); + reader.Read(); + if (propertyName == "bool") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "exists") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "ids") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "match_all") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "prefix") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "range") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "simple_query_string") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "term") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "terms") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + if (propertyName == "wildcard") + { + variantValue = JsonSerializer.Deserialize(ref reader, options); + variantNameValue = propertyName; + continue; + } + + throw new JsonException($"Unknown property name '{propertyName}' received while deserializing the 'UserQuery' from the response."); + } + + var result = new UserQuery(variantNameValue, variantValue); + return result; + } + + public override void Write(Utf8JsonWriter writer, UserQuery value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.VariantName is not null && value.Variant is not null) + { + writer.WritePropertyName(value.VariantName); + switch (value.VariantName) + { + case "bool": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery)value.Variant, options); + break; + case "exists": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery)value.Variant, options); + break; + case "ids": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery)value.Variant, options); + break; + case "match": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery)value.Variant, options); + break; + case "match_all": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery)value.Variant, options); + break; + case "prefix": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery)value.Variant, options); + break; + case "range": + JsonSerializer.Serialize(writer, value.Variant, value.Variant.GetType(), options); + break; + case "simple_query_string": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery)value.Variant, options); + break; + case "term": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermQuery)value.Variant, options); + break; + case "terms": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery)value.Variant, options); + break; + case "wildcard": + JsonSerializer.Serialize(writer, (Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery)value.Variant, options); + break; + } + } + + writer.WriteEndObject(); + } +} + +public sealed partial class UserQueryDescriptor : SerializableDescriptor> +{ + internal UserQueryDescriptor(Action> configure) => configure.Invoke(this); + + public UserQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private UserQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public UserQueryDescriptor Bool(Action> configure) => Set(configure, "bool"); + public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public UserQueryDescriptor Exists(Action> configure) => Set(configure, "exists"); + public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public UserQueryDescriptor Match(Action> configure) => Set(configure, "match"); + public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public UserQueryDescriptor Prefix(Action> configure) => Set(configure, "prefix"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public UserQueryDescriptor SimpleQueryString(Action> configure) => Set(configure, "simple_query_string"); + public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public UserQueryDescriptor Term(Action> configure) => Set(configure, "term"); + public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public UserQueryDescriptor Terms(Action> configure) => Set(configure, "terms"); + public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public UserQueryDescriptor Wildcard(Action> configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} + +public sealed partial class UserQueryDescriptor : SerializableDescriptor +{ + internal UserQueryDescriptor(Action configure) => configure.Invoke(this); + + public UserQueryDescriptor() : base() + { + } + + private bool ContainsVariant { get; set; } + private string ContainedVariantName { get; set; } + private object Variant { get; set; } + private Descriptor Descriptor { get; set; } + + private UserQueryDescriptor Set(Action descriptorAction, string variantName) where T : Descriptor + { + ContainedVariantName = variantName; + ContainsVariant = true; + var descriptor = (T)Activator.CreateInstance(typeof(T), true); + descriptorAction?.Invoke(descriptor); + Descriptor = descriptor; + return Self; + } + + private UserQueryDescriptor Set(object variant, string variantName) + { + Variant = variant; + ContainedVariantName = variantName; + ContainsVariant = true; + return Self; + } + + public UserQueryDescriptor Bool(Elastic.Clients.Elasticsearch.QueryDsl.BoolQuery boolQuery) => Set(boolQuery, "bool"); + public UserQueryDescriptor Bool(Action configure) => Set(configure, "bool"); + public UserQueryDescriptor Exists(Elastic.Clients.Elasticsearch.QueryDsl.ExistsQuery existsQuery) => Set(existsQuery, "exists"); + public UserQueryDescriptor Exists(Action configure) => Set(configure, "exists"); + public UserQueryDescriptor Ids(Elastic.Clients.Elasticsearch.QueryDsl.IdsQuery idsQuery) => Set(idsQuery, "ids"); + public UserQueryDescriptor Ids(Action configure) => Set(configure, "ids"); + public UserQueryDescriptor Match(Elastic.Clients.Elasticsearch.QueryDsl.MatchQuery matchQuery) => Set(matchQuery, "match"); + public UserQueryDescriptor Match(Action configure) => Set(configure, "match"); + public UserQueryDescriptor MatchAll(Elastic.Clients.Elasticsearch.QueryDsl.MatchAllQuery matchAllQuery) => Set(matchAllQuery, "match_all"); + public UserQueryDescriptor MatchAll(Action configure) => Set(configure, "match_all"); + public UserQueryDescriptor Prefix(Elastic.Clients.Elasticsearch.QueryDsl.PrefixQuery prefixQuery) => Set(prefixQuery, "prefix"); + public UserQueryDescriptor Prefix(Action configure) => Set(configure, "prefix"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.UntypedRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.DateRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.NumberRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor Range(Elastic.Clients.Elasticsearch.QueryDsl.TermRangeQuery rangeQuery) => Set(rangeQuery, "range"); + public UserQueryDescriptor SimpleQueryString(Elastic.Clients.Elasticsearch.QueryDsl.SimpleQueryStringQuery simpleQueryStringQuery) => Set(simpleQueryStringQuery, "simple_query_string"); + public UserQueryDescriptor SimpleQueryString(Action configure) => Set(configure, "simple_query_string"); + public UserQueryDescriptor Term(Elastic.Clients.Elasticsearch.QueryDsl.TermQuery termQuery) => Set(termQuery, "term"); + public UserQueryDescriptor Term(Action configure) => Set(configure, "term"); + public UserQueryDescriptor Terms(Elastic.Clients.Elasticsearch.QueryDsl.TermsQuery termsQuery) => Set(termsQuery, "terms"); + public UserQueryDescriptor Terms(Action configure) => Set(configure, "terms"); + public UserQueryDescriptor Wildcard(Elastic.Clients.Elasticsearch.QueryDsl.WildcardQuery wildcardQuery) => Set(wildcardQuery, "wildcard"); + public UserQueryDescriptor Wildcard(Action configure) => Set(configure, "wildcard"); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (!string.IsNullOrEmpty(ContainedVariantName)) + { + writer.WritePropertyName(ContainedVariantName); + if (Variant is not null) + { + JsonSerializer.Serialize(writer, Variant, Variant.GetType(), options); + writer.WriteEndObject(); + return; + } + + JsonSerializer.Serialize(writer, Descriptor, Descriptor.GetType(), options); + } + + writer.WriteEndObject(); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs new file mode 100644 index 00000000000..bc09aff3c5f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/UserRealm.g.cs @@ -0,0 +1,36 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Security; + +public sealed partial class UserRealm +{ + [JsonInclude, JsonPropertyName("name")] + public string Name { get; init; } + [JsonInclude, JsonPropertyName("type")] + public string Type { get; init; } +} \ No newline at end of file