Skip to content

Commit

Permalink
more metadata typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 committed Jul 12, 2023
1 parent 3d90b3d commit aa6809e
Show file tree
Hide file tree
Showing 22 changed files with 846 additions and 751 deletions.
18 changes: 13 additions & 5 deletions conformance-test/libraryMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export async function addLifecycleRuleInstancePrecondition(
options: ConformanceTestOptions
) {
await options.bucket!.addLifecycleRule({
action: 'delete',
action: {
type: 'Delete',
},
condition: {
age: 365 * 3, // Specified in days.
},
Expand All @@ -53,7 +55,9 @@ export async function addLifecycleRule(options: ConformanceTestOptions) {
if (options.preconditionRequired) {
await options.bucket!.addLifecycleRule(
{
action: 'delete',
action: {
type: 'Delete',
},
condition: {
age: 365 * 3, // Specified in days.
},
Expand All @@ -64,7 +68,9 @@ export async function addLifecycleRule(options: ConformanceTestOptions) {
);
} else {
await options.bucket!.addLifecycleRule({
action: 'delete',
action: {
type: 'Delete',
},
condition: {
age: 365 * 3, // Specified in days.
},
Expand Down Expand Up @@ -104,7 +110,7 @@ export async function combine(options: ConformanceTestOptions) {
await allFiles.save('allfiles contents');
if (options.preconditionRequired) {
await options.bucket!.combine(sources, allFiles, {
ifGenerationMatch: allFiles.metadata.generation,
ifGenerationMatch: allFiles.metadata.generation!,
});
} else {
await options.bucket!.combine(sources, allFiles);
Expand Down Expand Up @@ -468,7 +474,9 @@ export async function copy(options: ConformanceTestOptions) {

if (options.preconditionRequired) {
await options.file!.copy('a-different-file.png', {
preconditionOpts: {ifGenerationMatch: newFile.metadata.generation},
preconditionOpts: {
ifGenerationMatch: newFile.metadata.generation!,
},
});
} else {
await options.file!.copy('a-different-file.png');
Expand Down
16 changes: 9 additions & 7 deletions src/acl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {BodyResponseCallback, DecorateRequestOptions} from './nodejs-common';
import {
BodyResponseCallback,
DecorateRequestOptions,
BaseMetadata,
} from './nodejs-common';
import {promisifyAll} from '@google-cloud/promisify';

export interface AclOptions {
Expand Down Expand Up @@ -90,20 +94,18 @@ export interface AccessControlObject {
projectTeam: string;
}

export interface AclMetadata {
export interface AclMetadata extends BaseMetadata {
bucket?: string;
domain?: string;
entity?: string;
entityId?: string;
etag?: string;
id?: string;
kind?: string;
generation?: string;
object?: string;
projectTeam?: {
projectNumber?: string;
team?: 'editors' | 'owners' | 'viewers';
};
role?: 'OWNER' | 'READER' | 'WRITER';
selfLink?: string;
role?: 'OWNER' | 'READER' | 'WRITER' | 'FULL_CONTROL';
[key: string]: unknown;
}

Expand Down
Loading

0 comments on commit aa6809e

Please sign in to comment.