Skip to content

Commit

Permalink
feat: add support for Key Reimport
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 393749648

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Aug 30 05:26:24 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: e3d9b11abaec81e1c3c9c7cab1f3bb6fa3990651
Source-Link: googleapis/googleapis@e3d9b11
  • Loading branch information
yoshi-automation authored and jskeet committed Aug 30, 2021
1 parent dd74fcc commit b91de3f
Show file tree
Hide file tree
Showing 8 changed files with 560 additions and 387 deletions.
Expand Up @@ -1892,6 +1892,7 @@ public void ImportCryptoKeyVersionRequestObject()
Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
ImportJob = "",
RsaAesWrappedKey = ByteString.Empty,
CryptoKeyVersionAsCryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.ImportCryptoKeyVersion(request);
Expand All @@ -1912,6 +1913,7 @@ public async Task ImportCryptoKeyVersionRequestObjectAsync()
Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
ImportJob = "",
RsaAesWrappedKey = ByteString.Empty,
CryptoKeyVersionAsCryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.ImportCryptoKeyVersionAsync(request);
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

182 changes: 114 additions & 68 deletions apis/Google.Cloud.Kms.V1/Google.Cloud.Kms.V1/Resources.g.cs

Large diffs are not rendered by default.

485 changes: 271 additions & 214 deletions apis/Google.Cloud.Kms.V1/Google.Cloud.Kms.V1/Service.g.cs

Large diffs are not rendered by default.

90 changes: 50 additions & 40 deletions apis/Google.Cloud.Kms.V1/Google.Cloud.Kms.V1/ServiceGrpc.g.cs
Expand Up @@ -451,11 +451,12 @@ public abstract partial class KeyManagementServiceBase
}

/// <summary>
/// Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the
/// wrapped key material provided in the request.
/// Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
///
/// The version ID will be assigned the next sequential id within the
/// [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is
/// additionally specified in the request, key material will be reimported into
/// that version. Otherwise, a new version will be created, and will be
/// assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
Expand Down Expand Up @@ -524,10 +525,11 @@ public abstract partial class KeyManagementServiceBase
/// Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
///
/// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
/// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
/// will be changed to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time
/// [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the
/// future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will
/// automatically change to
/// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
/// material will be irrevocably destroyed.
///
Expand Down Expand Up @@ -1250,11 +1252,12 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
return CallInvoker.AsyncUnaryCall(__Method_CreateCryptoKeyVersion, null, options, request);
}
/// <summary>
/// Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the
/// wrapped key material provided in the request.
/// Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
///
/// The version ID will be assigned the next sequential id within the
/// [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is
/// additionally specified in the request, key material will be reimported into
/// that version. Otherwise, a new version will be created, and will be
/// assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
Expand All @@ -1266,11 +1269,12 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
return ImportCryptoKeyVersion(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the
/// wrapped key material provided in the request.
/// Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
///
/// The version ID will be assigned the next sequential id within the
/// [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is
/// additionally specified in the request, key material will be reimported into
/// that version. Otherwise, a new version will be created, and will be
/// assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
Expand All @@ -1280,11 +1284,12 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
return CallInvoker.BlockingUnaryCall(__Method_ImportCryptoKeyVersion, null, options, request);
}
/// <summary>
/// Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the
/// wrapped key material provided in the request.
/// Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
///
/// The version ID will be assigned the next sequential id within the
/// [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is
/// additionally specified in the request, key material will be reimported into
/// that version. Otherwise, a new version will be created, and will be
/// assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
Expand All @@ -1296,11 +1301,12 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
return ImportCryptoKeyVersionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the
/// wrapped key material provided in the request.
/// Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
///
/// The version ID will be assigned the next sequential id within the
/// [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is
/// additionally specified in the request, key material will be reimported into
/// that version. Otherwise, a new version will be created, and will be
/// assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
Expand Down Expand Up @@ -1533,10 +1539,11 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
/// Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
///
/// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
/// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
/// will be changed to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time
/// [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the
/// future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will
/// automatically change to
/// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
/// material will be irrevocably destroyed.
///
Expand All @@ -1556,10 +1563,11 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
/// Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
///
/// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
/// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
/// will be changed to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time
/// [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the
/// future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will
/// automatically change to
/// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
/// material will be irrevocably destroyed.
///
Expand All @@ -1577,10 +1585,11 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
/// Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
///
/// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
/// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
/// will be changed to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time
/// [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the
/// future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will
/// automatically change to
/// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
/// material will be irrevocably destroyed.
///
Expand All @@ -1600,10 +1609,11 @@ protected KeyManagementServiceClient(ClientBaseConfiguration configuration) : ba
/// Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
///
/// Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
/// hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
/// will be changed to
/// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
/// and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time
/// [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the
/// future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will
/// automatically change to
/// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
/// material will be irrevocably destroyed.
///
Expand Down
Expand Up @@ -174,6 +174,16 @@ public CryptoKeyName ParentAsCryptoKeyName
get => string.IsNullOrEmpty(Parent) ? null : CryptoKeyName.Parse(Parent, allowUnparsed: true);
set => Parent = value?.ToString() ?? "";
}

/// <summary>
/// <see cref="CryptoKeyVersionName"/>-typed view over the <see cref="CryptoKeyVersion"/> resource name
/// property.
/// </summary>
public CryptoKeyVersionName CryptoKeyVersionAsCryptoKeyVersionName
{
get => string.IsNullOrEmpty(CryptoKeyVersion) ? null : CryptoKeyVersionName.Parse(CryptoKeyVersion, allowUnparsed: true);
set => CryptoKeyVersion = value?.ToString() ?? "";
}
}

public partial class CreateImportJobRequest
Expand Down
2 changes: 1 addition & 1 deletion apis/Google.Cloud.Kms.V1/synth.metadata
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "a6c8dc7f72206eaff566f22593213cd9196d2bf2"
"sha": "e3d9b11abaec81e1c3c9c7cab1f3bb6fa3990651"
}
}
]
Expand Down

0 comments on commit b91de3f

Please sign in to comment.