...

Source file src/cloud.google.com/go/resourcemanager/apiv3/auxiliary.go

Documentation: cloud.google.com/go/resourcemanager/apiv3

     1  // Copyright 2024 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     https://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go_gapic. DO NOT EDIT.
    16  
    17  package resourcemanager
    18  
    19  import (
    20  	"context"
    21  	"time"
    22  
    23  	"cloud.google.com/go/longrunning"
    24  	resourcemanagerpb "cloud.google.com/go/resourcemanager/apiv3/resourcemanagerpb"
    25  	gax "github.com/googleapis/gax-go/v2"
    26  	"google.golang.org/api/iterator"
    27  )
    28  
    29  // CreateFolderOperation manages a long-running operation from CreateFolder.
    30  type CreateFolderOperation struct {
    31  	lro      *longrunning.Operation
    32  	pollPath string
    33  }
    34  
    35  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
    36  //
    37  // See documentation of Poll for error-handling information.
    38  func (op *CreateFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
    39  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    40  	var resp resourcemanagerpb.Folder
    41  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
    42  		return nil, err
    43  	}
    44  	return &resp, nil
    45  }
    46  
    47  // Poll fetches the latest state of the long-running operation.
    48  //
    49  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
    50  //
    51  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
    52  // the operation has completed with failure, the error is returned and op.Done will return true.
    53  // If Poll succeeds and the operation has completed successfully,
    54  // op.Done will return true, and the response of the operation is returned.
    55  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
    56  func (op *CreateFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
    57  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
    58  	var resp resourcemanagerpb.Folder
    59  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
    60  		return nil, err
    61  	}
    62  	if !op.Done() {
    63  		return nil, nil
    64  	}
    65  	return &resp, nil
    66  }
    67  
    68  // Metadata returns metadata associated with the long-running operation.
    69  // Metadata itself does not contact the server, but Poll does.
    70  // To get the latest metadata, call this method after a successful call to Poll.
    71  // If the metadata is not available, the returned metadata and error are both nil.
    72  func (op *CreateFolderOperation) Metadata() (*resourcemanagerpb.CreateFolderMetadata, error) {
    73  	var meta resourcemanagerpb.CreateFolderMetadata
    74  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
    75  		return nil, nil
    76  	} else if err != nil {
    77  		return nil, err
    78  	}
    79  	return &meta, nil
    80  }
    81  
    82  // Done reports whether the long-running operation has completed.
    83  func (op *CreateFolderOperation) Done() bool {
    84  	return op.lro.Done()
    85  }
    86  
    87  // Name returns the name of the long-running operation.
    88  // The name is assigned by the server and is unique within the service from which the operation is created.
    89  func (op *CreateFolderOperation) Name() string {
    90  	return op.lro.Name()
    91  }
    92  
    93  // CreateProjectOperation manages a long-running operation from CreateProject.
    94  type CreateProjectOperation struct {
    95  	lro      *longrunning.Operation
    96  	pollPath string
    97  }
    98  
    99  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   100  //
   101  // See documentation of Poll for error-handling information.
   102  func (op *CreateProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   103  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   104  	var resp resourcemanagerpb.Project
   105  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   106  		return nil, err
   107  	}
   108  	return &resp, nil
   109  }
   110  
   111  // Poll fetches the latest state of the long-running operation.
   112  //
   113  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   114  //
   115  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   116  // the operation has completed with failure, the error is returned and op.Done will return true.
   117  // If Poll succeeds and the operation has completed successfully,
   118  // op.Done will return true, and the response of the operation is returned.
   119  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   120  func (op *CreateProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   121  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   122  	var resp resourcemanagerpb.Project
   123  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   124  		return nil, err
   125  	}
   126  	if !op.Done() {
   127  		return nil, nil
   128  	}
   129  	return &resp, nil
   130  }
   131  
   132  // Metadata returns metadata associated with the long-running operation.
   133  // Metadata itself does not contact the server, but Poll does.
   134  // To get the latest metadata, call this method after a successful call to Poll.
   135  // If the metadata is not available, the returned metadata and error are both nil.
   136  func (op *CreateProjectOperation) Metadata() (*resourcemanagerpb.CreateProjectMetadata, error) {
   137  	var meta resourcemanagerpb.CreateProjectMetadata
   138  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   139  		return nil, nil
   140  	} else if err != nil {
   141  		return nil, err
   142  	}
   143  	return &meta, nil
   144  }
   145  
   146  // Done reports whether the long-running operation has completed.
   147  func (op *CreateProjectOperation) Done() bool {
   148  	return op.lro.Done()
   149  }
   150  
   151  // Name returns the name of the long-running operation.
   152  // The name is assigned by the server and is unique within the service from which the operation is created.
   153  func (op *CreateProjectOperation) Name() string {
   154  	return op.lro.Name()
   155  }
   156  
   157  // CreateTagBindingOperation manages a long-running operation from CreateTagBinding.
   158  type CreateTagBindingOperation struct {
   159  	lro      *longrunning.Operation
   160  	pollPath string
   161  }
   162  
   163  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   164  //
   165  // See documentation of Poll for error-handling information.
   166  func (op *CreateTagBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagBinding, error) {
   167  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   168  	var resp resourcemanagerpb.TagBinding
   169  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   170  		return nil, err
   171  	}
   172  	return &resp, nil
   173  }
   174  
   175  // Poll fetches the latest state of the long-running operation.
   176  //
   177  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   178  //
   179  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   180  // the operation has completed with failure, the error is returned and op.Done will return true.
   181  // If Poll succeeds and the operation has completed successfully,
   182  // op.Done will return true, and the response of the operation is returned.
   183  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   184  func (op *CreateTagBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagBinding, error) {
   185  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   186  	var resp resourcemanagerpb.TagBinding
   187  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   188  		return nil, err
   189  	}
   190  	if !op.Done() {
   191  		return nil, nil
   192  	}
   193  	return &resp, nil
   194  }
   195  
   196  // Metadata returns metadata associated with the long-running operation.
   197  // Metadata itself does not contact the server, but Poll does.
   198  // To get the latest metadata, call this method after a successful call to Poll.
   199  // If the metadata is not available, the returned metadata and error are both nil.
   200  func (op *CreateTagBindingOperation) Metadata() (*resourcemanagerpb.CreateTagBindingMetadata, error) {
   201  	var meta resourcemanagerpb.CreateTagBindingMetadata
   202  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   203  		return nil, nil
   204  	} else if err != nil {
   205  		return nil, err
   206  	}
   207  	return &meta, nil
   208  }
   209  
   210  // Done reports whether the long-running operation has completed.
   211  func (op *CreateTagBindingOperation) Done() bool {
   212  	return op.lro.Done()
   213  }
   214  
   215  // Name returns the name of the long-running operation.
   216  // The name is assigned by the server and is unique within the service from which the operation is created.
   217  func (op *CreateTagBindingOperation) Name() string {
   218  	return op.lro.Name()
   219  }
   220  
   221  // CreateTagHoldOperation manages a long-running operation from CreateTagHold.
   222  type CreateTagHoldOperation struct {
   223  	lro      *longrunning.Operation
   224  	pollPath string
   225  }
   226  
   227  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   228  //
   229  // See documentation of Poll for error-handling information.
   230  func (op *CreateTagHoldOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagHold, error) {
   231  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   232  	var resp resourcemanagerpb.TagHold
   233  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   234  		return nil, err
   235  	}
   236  	return &resp, nil
   237  }
   238  
   239  // Poll fetches the latest state of the long-running operation.
   240  //
   241  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   242  //
   243  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   244  // the operation has completed with failure, the error is returned and op.Done will return true.
   245  // If Poll succeeds and the operation has completed successfully,
   246  // op.Done will return true, and the response of the operation is returned.
   247  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   248  func (op *CreateTagHoldOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagHold, error) {
   249  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   250  	var resp resourcemanagerpb.TagHold
   251  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   252  		return nil, err
   253  	}
   254  	if !op.Done() {
   255  		return nil, nil
   256  	}
   257  	return &resp, nil
   258  }
   259  
   260  // Metadata returns metadata associated with the long-running operation.
   261  // Metadata itself does not contact the server, but Poll does.
   262  // To get the latest metadata, call this method after a successful call to Poll.
   263  // If the metadata is not available, the returned metadata and error are both nil.
   264  func (op *CreateTagHoldOperation) Metadata() (*resourcemanagerpb.CreateTagHoldMetadata, error) {
   265  	var meta resourcemanagerpb.CreateTagHoldMetadata
   266  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   267  		return nil, nil
   268  	} else if err != nil {
   269  		return nil, err
   270  	}
   271  	return &meta, nil
   272  }
   273  
   274  // Done reports whether the long-running operation has completed.
   275  func (op *CreateTagHoldOperation) Done() bool {
   276  	return op.lro.Done()
   277  }
   278  
   279  // Name returns the name of the long-running operation.
   280  // The name is assigned by the server and is unique within the service from which the operation is created.
   281  func (op *CreateTagHoldOperation) Name() string {
   282  	return op.lro.Name()
   283  }
   284  
   285  // CreateTagKeyOperation manages a long-running operation from CreateTagKey.
   286  type CreateTagKeyOperation struct {
   287  	lro      *longrunning.Operation
   288  	pollPath string
   289  }
   290  
   291  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   292  //
   293  // See documentation of Poll for error-handling information.
   294  func (op *CreateTagKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
   295  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   296  	var resp resourcemanagerpb.TagKey
   297  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   298  		return nil, err
   299  	}
   300  	return &resp, nil
   301  }
   302  
   303  // Poll fetches the latest state of the long-running operation.
   304  //
   305  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   306  //
   307  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   308  // the operation has completed with failure, the error is returned and op.Done will return true.
   309  // If Poll succeeds and the operation has completed successfully,
   310  // op.Done will return true, and the response of the operation is returned.
   311  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   312  func (op *CreateTagKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
   313  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   314  	var resp resourcemanagerpb.TagKey
   315  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   316  		return nil, err
   317  	}
   318  	if !op.Done() {
   319  		return nil, nil
   320  	}
   321  	return &resp, nil
   322  }
   323  
   324  // Metadata returns metadata associated with the long-running operation.
   325  // Metadata itself does not contact the server, but Poll does.
   326  // To get the latest metadata, call this method after a successful call to Poll.
   327  // If the metadata is not available, the returned metadata and error are both nil.
   328  func (op *CreateTagKeyOperation) Metadata() (*resourcemanagerpb.CreateTagKeyMetadata, error) {
   329  	var meta resourcemanagerpb.CreateTagKeyMetadata
   330  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   331  		return nil, nil
   332  	} else if err != nil {
   333  		return nil, err
   334  	}
   335  	return &meta, nil
   336  }
   337  
   338  // Done reports whether the long-running operation has completed.
   339  func (op *CreateTagKeyOperation) Done() bool {
   340  	return op.lro.Done()
   341  }
   342  
   343  // Name returns the name of the long-running operation.
   344  // The name is assigned by the server and is unique within the service from which the operation is created.
   345  func (op *CreateTagKeyOperation) Name() string {
   346  	return op.lro.Name()
   347  }
   348  
   349  // CreateTagValueOperation manages a long-running operation from CreateTagValue.
   350  type CreateTagValueOperation struct {
   351  	lro      *longrunning.Operation
   352  	pollPath string
   353  }
   354  
   355  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   356  //
   357  // See documentation of Poll for error-handling information.
   358  func (op *CreateTagValueOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
   359  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   360  	var resp resourcemanagerpb.TagValue
   361  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   362  		return nil, err
   363  	}
   364  	return &resp, nil
   365  }
   366  
   367  // Poll fetches the latest state of the long-running operation.
   368  //
   369  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   370  //
   371  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   372  // the operation has completed with failure, the error is returned and op.Done will return true.
   373  // If Poll succeeds and the operation has completed successfully,
   374  // op.Done will return true, and the response of the operation is returned.
   375  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   376  func (op *CreateTagValueOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
   377  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   378  	var resp resourcemanagerpb.TagValue
   379  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   380  		return nil, err
   381  	}
   382  	if !op.Done() {
   383  		return nil, nil
   384  	}
   385  	return &resp, nil
   386  }
   387  
   388  // Metadata returns metadata associated with the long-running operation.
   389  // Metadata itself does not contact the server, but Poll does.
   390  // To get the latest metadata, call this method after a successful call to Poll.
   391  // If the metadata is not available, the returned metadata and error are both nil.
   392  func (op *CreateTagValueOperation) Metadata() (*resourcemanagerpb.CreateTagValueMetadata, error) {
   393  	var meta resourcemanagerpb.CreateTagValueMetadata
   394  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   395  		return nil, nil
   396  	} else if err != nil {
   397  		return nil, err
   398  	}
   399  	return &meta, nil
   400  }
   401  
   402  // Done reports whether the long-running operation has completed.
   403  func (op *CreateTagValueOperation) Done() bool {
   404  	return op.lro.Done()
   405  }
   406  
   407  // Name returns the name of the long-running operation.
   408  // The name is assigned by the server and is unique within the service from which the operation is created.
   409  func (op *CreateTagValueOperation) Name() string {
   410  	return op.lro.Name()
   411  }
   412  
   413  // DeleteFolderOperation manages a long-running operation from DeleteFolder.
   414  type DeleteFolderOperation struct {
   415  	lro      *longrunning.Operation
   416  	pollPath string
   417  }
   418  
   419  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   420  //
   421  // See documentation of Poll for error-handling information.
   422  func (op *DeleteFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   423  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   424  	var resp resourcemanagerpb.Folder
   425  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   426  		return nil, err
   427  	}
   428  	return &resp, nil
   429  }
   430  
   431  // Poll fetches the latest state of the long-running operation.
   432  //
   433  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   434  //
   435  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   436  // the operation has completed with failure, the error is returned and op.Done will return true.
   437  // If Poll succeeds and the operation has completed successfully,
   438  // op.Done will return true, and the response of the operation is returned.
   439  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   440  func (op *DeleteFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   441  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   442  	var resp resourcemanagerpb.Folder
   443  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   444  		return nil, err
   445  	}
   446  	if !op.Done() {
   447  		return nil, nil
   448  	}
   449  	return &resp, nil
   450  }
   451  
   452  // Metadata returns metadata associated with the long-running operation.
   453  // Metadata itself does not contact the server, but Poll does.
   454  // To get the latest metadata, call this method after a successful call to Poll.
   455  // If the metadata is not available, the returned metadata and error are both nil.
   456  func (op *DeleteFolderOperation) Metadata() (*resourcemanagerpb.DeleteFolderMetadata, error) {
   457  	var meta resourcemanagerpb.DeleteFolderMetadata
   458  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   459  		return nil, nil
   460  	} else if err != nil {
   461  		return nil, err
   462  	}
   463  	return &meta, nil
   464  }
   465  
   466  // Done reports whether the long-running operation has completed.
   467  func (op *DeleteFolderOperation) Done() bool {
   468  	return op.lro.Done()
   469  }
   470  
   471  // Name returns the name of the long-running operation.
   472  // The name is assigned by the server and is unique within the service from which the operation is created.
   473  func (op *DeleteFolderOperation) Name() string {
   474  	return op.lro.Name()
   475  }
   476  
   477  // DeleteProjectOperation manages a long-running operation from DeleteProject.
   478  type DeleteProjectOperation struct {
   479  	lro      *longrunning.Operation
   480  	pollPath string
   481  }
   482  
   483  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   484  //
   485  // See documentation of Poll for error-handling information.
   486  func (op *DeleteProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   487  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   488  	var resp resourcemanagerpb.Project
   489  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   490  		return nil, err
   491  	}
   492  	return &resp, nil
   493  }
   494  
   495  // Poll fetches the latest state of the long-running operation.
   496  //
   497  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   498  //
   499  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   500  // the operation has completed with failure, the error is returned and op.Done will return true.
   501  // If Poll succeeds and the operation has completed successfully,
   502  // op.Done will return true, and the response of the operation is returned.
   503  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   504  func (op *DeleteProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   505  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   506  	var resp resourcemanagerpb.Project
   507  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   508  		return nil, err
   509  	}
   510  	if !op.Done() {
   511  		return nil, nil
   512  	}
   513  	return &resp, nil
   514  }
   515  
   516  // Metadata returns metadata associated with the long-running operation.
   517  // Metadata itself does not contact the server, but Poll does.
   518  // To get the latest metadata, call this method after a successful call to Poll.
   519  // If the metadata is not available, the returned metadata and error are both nil.
   520  func (op *DeleteProjectOperation) Metadata() (*resourcemanagerpb.DeleteProjectMetadata, error) {
   521  	var meta resourcemanagerpb.DeleteProjectMetadata
   522  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   523  		return nil, nil
   524  	} else if err != nil {
   525  		return nil, err
   526  	}
   527  	return &meta, nil
   528  }
   529  
   530  // Done reports whether the long-running operation has completed.
   531  func (op *DeleteProjectOperation) Done() bool {
   532  	return op.lro.Done()
   533  }
   534  
   535  // Name returns the name of the long-running operation.
   536  // The name is assigned by the server and is unique within the service from which the operation is created.
   537  func (op *DeleteProjectOperation) Name() string {
   538  	return op.lro.Name()
   539  }
   540  
   541  // DeleteTagBindingOperation manages a long-running operation from DeleteTagBinding.
   542  type DeleteTagBindingOperation struct {
   543  	lro      *longrunning.Operation
   544  	pollPath string
   545  }
   546  
   547  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   548  //
   549  // See documentation of Poll for error-handling information.
   550  func (op *DeleteTagBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   551  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   552  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   553  }
   554  
   555  // Poll fetches the latest state of the long-running operation.
   556  //
   557  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   558  //
   559  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   560  // the operation has completed with failure, the error is returned and op.Done will return true.
   561  // If Poll succeeds and the operation has completed successfully,
   562  // op.Done will return true, and the response of the operation is returned.
   563  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   564  func (op *DeleteTagBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   565  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   566  	return op.lro.Poll(ctx, nil, opts...)
   567  }
   568  
   569  // Metadata returns metadata associated with the long-running operation.
   570  // Metadata itself does not contact the server, but Poll does.
   571  // To get the latest metadata, call this method after a successful call to Poll.
   572  // If the metadata is not available, the returned metadata and error are both nil.
   573  func (op *DeleteTagBindingOperation) Metadata() (*resourcemanagerpb.DeleteTagBindingMetadata, error) {
   574  	var meta resourcemanagerpb.DeleteTagBindingMetadata
   575  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   576  		return nil, nil
   577  	} else if err != nil {
   578  		return nil, err
   579  	}
   580  	return &meta, nil
   581  }
   582  
   583  // Done reports whether the long-running operation has completed.
   584  func (op *DeleteTagBindingOperation) Done() bool {
   585  	return op.lro.Done()
   586  }
   587  
   588  // Name returns the name of the long-running operation.
   589  // The name is assigned by the server and is unique within the service from which the operation is created.
   590  func (op *DeleteTagBindingOperation) Name() string {
   591  	return op.lro.Name()
   592  }
   593  
   594  // DeleteTagHoldOperation manages a long-running operation from DeleteTagHold.
   595  type DeleteTagHoldOperation struct {
   596  	lro      *longrunning.Operation
   597  	pollPath string
   598  }
   599  
   600  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   601  //
   602  // See documentation of Poll for error-handling information.
   603  func (op *DeleteTagHoldOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
   604  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   605  	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
   606  }
   607  
   608  // Poll fetches the latest state of the long-running operation.
   609  //
   610  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   611  //
   612  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   613  // the operation has completed with failure, the error is returned and op.Done will return true.
   614  // If Poll succeeds and the operation has completed successfully,
   615  // op.Done will return true, and the response of the operation is returned.
   616  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   617  func (op *DeleteTagHoldOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
   618  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   619  	return op.lro.Poll(ctx, nil, opts...)
   620  }
   621  
   622  // Metadata returns metadata associated with the long-running operation.
   623  // Metadata itself does not contact the server, but Poll does.
   624  // To get the latest metadata, call this method after a successful call to Poll.
   625  // If the metadata is not available, the returned metadata and error are both nil.
   626  func (op *DeleteTagHoldOperation) Metadata() (*resourcemanagerpb.DeleteTagHoldMetadata, error) {
   627  	var meta resourcemanagerpb.DeleteTagHoldMetadata
   628  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   629  		return nil, nil
   630  	} else if err != nil {
   631  		return nil, err
   632  	}
   633  	return &meta, nil
   634  }
   635  
   636  // Done reports whether the long-running operation has completed.
   637  func (op *DeleteTagHoldOperation) Done() bool {
   638  	return op.lro.Done()
   639  }
   640  
   641  // Name returns the name of the long-running operation.
   642  // The name is assigned by the server and is unique within the service from which the operation is created.
   643  func (op *DeleteTagHoldOperation) Name() string {
   644  	return op.lro.Name()
   645  }
   646  
   647  // DeleteTagKeyOperation manages a long-running operation from DeleteTagKey.
   648  type DeleteTagKeyOperation struct {
   649  	lro      *longrunning.Operation
   650  	pollPath string
   651  }
   652  
   653  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   654  //
   655  // See documentation of Poll for error-handling information.
   656  func (op *DeleteTagKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
   657  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   658  	var resp resourcemanagerpb.TagKey
   659  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   660  		return nil, err
   661  	}
   662  	return &resp, nil
   663  }
   664  
   665  // Poll fetches the latest state of the long-running operation.
   666  //
   667  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   668  //
   669  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   670  // the operation has completed with failure, the error is returned and op.Done will return true.
   671  // If Poll succeeds and the operation has completed successfully,
   672  // op.Done will return true, and the response of the operation is returned.
   673  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   674  func (op *DeleteTagKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
   675  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   676  	var resp resourcemanagerpb.TagKey
   677  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   678  		return nil, err
   679  	}
   680  	if !op.Done() {
   681  		return nil, nil
   682  	}
   683  	return &resp, nil
   684  }
   685  
   686  // Metadata returns metadata associated with the long-running operation.
   687  // Metadata itself does not contact the server, but Poll does.
   688  // To get the latest metadata, call this method after a successful call to Poll.
   689  // If the metadata is not available, the returned metadata and error are both nil.
   690  func (op *DeleteTagKeyOperation) Metadata() (*resourcemanagerpb.DeleteTagKeyMetadata, error) {
   691  	var meta resourcemanagerpb.DeleteTagKeyMetadata
   692  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   693  		return nil, nil
   694  	} else if err != nil {
   695  		return nil, err
   696  	}
   697  	return &meta, nil
   698  }
   699  
   700  // Done reports whether the long-running operation has completed.
   701  func (op *DeleteTagKeyOperation) Done() bool {
   702  	return op.lro.Done()
   703  }
   704  
   705  // Name returns the name of the long-running operation.
   706  // The name is assigned by the server and is unique within the service from which the operation is created.
   707  func (op *DeleteTagKeyOperation) Name() string {
   708  	return op.lro.Name()
   709  }
   710  
   711  // DeleteTagValueOperation manages a long-running operation from DeleteTagValue.
   712  type DeleteTagValueOperation struct {
   713  	lro      *longrunning.Operation
   714  	pollPath string
   715  }
   716  
   717  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   718  //
   719  // See documentation of Poll for error-handling information.
   720  func (op *DeleteTagValueOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
   721  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   722  	var resp resourcemanagerpb.TagValue
   723  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   724  		return nil, err
   725  	}
   726  	return &resp, nil
   727  }
   728  
   729  // Poll fetches the latest state of the long-running operation.
   730  //
   731  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   732  //
   733  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   734  // the operation has completed with failure, the error is returned and op.Done will return true.
   735  // If Poll succeeds and the operation has completed successfully,
   736  // op.Done will return true, and the response of the operation is returned.
   737  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   738  func (op *DeleteTagValueOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
   739  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   740  	var resp resourcemanagerpb.TagValue
   741  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   742  		return nil, err
   743  	}
   744  	if !op.Done() {
   745  		return nil, nil
   746  	}
   747  	return &resp, nil
   748  }
   749  
   750  // Metadata returns metadata associated with the long-running operation.
   751  // Metadata itself does not contact the server, but Poll does.
   752  // To get the latest metadata, call this method after a successful call to Poll.
   753  // If the metadata is not available, the returned metadata and error are both nil.
   754  func (op *DeleteTagValueOperation) Metadata() (*resourcemanagerpb.DeleteTagValueMetadata, error) {
   755  	var meta resourcemanagerpb.DeleteTagValueMetadata
   756  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   757  		return nil, nil
   758  	} else if err != nil {
   759  		return nil, err
   760  	}
   761  	return &meta, nil
   762  }
   763  
   764  // Done reports whether the long-running operation has completed.
   765  func (op *DeleteTagValueOperation) Done() bool {
   766  	return op.lro.Done()
   767  }
   768  
   769  // Name returns the name of the long-running operation.
   770  // The name is assigned by the server and is unique within the service from which the operation is created.
   771  func (op *DeleteTagValueOperation) Name() string {
   772  	return op.lro.Name()
   773  }
   774  
   775  // MoveFolderOperation manages a long-running operation from MoveFolder.
   776  type MoveFolderOperation struct {
   777  	lro      *longrunning.Operation
   778  	pollPath string
   779  }
   780  
   781  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   782  //
   783  // See documentation of Poll for error-handling information.
   784  func (op *MoveFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   785  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   786  	var resp resourcemanagerpb.Folder
   787  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   788  		return nil, err
   789  	}
   790  	return &resp, nil
   791  }
   792  
   793  // Poll fetches the latest state of the long-running operation.
   794  //
   795  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   796  //
   797  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   798  // the operation has completed with failure, the error is returned and op.Done will return true.
   799  // If Poll succeeds and the operation has completed successfully,
   800  // op.Done will return true, and the response of the operation is returned.
   801  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   802  func (op *MoveFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   803  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   804  	var resp resourcemanagerpb.Folder
   805  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   806  		return nil, err
   807  	}
   808  	if !op.Done() {
   809  		return nil, nil
   810  	}
   811  	return &resp, nil
   812  }
   813  
   814  // Metadata returns metadata associated with the long-running operation.
   815  // Metadata itself does not contact the server, but Poll does.
   816  // To get the latest metadata, call this method after a successful call to Poll.
   817  // If the metadata is not available, the returned metadata and error are both nil.
   818  func (op *MoveFolderOperation) Metadata() (*resourcemanagerpb.MoveFolderMetadata, error) {
   819  	var meta resourcemanagerpb.MoveFolderMetadata
   820  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   821  		return nil, nil
   822  	} else if err != nil {
   823  		return nil, err
   824  	}
   825  	return &meta, nil
   826  }
   827  
   828  // Done reports whether the long-running operation has completed.
   829  func (op *MoveFolderOperation) Done() bool {
   830  	return op.lro.Done()
   831  }
   832  
   833  // Name returns the name of the long-running operation.
   834  // The name is assigned by the server and is unique within the service from which the operation is created.
   835  func (op *MoveFolderOperation) Name() string {
   836  	return op.lro.Name()
   837  }
   838  
   839  // MoveProjectOperation manages a long-running operation from MoveProject.
   840  type MoveProjectOperation struct {
   841  	lro      *longrunning.Operation
   842  	pollPath string
   843  }
   844  
   845  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   846  //
   847  // See documentation of Poll for error-handling information.
   848  func (op *MoveProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   849  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   850  	var resp resourcemanagerpb.Project
   851  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   852  		return nil, err
   853  	}
   854  	return &resp, nil
   855  }
   856  
   857  // Poll fetches the latest state of the long-running operation.
   858  //
   859  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   860  //
   861  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   862  // the operation has completed with failure, the error is returned and op.Done will return true.
   863  // If Poll succeeds and the operation has completed successfully,
   864  // op.Done will return true, and the response of the operation is returned.
   865  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   866  func (op *MoveProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   867  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   868  	var resp resourcemanagerpb.Project
   869  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   870  		return nil, err
   871  	}
   872  	if !op.Done() {
   873  		return nil, nil
   874  	}
   875  	return &resp, nil
   876  }
   877  
   878  // Metadata returns metadata associated with the long-running operation.
   879  // Metadata itself does not contact the server, but Poll does.
   880  // To get the latest metadata, call this method after a successful call to Poll.
   881  // If the metadata is not available, the returned metadata and error are both nil.
   882  func (op *MoveProjectOperation) Metadata() (*resourcemanagerpb.MoveProjectMetadata, error) {
   883  	var meta resourcemanagerpb.MoveProjectMetadata
   884  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   885  		return nil, nil
   886  	} else if err != nil {
   887  		return nil, err
   888  	}
   889  	return &meta, nil
   890  }
   891  
   892  // Done reports whether the long-running operation has completed.
   893  func (op *MoveProjectOperation) Done() bool {
   894  	return op.lro.Done()
   895  }
   896  
   897  // Name returns the name of the long-running operation.
   898  // The name is assigned by the server and is unique within the service from which the operation is created.
   899  func (op *MoveProjectOperation) Name() string {
   900  	return op.lro.Name()
   901  }
   902  
   903  // UndeleteFolderOperation manages a long-running operation from UndeleteFolder.
   904  type UndeleteFolderOperation struct {
   905  	lro      *longrunning.Operation
   906  	pollPath string
   907  }
   908  
   909  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   910  //
   911  // See documentation of Poll for error-handling information.
   912  func (op *UndeleteFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   913  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   914  	var resp resourcemanagerpb.Folder
   915  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   916  		return nil, err
   917  	}
   918  	return &resp, nil
   919  }
   920  
   921  // Poll fetches the latest state of the long-running operation.
   922  //
   923  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   924  //
   925  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   926  // the operation has completed with failure, the error is returned and op.Done will return true.
   927  // If Poll succeeds and the operation has completed successfully,
   928  // op.Done will return true, and the response of the operation is returned.
   929  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   930  func (op *UndeleteFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
   931  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   932  	var resp resourcemanagerpb.Folder
   933  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   934  		return nil, err
   935  	}
   936  	if !op.Done() {
   937  		return nil, nil
   938  	}
   939  	return &resp, nil
   940  }
   941  
   942  // Metadata returns metadata associated with the long-running operation.
   943  // Metadata itself does not contact the server, but Poll does.
   944  // To get the latest metadata, call this method after a successful call to Poll.
   945  // If the metadata is not available, the returned metadata and error are both nil.
   946  func (op *UndeleteFolderOperation) Metadata() (*resourcemanagerpb.UndeleteFolderMetadata, error) {
   947  	var meta resourcemanagerpb.UndeleteFolderMetadata
   948  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
   949  		return nil, nil
   950  	} else if err != nil {
   951  		return nil, err
   952  	}
   953  	return &meta, nil
   954  }
   955  
   956  // Done reports whether the long-running operation has completed.
   957  func (op *UndeleteFolderOperation) Done() bool {
   958  	return op.lro.Done()
   959  }
   960  
   961  // Name returns the name of the long-running operation.
   962  // The name is assigned by the server and is unique within the service from which the operation is created.
   963  func (op *UndeleteFolderOperation) Name() string {
   964  	return op.lro.Name()
   965  }
   966  
   967  // UndeleteProjectOperation manages a long-running operation from UndeleteProject.
   968  type UndeleteProjectOperation struct {
   969  	lro      *longrunning.Operation
   970  	pollPath string
   971  }
   972  
   973  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
   974  //
   975  // See documentation of Poll for error-handling information.
   976  func (op *UndeleteProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   977  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   978  	var resp resourcemanagerpb.Project
   979  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
   980  		return nil, err
   981  	}
   982  	return &resp, nil
   983  }
   984  
   985  // Poll fetches the latest state of the long-running operation.
   986  //
   987  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
   988  //
   989  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
   990  // the operation has completed with failure, the error is returned and op.Done will return true.
   991  // If Poll succeeds and the operation has completed successfully,
   992  // op.Done will return true, and the response of the operation is returned.
   993  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
   994  func (op *UndeleteProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
   995  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
   996  	var resp resourcemanagerpb.Project
   997  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
   998  		return nil, err
   999  	}
  1000  	if !op.Done() {
  1001  		return nil, nil
  1002  	}
  1003  	return &resp, nil
  1004  }
  1005  
  1006  // Metadata returns metadata associated with the long-running operation.
  1007  // Metadata itself does not contact the server, but Poll does.
  1008  // To get the latest metadata, call this method after a successful call to Poll.
  1009  // If the metadata is not available, the returned metadata and error are both nil.
  1010  func (op *UndeleteProjectOperation) Metadata() (*resourcemanagerpb.UndeleteProjectMetadata, error) {
  1011  	var meta resourcemanagerpb.UndeleteProjectMetadata
  1012  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
  1013  		return nil, nil
  1014  	} else if err != nil {
  1015  		return nil, err
  1016  	}
  1017  	return &meta, nil
  1018  }
  1019  
  1020  // Done reports whether the long-running operation has completed.
  1021  func (op *UndeleteProjectOperation) Done() bool {
  1022  	return op.lro.Done()
  1023  }
  1024  
  1025  // Name returns the name of the long-running operation.
  1026  // The name is assigned by the server and is unique within the service from which the operation is created.
  1027  func (op *UndeleteProjectOperation) Name() string {
  1028  	return op.lro.Name()
  1029  }
  1030  
  1031  // UpdateFolderOperation manages a long-running operation from UpdateFolder.
  1032  type UpdateFolderOperation struct {
  1033  	lro      *longrunning.Operation
  1034  	pollPath string
  1035  }
  1036  
  1037  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
  1038  //
  1039  // See documentation of Poll for error-handling information.
  1040  func (op *UpdateFolderOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
  1041  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1042  	var resp resourcemanagerpb.Folder
  1043  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
  1044  		return nil, err
  1045  	}
  1046  	return &resp, nil
  1047  }
  1048  
  1049  // Poll fetches the latest state of the long-running operation.
  1050  //
  1051  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
  1052  //
  1053  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
  1054  // the operation has completed with failure, the error is returned and op.Done will return true.
  1055  // If Poll succeeds and the operation has completed successfully,
  1056  // op.Done will return true, and the response of the operation is returned.
  1057  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
  1058  func (op *UpdateFolderOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Folder, error) {
  1059  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1060  	var resp resourcemanagerpb.Folder
  1061  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
  1062  		return nil, err
  1063  	}
  1064  	if !op.Done() {
  1065  		return nil, nil
  1066  	}
  1067  	return &resp, nil
  1068  }
  1069  
  1070  // Metadata returns metadata associated with the long-running operation.
  1071  // Metadata itself does not contact the server, but Poll does.
  1072  // To get the latest metadata, call this method after a successful call to Poll.
  1073  // If the metadata is not available, the returned metadata and error are both nil.
  1074  func (op *UpdateFolderOperation) Metadata() (*resourcemanagerpb.UpdateFolderMetadata, error) {
  1075  	var meta resourcemanagerpb.UpdateFolderMetadata
  1076  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
  1077  		return nil, nil
  1078  	} else if err != nil {
  1079  		return nil, err
  1080  	}
  1081  	return &meta, nil
  1082  }
  1083  
  1084  // Done reports whether the long-running operation has completed.
  1085  func (op *UpdateFolderOperation) Done() bool {
  1086  	return op.lro.Done()
  1087  }
  1088  
  1089  // Name returns the name of the long-running operation.
  1090  // The name is assigned by the server and is unique within the service from which the operation is created.
  1091  func (op *UpdateFolderOperation) Name() string {
  1092  	return op.lro.Name()
  1093  }
  1094  
  1095  // UpdateProjectOperation manages a long-running operation from UpdateProject.
  1096  type UpdateProjectOperation struct {
  1097  	lro      *longrunning.Operation
  1098  	pollPath string
  1099  }
  1100  
  1101  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
  1102  //
  1103  // See documentation of Poll for error-handling information.
  1104  func (op *UpdateProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
  1105  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1106  	var resp resourcemanagerpb.Project
  1107  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
  1108  		return nil, err
  1109  	}
  1110  	return &resp, nil
  1111  }
  1112  
  1113  // Poll fetches the latest state of the long-running operation.
  1114  //
  1115  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
  1116  //
  1117  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
  1118  // the operation has completed with failure, the error is returned and op.Done will return true.
  1119  // If Poll succeeds and the operation has completed successfully,
  1120  // op.Done will return true, and the response of the operation is returned.
  1121  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
  1122  func (op *UpdateProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.Project, error) {
  1123  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1124  	var resp resourcemanagerpb.Project
  1125  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
  1126  		return nil, err
  1127  	}
  1128  	if !op.Done() {
  1129  		return nil, nil
  1130  	}
  1131  	return &resp, nil
  1132  }
  1133  
  1134  // Metadata returns metadata associated with the long-running operation.
  1135  // Metadata itself does not contact the server, but Poll does.
  1136  // To get the latest metadata, call this method after a successful call to Poll.
  1137  // If the metadata is not available, the returned metadata and error are both nil.
  1138  func (op *UpdateProjectOperation) Metadata() (*resourcemanagerpb.UpdateProjectMetadata, error) {
  1139  	var meta resourcemanagerpb.UpdateProjectMetadata
  1140  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
  1141  		return nil, nil
  1142  	} else if err != nil {
  1143  		return nil, err
  1144  	}
  1145  	return &meta, nil
  1146  }
  1147  
  1148  // Done reports whether the long-running operation has completed.
  1149  func (op *UpdateProjectOperation) Done() bool {
  1150  	return op.lro.Done()
  1151  }
  1152  
  1153  // Name returns the name of the long-running operation.
  1154  // The name is assigned by the server and is unique within the service from which the operation is created.
  1155  func (op *UpdateProjectOperation) Name() string {
  1156  	return op.lro.Name()
  1157  }
  1158  
  1159  // UpdateTagKeyOperation manages a long-running operation from UpdateTagKey.
  1160  type UpdateTagKeyOperation struct {
  1161  	lro      *longrunning.Operation
  1162  	pollPath string
  1163  }
  1164  
  1165  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
  1166  //
  1167  // See documentation of Poll for error-handling information.
  1168  func (op *UpdateTagKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
  1169  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1170  	var resp resourcemanagerpb.TagKey
  1171  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
  1172  		return nil, err
  1173  	}
  1174  	return &resp, nil
  1175  }
  1176  
  1177  // Poll fetches the latest state of the long-running operation.
  1178  //
  1179  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
  1180  //
  1181  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
  1182  // the operation has completed with failure, the error is returned and op.Done will return true.
  1183  // If Poll succeeds and the operation has completed successfully,
  1184  // op.Done will return true, and the response of the operation is returned.
  1185  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
  1186  func (op *UpdateTagKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagKey, error) {
  1187  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1188  	var resp resourcemanagerpb.TagKey
  1189  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
  1190  		return nil, err
  1191  	}
  1192  	if !op.Done() {
  1193  		return nil, nil
  1194  	}
  1195  	return &resp, nil
  1196  }
  1197  
  1198  // Metadata returns metadata associated with the long-running operation.
  1199  // Metadata itself does not contact the server, but Poll does.
  1200  // To get the latest metadata, call this method after a successful call to Poll.
  1201  // If the metadata is not available, the returned metadata and error are both nil.
  1202  func (op *UpdateTagKeyOperation) Metadata() (*resourcemanagerpb.UpdateTagKeyMetadata, error) {
  1203  	var meta resourcemanagerpb.UpdateTagKeyMetadata
  1204  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
  1205  		return nil, nil
  1206  	} else if err != nil {
  1207  		return nil, err
  1208  	}
  1209  	return &meta, nil
  1210  }
  1211  
  1212  // Done reports whether the long-running operation has completed.
  1213  func (op *UpdateTagKeyOperation) Done() bool {
  1214  	return op.lro.Done()
  1215  }
  1216  
  1217  // Name returns the name of the long-running operation.
  1218  // The name is assigned by the server and is unique within the service from which the operation is created.
  1219  func (op *UpdateTagKeyOperation) Name() string {
  1220  	return op.lro.Name()
  1221  }
  1222  
  1223  // UpdateTagValueOperation manages a long-running operation from UpdateTagValue.
  1224  type UpdateTagValueOperation struct {
  1225  	lro      *longrunning.Operation
  1226  	pollPath string
  1227  }
  1228  
  1229  // Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
  1230  //
  1231  // See documentation of Poll for error-handling information.
  1232  func (op *UpdateTagValueOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
  1233  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1234  	var resp resourcemanagerpb.TagValue
  1235  	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
  1236  		return nil, err
  1237  	}
  1238  	return &resp, nil
  1239  }
  1240  
  1241  // Poll fetches the latest state of the long-running operation.
  1242  //
  1243  // Poll also fetches the latest metadata, which can be retrieved by Metadata.
  1244  //
  1245  // If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
  1246  // the operation has completed with failure, the error is returned and op.Done will return true.
  1247  // If Poll succeeds and the operation has completed successfully,
  1248  // op.Done will return true, and the response of the operation is returned.
  1249  // If Poll succeeds and the operation has not completed, the returned response and error are both nil.
  1250  func (op *UpdateTagValueOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*resourcemanagerpb.TagValue, error) {
  1251  	opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)
  1252  	var resp resourcemanagerpb.TagValue
  1253  	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
  1254  		return nil, err
  1255  	}
  1256  	if !op.Done() {
  1257  		return nil, nil
  1258  	}
  1259  	return &resp, nil
  1260  }
  1261  
  1262  // Metadata returns metadata associated with the long-running operation.
  1263  // Metadata itself does not contact the server, but Poll does.
  1264  // To get the latest metadata, call this method after a successful call to Poll.
  1265  // If the metadata is not available, the returned metadata and error are both nil.
  1266  func (op *UpdateTagValueOperation) Metadata() (*resourcemanagerpb.UpdateTagValueMetadata, error) {
  1267  	var meta resourcemanagerpb.UpdateTagValueMetadata
  1268  	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
  1269  		return nil, nil
  1270  	} else if err != nil {
  1271  		return nil, err
  1272  	}
  1273  	return &meta, nil
  1274  }
  1275  
  1276  // Done reports whether the long-running operation has completed.
  1277  func (op *UpdateTagValueOperation) Done() bool {
  1278  	return op.lro.Done()
  1279  }
  1280  
  1281  // Name returns the name of the long-running operation.
  1282  // The name is assigned by the server and is unique within the service from which the operation is created.
  1283  func (op *UpdateTagValueOperation) Name() string {
  1284  	return op.lro.Name()
  1285  }
  1286  
  1287  // EffectiveTagIterator manages a stream of *resourcemanagerpb.EffectiveTag.
  1288  type EffectiveTagIterator struct {
  1289  	items    []*resourcemanagerpb.EffectiveTag
  1290  	pageInfo *iterator.PageInfo
  1291  	nextFunc func() error
  1292  
  1293  	// Response is the raw response for the current page.
  1294  	// It must be cast to the RPC response type.
  1295  	// Calling Next() or InternalFetch() updates this value.
  1296  	Response interface{}
  1297  
  1298  	// InternalFetch is for use by the Google Cloud Libraries only.
  1299  	// It is not part of the stable interface of this package.
  1300  	//
  1301  	// InternalFetch returns results from a single call to the underlying RPC.
  1302  	// The number of results is no greater than pageSize.
  1303  	// If there are no more results, nextPageToken is empty and err is nil.
  1304  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.EffectiveTag, nextPageToken string, err error)
  1305  }
  1306  
  1307  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1308  func (it *EffectiveTagIterator) PageInfo() *iterator.PageInfo {
  1309  	return it.pageInfo
  1310  }
  1311  
  1312  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1313  // results. Once Next returns Done, all subsequent calls will return Done.
  1314  func (it *EffectiveTagIterator) Next() (*resourcemanagerpb.EffectiveTag, error) {
  1315  	var item *resourcemanagerpb.EffectiveTag
  1316  	if err := it.nextFunc(); err != nil {
  1317  		return item, err
  1318  	}
  1319  	item = it.items[0]
  1320  	it.items = it.items[1:]
  1321  	return item, nil
  1322  }
  1323  
  1324  func (it *EffectiveTagIterator) bufLen() int {
  1325  	return len(it.items)
  1326  }
  1327  
  1328  func (it *EffectiveTagIterator) takeBuf() interface{} {
  1329  	b := it.items
  1330  	it.items = nil
  1331  	return b
  1332  }
  1333  
  1334  // FolderIterator manages a stream of *resourcemanagerpb.Folder.
  1335  type FolderIterator struct {
  1336  	items    []*resourcemanagerpb.Folder
  1337  	pageInfo *iterator.PageInfo
  1338  	nextFunc func() error
  1339  
  1340  	// Response is the raw response for the current page.
  1341  	// It must be cast to the RPC response type.
  1342  	// Calling Next() or InternalFetch() updates this value.
  1343  	Response interface{}
  1344  
  1345  	// InternalFetch is for use by the Google Cloud Libraries only.
  1346  	// It is not part of the stable interface of this package.
  1347  	//
  1348  	// InternalFetch returns results from a single call to the underlying RPC.
  1349  	// The number of results is no greater than pageSize.
  1350  	// If there are no more results, nextPageToken is empty and err is nil.
  1351  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.Folder, nextPageToken string, err error)
  1352  }
  1353  
  1354  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1355  func (it *FolderIterator) PageInfo() *iterator.PageInfo {
  1356  	return it.pageInfo
  1357  }
  1358  
  1359  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1360  // results. Once Next returns Done, all subsequent calls will return Done.
  1361  func (it *FolderIterator) Next() (*resourcemanagerpb.Folder, error) {
  1362  	var item *resourcemanagerpb.Folder
  1363  	if err := it.nextFunc(); err != nil {
  1364  		return item, err
  1365  	}
  1366  	item = it.items[0]
  1367  	it.items = it.items[1:]
  1368  	return item, nil
  1369  }
  1370  
  1371  func (it *FolderIterator) bufLen() int {
  1372  	return len(it.items)
  1373  }
  1374  
  1375  func (it *FolderIterator) takeBuf() interface{} {
  1376  	b := it.items
  1377  	it.items = nil
  1378  	return b
  1379  }
  1380  
  1381  // OrganizationIterator manages a stream of *resourcemanagerpb.Organization.
  1382  type OrganizationIterator struct {
  1383  	items    []*resourcemanagerpb.Organization
  1384  	pageInfo *iterator.PageInfo
  1385  	nextFunc func() error
  1386  
  1387  	// Response is the raw response for the current page.
  1388  	// It must be cast to the RPC response type.
  1389  	// Calling Next() or InternalFetch() updates this value.
  1390  	Response interface{}
  1391  
  1392  	// InternalFetch is for use by the Google Cloud Libraries only.
  1393  	// It is not part of the stable interface of this package.
  1394  	//
  1395  	// InternalFetch returns results from a single call to the underlying RPC.
  1396  	// The number of results is no greater than pageSize.
  1397  	// If there are no more results, nextPageToken is empty and err is nil.
  1398  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.Organization, nextPageToken string, err error)
  1399  }
  1400  
  1401  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1402  func (it *OrganizationIterator) PageInfo() *iterator.PageInfo {
  1403  	return it.pageInfo
  1404  }
  1405  
  1406  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1407  // results. Once Next returns Done, all subsequent calls will return Done.
  1408  func (it *OrganizationIterator) Next() (*resourcemanagerpb.Organization, error) {
  1409  	var item *resourcemanagerpb.Organization
  1410  	if err := it.nextFunc(); err != nil {
  1411  		return item, err
  1412  	}
  1413  	item = it.items[0]
  1414  	it.items = it.items[1:]
  1415  	return item, nil
  1416  }
  1417  
  1418  func (it *OrganizationIterator) bufLen() int {
  1419  	return len(it.items)
  1420  }
  1421  
  1422  func (it *OrganizationIterator) takeBuf() interface{} {
  1423  	b := it.items
  1424  	it.items = nil
  1425  	return b
  1426  }
  1427  
  1428  // ProjectIterator manages a stream of *resourcemanagerpb.Project.
  1429  type ProjectIterator struct {
  1430  	items    []*resourcemanagerpb.Project
  1431  	pageInfo *iterator.PageInfo
  1432  	nextFunc func() error
  1433  
  1434  	// Response is the raw response for the current page.
  1435  	// It must be cast to the RPC response type.
  1436  	// Calling Next() or InternalFetch() updates this value.
  1437  	Response interface{}
  1438  
  1439  	// InternalFetch is for use by the Google Cloud Libraries only.
  1440  	// It is not part of the stable interface of this package.
  1441  	//
  1442  	// InternalFetch returns results from a single call to the underlying RPC.
  1443  	// The number of results is no greater than pageSize.
  1444  	// If there are no more results, nextPageToken is empty and err is nil.
  1445  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.Project, nextPageToken string, err error)
  1446  }
  1447  
  1448  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1449  func (it *ProjectIterator) PageInfo() *iterator.PageInfo {
  1450  	return it.pageInfo
  1451  }
  1452  
  1453  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1454  // results. Once Next returns Done, all subsequent calls will return Done.
  1455  func (it *ProjectIterator) Next() (*resourcemanagerpb.Project, error) {
  1456  	var item *resourcemanagerpb.Project
  1457  	if err := it.nextFunc(); err != nil {
  1458  		return item, err
  1459  	}
  1460  	item = it.items[0]
  1461  	it.items = it.items[1:]
  1462  	return item, nil
  1463  }
  1464  
  1465  func (it *ProjectIterator) bufLen() int {
  1466  	return len(it.items)
  1467  }
  1468  
  1469  func (it *ProjectIterator) takeBuf() interface{} {
  1470  	b := it.items
  1471  	it.items = nil
  1472  	return b
  1473  }
  1474  
  1475  // TagBindingIterator manages a stream of *resourcemanagerpb.TagBinding.
  1476  type TagBindingIterator struct {
  1477  	items    []*resourcemanagerpb.TagBinding
  1478  	pageInfo *iterator.PageInfo
  1479  	nextFunc func() error
  1480  
  1481  	// Response is the raw response for the current page.
  1482  	// It must be cast to the RPC response type.
  1483  	// Calling Next() or InternalFetch() updates this value.
  1484  	Response interface{}
  1485  
  1486  	// InternalFetch is for use by the Google Cloud Libraries only.
  1487  	// It is not part of the stable interface of this package.
  1488  	//
  1489  	// InternalFetch returns results from a single call to the underlying RPC.
  1490  	// The number of results is no greater than pageSize.
  1491  	// If there are no more results, nextPageToken is empty and err is nil.
  1492  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.TagBinding, nextPageToken string, err error)
  1493  }
  1494  
  1495  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1496  func (it *TagBindingIterator) PageInfo() *iterator.PageInfo {
  1497  	return it.pageInfo
  1498  }
  1499  
  1500  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1501  // results. Once Next returns Done, all subsequent calls will return Done.
  1502  func (it *TagBindingIterator) Next() (*resourcemanagerpb.TagBinding, error) {
  1503  	var item *resourcemanagerpb.TagBinding
  1504  	if err := it.nextFunc(); err != nil {
  1505  		return item, err
  1506  	}
  1507  	item = it.items[0]
  1508  	it.items = it.items[1:]
  1509  	return item, nil
  1510  }
  1511  
  1512  func (it *TagBindingIterator) bufLen() int {
  1513  	return len(it.items)
  1514  }
  1515  
  1516  func (it *TagBindingIterator) takeBuf() interface{} {
  1517  	b := it.items
  1518  	it.items = nil
  1519  	return b
  1520  }
  1521  
  1522  // TagHoldIterator manages a stream of *resourcemanagerpb.TagHold.
  1523  type TagHoldIterator struct {
  1524  	items    []*resourcemanagerpb.TagHold
  1525  	pageInfo *iterator.PageInfo
  1526  	nextFunc func() error
  1527  
  1528  	// Response is the raw response for the current page.
  1529  	// It must be cast to the RPC response type.
  1530  	// Calling Next() or InternalFetch() updates this value.
  1531  	Response interface{}
  1532  
  1533  	// InternalFetch is for use by the Google Cloud Libraries only.
  1534  	// It is not part of the stable interface of this package.
  1535  	//
  1536  	// InternalFetch returns results from a single call to the underlying RPC.
  1537  	// The number of results is no greater than pageSize.
  1538  	// If there are no more results, nextPageToken is empty and err is nil.
  1539  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.TagHold, nextPageToken string, err error)
  1540  }
  1541  
  1542  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1543  func (it *TagHoldIterator) PageInfo() *iterator.PageInfo {
  1544  	return it.pageInfo
  1545  }
  1546  
  1547  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1548  // results. Once Next returns Done, all subsequent calls will return Done.
  1549  func (it *TagHoldIterator) Next() (*resourcemanagerpb.TagHold, error) {
  1550  	var item *resourcemanagerpb.TagHold
  1551  	if err := it.nextFunc(); err != nil {
  1552  		return item, err
  1553  	}
  1554  	item = it.items[0]
  1555  	it.items = it.items[1:]
  1556  	return item, nil
  1557  }
  1558  
  1559  func (it *TagHoldIterator) bufLen() int {
  1560  	return len(it.items)
  1561  }
  1562  
  1563  func (it *TagHoldIterator) takeBuf() interface{} {
  1564  	b := it.items
  1565  	it.items = nil
  1566  	return b
  1567  }
  1568  
  1569  // TagKeyIterator manages a stream of *resourcemanagerpb.TagKey.
  1570  type TagKeyIterator struct {
  1571  	items    []*resourcemanagerpb.TagKey
  1572  	pageInfo *iterator.PageInfo
  1573  	nextFunc func() error
  1574  
  1575  	// Response is the raw response for the current page.
  1576  	// It must be cast to the RPC response type.
  1577  	// Calling Next() or InternalFetch() updates this value.
  1578  	Response interface{}
  1579  
  1580  	// InternalFetch is for use by the Google Cloud Libraries only.
  1581  	// It is not part of the stable interface of this package.
  1582  	//
  1583  	// InternalFetch returns results from a single call to the underlying RPC.
  1584  	// The number of results is no greater than pageSize.
  1585  	// If there are no more results, nextPageToken is empty and err is nil.
  1586  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.TagKey, nextPageToken string, err error)
  1587  }
  1588  
  1589  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1590  func (it *TagKeyIterator) PageInfo() *iterator.PageInfo {
  1591  	return it.pageInfo
  1592  }
  1593  
  1594  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1595  // results. Once Next returns Done, all subsequent calls will return Done.
  1596  func (it *TagKeyIterator) Next() (*resourcemanagerpb.TagKey, error) {
  1597  	var item *resourcemanagerpb.TagKey
  1598  	if err := it.nextFunc(); err != nil {
  1599  		return item, err
  1600  	}
  1601  	item = it.items[0]
  1602  	it.items = it.items[1:]
  1603  	return item, nil
  1604  }
  1605  
  1606  func (it *TagKeyIterator) bufLen() int {
  1607  	return len(it.items)
  1608  }
  1609  
  1610  func (it *TagKeyIterator) takeBuf() interface{} {
  1611  	b := it.items
  1612  	it.items = nil
  1613  	return b
  1614  }
  1615  
  1616  // TagValueIterator manages a stream of *resourcemanagerpb.TagValue.
  1617  type TagValueIterator struct {
  1618  	items    []*resourcemanagerpb.TagValue
  1619  	pageInfo *iterator.PageInfo
  1620  	nextFunc func() error
  1621  
  1622  	// Response is the raw response for the current page.
  1623  	// It must be cast to the RPC response type.
  1624  	// Calling Next() or InternalFetch() updates this value.
  1625  	Response interface{}
  1626  
  1627  	// InternalFetch is for use by the Google Cloud Libraries only.
  1628  	// It is not part of the stable interface of this package.
  1629  	//
  1630  	// InternalFetch returns results from a single call to the underlying RPC.
  1631  	// The number of results is no greater than pageSize.
  1632  	// If there are no more results, nextPageToken is empty and err is nil.
  1633  	InternalFetch func(pageSize int, pageToken string) (results []*resourcemanagerpb.TagValue, nextPageToken string, err error)
  1634  }
  1635  
  1636  // PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
  1637  func (it *TagValueIterator) PageInfo() *iterator.PageInfo {
  1638  	return it.pageInfo
  1639  }
  1640  
  1641  // Next returns the next result. Its second return value is iterator.Done if there are no more
  1642  // results. Once Next returns Done, all subsequent calls will return Done.
  1643  func (it *TagValueIterator) Next() (*resourcemanagerpb.TagValue, error) {
  1644  	var item *resourcemanagerpb.TagValue
  1645  	if err := it.nextFunc(); err != nil {
  1646  		return item, err
  1647  	}
  1648  	item = it.items[0]
  1649  	it.items = it.items[1:]
  1650  	return item, nil
  1651  }
  1652  
  1653  func (it *TagValueIterator) bufLen() int {
  1654  	return len(it.items)
  1655  }
  1656  
  1657  func (it *TagValueIterator) takeBuf() interface{} {
  1658  	b := it.items
  1659  	it.items = nil
  1660  	return b
  1661  }
  1662  

View as plain text