Skip to content

Commit

Permalink
Apply Heath's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
maorleger committed Jun 7, 2021
1 parent f02ae61 commit 3d90af4
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 274 deletions.
16 changes: 2 additions & 14 deletions sdk/keyvault/keyvault-admin/src/accessControlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,7 @@ export class KeyVaultAccessControlClient {
options: DeleteRoleAssignmentOptions = {}
): Promise<void> {
return withTrace("deleteRoleAssignment", options, async (updatedOptions) => {
try {
await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);
} catch (error) {
if (error.statusCode !== 404) {
throw error;
}
}
await this.client.roleAssignments.delete(this.vaultUrl, roleScope, name, updatedOptions);
});
}

Expand Down Expand Up @@ -494,13 +488,7 @@ export class KeyVaultAccessControlClient {
options: DeleteRoleDefinitionOptions = {}
): Promise<void> {
return withTrace("deleteRoleDefinition", options, async (updatedOptions) => {
try {
await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);
} catch (error) {
if (error.statusCode !== 404) {
throw error;
}
}
await this.client.roleDefinitions.delete(this.vaultUrl, roleScope, name, updatedOptions);
});
}
}
202 changes: 82 additions & 120 deletions sdk/keyvault/keyvault-admin/src/generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,38 @@

import * as coreHttp from "@azure/core-http";

/** Role definition. */
export interface RoleDefinition {
/** The key vault error exception. */
export interface KeyVaultError {
/**
* The role definition ID.
* The key vault server error.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly id?: string;
readonly error?: ErrorModel;
}

/** The key vault server error. */
export interface ErrorModel {
/**
* The role definition name.
* The error code.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
readonly code?: string;
/**
* The role definition type.
* The error message.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: RoleDefinitionType;
/** The role name. */
roleName?: string;
/** The role definition description. */
description?: string;
/** The role type. */
roleType?: RoleType;
/** Role definition permissions. */
permissions?: Permission[];
/** Role definition assignable scopes. */
assignableScopes?: RoleScope[];
readonly message?: string;
/**
* The key vault server error.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly innerError?: ErrorModel;
}

/** Role definition create parameters. */
export interface RoleDefinitionCreateParameters {
/** Role definition properties. */
properties: RoleDefinitionProperties;
}

/** Role definition properties. */
Expand Down Expand Up @@ -63,38 +68,33 @@ export interface Permission {
notDataActions?: DataAction[];
}

/** The key vault error exception. */
export interface KeyVaultError {
/**
* The key vault server error.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly error?: ErrorModel;
}

/** The key vault server error. */
export interface ErrorModel {
/** Role definition. */
export interface RoleDefinition {
/**
* The error code.
* The role definition ID.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly code?: string;
readonly id?: string;
/**
* The error message.
* The role definition name.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly message?: string;
readonly name?: string;
/**
* The key vault server error.
* The role definition type.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly innerError?: ErrorModel;
}

/** Role definition create parameters. */
export interface RoleDefinitionCreateParameters {
/** Role definition properties. */
properties: RoleDefinitionProperties;
readonly type?: RoleDefinitionType;
/** The role name. */
roleName?: string;
/** The role definition description. */
description?: string;
/** The role type. */
roleType?: RoleType;
/** Role definition permissions. */
permissions?: Permission[];
/** Role definition assignable scopes. */
assignableScopes?: RoleScope[];
}

/** Role definition list operation result. */
Expand All @@ -105,6 +105,20 @@ export interface RoleDefinitionListResult {
nextLink?: string;
}

/** Role assignment create parameters. */
export interface RoleAssignmentCreateParameters {
/** Role assignment properties. */
properties: RoleAssignmentProperties;
}

/** Role assignment properties. */
export interface RoleAssignmentProperties {
/** The role definition ID used in the role assignment. */
roleDefinitionId: string;
/** The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. */
principalId: string;
}

/** Role Assignments */
export interface RoleAssignment {
/**
Expand Down Expand Up @@ -136,20 +150,6 @@ export interface RoleAssignmentPropertiesWithScope {
principalId?: string;
}

/** Role assignment create parameters. */
export interface RoleAssignmentCreateParameters {
/** Role assignment properties. */
properties: RoleAssignmentProperties;
}

/** Role assignment properties. */
export interface RoleAssignmentProperties {
/** The role definition ID used in the role assignment. */
roleDefinitionId: string;
/** The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. */
principalId: string;
}

/** Role assignment list operation result. */
export interface RoleAssignmentListResult {
/** Role assignment list. */
Expand Down Expand Up @@ -265,20 +265,6 @@ export interface KeyVaultClientSelectiveKeyRestoreOperationHeaders {
azureAsyncOperation?: string;
}

/** Known values of {@link RoleDefinitionType} that the service accepts. */
export const enum KnownRoleDefinitionType {
MicrosoftAuthorizationRoleDefinitions = "Microsoft.Authorization/roleDefinitions"
}

/**
* Defines values for RoleDefinitionType. \
* {@link KnownRoleDefinitionType} can be used interchangeably with RoleDefinitionType,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* **Microsoft.Authorization\/roleDefinitions**
*/
export type RoleDefinitionType = string;

/** Known values of {@link RoleType} that the service accepts. */
export const enum KnownRoleType {
/** Built in role. */
Expand Down Expand Up @@ -418,25 +404,25 @@ export enum KnownRoleScope {
*/
export type RoleScope = string;

/** Optional parameters. */
export interface RoleDefinitionsDeleteOptionalParams
extends coreHttp.OperationOptions {}
/** Known values of {@link RoleDefinitionType} that the service accepts. */
export const enum KnownRoleDefinitionType {
MicrosoftAuthorizationRoleDefinitions = "Microsoft.Authorization/roleDefinitions"
}

/** Contains response data for the delete operation. */
export type RoleDefinitionsDeleteResponse = RoleDefinition & {
/** The underlying HTTP response. */
_response: coreHttp.HttpResponse & {
/** The response body as text (string format) */
bodyAsText: string;
/**
* Defines values for RoleDefinitionType. \
* {@link KnownRoleDefinitionType} can be used interchangeably with RoleDefinitionType,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* **Microsoft.Authorization\/roleDefinitions**
*/
export type RoleDefinitionType = string;

/** The response body as parsed JSON or XML */
parsedBody: RoleDefinition;
};
};
/** Optional parameters. */
export interface RoleDefinitionsDeleteOptionalParams extends coreHttp.OperationOptions {}

/** Optional parameters. */
export interface RoleDefinitionsCreateOrUpdateOptionalParams
extends coreHttp.OperationOptions {}
export interface RoleDefinitionsCreateOrUpdateOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the createOrUpdate operation. */
export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition & {
Expand All @@ -451,8 +437,7 @@ export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition & {
};

/** Optional parameters. */
export interface RoleDefinitionsGetOptionalParams
extends coreHttp.OperationOptions {}
export interface RoleDefinitionsGetOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the get operation. */
export type RoleDefinitionsGetResponse = RoleDefinition & {
Expand All @@ -467,8 +452,7 @@ export type RoleDefinitionsGetResponse = RoleDefinition & {
};

/** Optional parameters. */
export interface RoleDefinitionsListOptionalParams
extends coreHttp.OperationOptions {
export interface RoleDefinitionsListOptionalParams extends coreHttp.OperationOptions {
/** The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. */
filter?: string;
}
Expand All @@ -486,8 +470,7 @@ export type RoleDefinitionsListResponse = RoleDefinitionListResult & {
};

/** Optional parameters. */
export interface RoleDefinitionsListNextOptionalParams
extends coreHttp.OperationOptions {
export interface RoleDefinitionsListNextOptionalParams extends coreHttp.OperationOptions {
/** The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. */
filter?: string;
}
Expand All @@ -505,24 +488,10 @@ export type RoleDefinitionsListNextResponse = RoleDefinitionListResult & {
};

/** Optional parameters. */
export interface RoleAssignmentsDeleteOptionalParams
extends coreHttp.OperationOptions {}

/** Contains response data for the delete operation. */
export type RoleAssignmentsDeleteResponse = RoleAssignment & {
/** The underlying HTTP response. */
_response: coreHttp.HttpResponse & {
/** The response body as text (string format) */
bodyAsText: string;

/** The response body as parsed JSON or XML */
parsedBody: RoleAssignment;
};
};
export interface RoleAssignmentsDeleteOptionalParams extends coreHttp.OperationOptions {}

/** Optional parameters. */
export interface RoleAssignmentsCreateOptionalParams
extends coreHttp.OperationOptions {}
export interface RoleAssignmentsCreateOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the create operation. */
export type RoleAssignmentsCreateResponse = RoleAssignment & {
Expand All @@ -537,8 +506,7 @@ export type RoleAssignmentsCreateResponse = RoleAssignment & {
};

/** Optional parameters. */
export interface RoleAssignmentsGetOptionalParams
extends coreHttp.OperationOptions {}
export interface RoleAssignmentsGetOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the get operation. */
export type RoleAssignmentsGetResponse = RoleAssignment & {
Expand All @@ -553,8 +521,7 @@ export type RoleAssignmentsGetResponse = RoleAssignment & {
};

/** Optional parameters. */
export interface RoleAssignmentsListForScopeOptionalParams
extends coreHttp.OperationOptions {
export interface RoleAssignmentsListForScopeOptionalParams extends coreHttp.OperationOptions {
/** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */
filter?: string;
}
Expand All @@ -572,8 +539,7 @@ export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult & {
};

/** Optional parameters. */
export interface RoleAssignmentsListForScopeNextOptionalParams
extends coreHttp.OperationOptions {
export interface RoleAssignmentsListForScopeNextOptionalParams extends coreHttp.OperationOptions {
/** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */
filter?: string;
}
Expand All @@ -591,8 +557,7 @@ export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult &
};

/** Optional parameters. */
export interface KeyVaultClientFullBackupOptionalParams
extends coreHttp.OperationOptions {
export interface KeyVaultClientFullBackupOptionalParams extends coreHttp.OperationOptions {
/** Azure blob shared access signature token pointing to a valid Azure blob container where full backup needs to be stored. This token needs to be valid for at least next 24 hours from the time of making this call */
azureStorageBlobContainerUri?: SASTokenParameter;
}
Expand All @@ -613,8 +578,7 @@ export type KeyVaultClientFullBackupResponse = KeyVaultClientFullBackupHeaders &
};

/** Optional parameters. */
export interface KeyVaultClientFullBackupStatusOptionalParams
extends coreHttp.OperationOptions {}
export interface KeyVaultClientFullBackupStatusOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the fullBackupStatus operation. */
export type KeyVaultClientFullBackupStatusResponse = FullBackupOperation & {
Expand Down Expand Up @@ -651,8 +615,7 @@ export type KeyVaultClientFullRestoreOperationResponse = KeyVaultClientFullResto
};

/** Optional parameters. */
export interface KeyVaultClientRestoreStatusOptionalParams
extends coreHttp.OperationOptions {}
export interface KeyVaultClientRestoreStatusOptionalParams extends coreHttp.OperationOptions {}

/** Contains response data for the restoreStatus operation. */
export type KeyVaultClientRestoreStatusResponse = RestoreOperation & {
Expand Down Expand Up @@ -689,8 +652,7 @@ export type KeyVaultClientSelectiveKeyRestoreOperationResponse = KeyVaultClientS
};

/** Optional parameters. */
export interface KeyVaultClientOptionalParams
extends coreHttp.ServiceClientOptions {
export interface KeyVaultClientOptionalParams extends coreHttp.ServiceClientOptions {
/** Api Version */
apiVersion?: string;
/** Overrides client endpoint. */
Expand Down
Loading

0 comments on commit 3d90af4

Please sign in to comment.