...

Source file src/cloud.google.com/go/bigquery/analyticshub/apiv1/analytics_hub_client_example_test.go

Documentation: cloud.google.com/go/bigquery/analyticshub/apiv1

     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 analyticshub_test
    18  
    19  import (
    20  	"context"
    21  
    22  	analyticshub "cloud.google.com/go/bigquery/analyticshub/apiv1"
    23  	analyticshubpb "cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb"
    24  	iampb "cloud.google.com/go/iam/apiv1/iampb"
    25  	"google.golang.org/api/iterator"
    26  )
    27  
    28  func ExampleNewClient() {
    29  	ctx := context.Background()
    30  	// This snippet has been automatically generated and should be regarded as a code template only.
    31  	// It will require modifications to work:
    32  	// - It may require correct/in-range values for request initialization.
    33  	// - It may require specifying regional endpoints when creating the service client as shown in:
    34  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    35  	c, err := analyticshub.NewClient(ctx)
    36  	if err != nil {
    37  		// TODO: Handle error.
    38  	}
    39  	defer c.Close()
    40  
    41  	// TODO: Use client.
    42  	_ = c
    43  }
    44  
    45  func ExampleNewRESTClient() {
    46  	ctx := context.Background()
    47  	// This snippet has been automatically generated and should be regarded as a code template only.
    48  	// It will require modifications to work:
    49  	// - It may require correct/in-range values for request initialization.
    50  	// - It may require specifying regional endpoints when creating the service client as shown in:
    51  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    52  	c, err := analyticshub.NewRESTClient(ctx)
    53  	if err != nil {
    54  		// TODO: Handle error.
    55  	}
    56  	defer c.Close()
    57  
    58  	// TODO: Use client.
    59  	_ = c
    60  }
    61  
    62  func ExampleClient_CreateDataExchange() {
    63  	ctx := context.Background()
    64  	// This snippet has been automatically generated and should be regarded as a code template only.
    65  	// It will require modifications to work:
    66  	// - It may require correct/in-range values for request initialization.
    67  	// - It may require specifying regional endpoints when creating the service client as shown in:
    68  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    69  	c, err := analyticshub.NewClient(ctx)
    70  	if err != nil {
    71  		// TODO: Handle error.
    72  	}
    73  	defer c.Close()
    74  
    75  	req := &analyticshubpb.CreateDataExchangeRequest{
    76  		// TODO: Fill request struct fields.
    77  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#CreateDataExchangeRequest.
    78  	}
    79  	resp, err := c.CreateDataExchange(ctx, req)
    80  	if err != nil {
    81  		// TODO: Handle error.
    82  	}
    83  	// TODO: Use resp.
    84  	_ = resp
    85  }
    86  
    87  func ExampleClient_CreateListing() {
    88  	ctx := context.Background()
    89  	// This snippet has been automatically generated and should be regarded as a code template only.
    90  	// It will require modifications to work:
    91  	// - It may require correct/in-range values for request initialization.
    92  	// - It may require specifying regional endpoints when creating the service client as shown in:
    93  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    94  	c, err := analyticshub.NewClient(ctx)
    95  	if err != nil {
    96  		// TODO: Handle error.
    97  	}
    98  	defer c.Close()
    99  
   100  	req := &analyticshubpb.CreateListingRequest{
   101  		// TODO: Fill request struct fields.
   102  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#CreateListingRequest.
   103  	}
   104  	resp, err := c.CreateListing(ctx, req)
   105  	if err != nil {
   106  		// TODO: Handle error.
   107  	}
   108  	// TODO: Use resp.
   109  	_ = resp
   110  }
   111  
   112  func ExampleClient_DeleteDataExchange() {
   113  	ctx := context.Background()
   114  	// This snippet has been automatically generated and should be regarded as a code template only.
   115  	// It will require modifications to work:
   116  	// - It may require correct/in-range values for request initialization.
   117  	// - It may require specifying regional endpoints when creating the service client as shown in:
   118  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   119  	c, err := analyticshub.NewClient(ctx)
   120  	if err != nil {
   121  		// TODO: Handle error.
   122  	}
   123  	defer c.Close()
   124  
   125  	req := &analyticshubpb.DeleteDataExchangeRequest{
   126  		// TODO: Fill request struct fields.
   127  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#DeleteDataExchangeRequest.
   128  	}
   129  	err = c.DeleteDataExchange(ctx, req)
   130  	if err != nil {
   131  		// TODO: Handle error.
   132  	}
   133  }
   134  
   135  func ExampleClient_DeleteListing() {
   136  	ctx := context.Background()
   137  	// This snippet has been automatically generated and should be regarded as a code template only.
   138  	// It will require modifications to work:
   139  	// - It may require correct/in-range values for request initialization.
   140  	// - It may require specifying regional endpoints when creating the service client as shown in:
   141  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   142  	c, err := analyticshub.NewClient(ctx)
   143  	if err != nil {
   144  		// TODO: Handle error.
   145  	}
   146  	defer c.Close()
   147  
   148  	req := &analyticshubpb.DeleteListingRequest{
   149  		// TODO: Fill request struct fields.
   150  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#DeleteListingRequest.
   151  	}
   152  	err = c.DeleteListing(ctx, req)
   153  	if err != nil {
   154  		// TODO: Handle error.
   155  	}
   156  }
   157  
   158  func ExampleClient_DeleteSubscription() {
   159  	ctx := context.Background()
   160  	// This snippet has been automatically generated and should be regarded as a code template only.
   161  	// It will require modifications to work:
   162  	// - It may require correct/in-range values for request initialization.
   163  	// - It may require specifying regional endpoints when creating the service client as shown in:
   164  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   165  	c, err := analyticshub.NewClient(ctx)
   166  	if err != nil {
   167  		// TODO: Handle error.
   168  	}
   169  	defer c.Close()
   170  
   171  	req := &analyticshubpb.DeleteSubscriptionRequest{
   172  		// TODO: Fill request struct fields.
   173  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#DeleteSubscriptionRequest.
   174  	}
   175  	op, err := c.DeleteSubscription(ctx, req)
   176  	if err != nil {
   177  		// TODO: Handle error.
   178  	}
   179  
   180  	err = op.Wait(ctx)
   181  	if err != nil {
   182  		// TODO: Handle error.
   183  	}
   184  }
   185  
   186  func ExampleClient_GetDataExchange() {
   187  	ctx := context.Background()
   188  	// This snippet has been automatically generated and should be regarded as a code template only.
   189  	// It will require modifications to work:
   190  	// - It may require correct/in-range values for request initialization.
   191  	// - It may require specifying regional endpoints when creating the service client as shown in:
   192  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   193  	c, err := analyticshub.NewClient(ctx)
   194  	if err != nil {
   195  		// TODO: Handle error.
   196  	}
   197  	defer c.Close()
   198  
   199  	req := &analyticshubpb.GetDataExchangeRequest{
   200  		// TODO: Fill request struct fields.
   201  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#GetDataExchangeRequest.
   202  	}
   203  	resp, err := c.GetDataExchange(ctx, req)
   204  	if err != nil {
   205  		// TODO: Handle error.
   206  	}
   207  	// TODO: Use resp.
   208  	_ = resp
   209  }
   210  
   211  func ExampleClient_GetIamPolicy() {
   212  	ctx := context.Background()
   213  	// This snippet has been automatically generated and should be regarded as a code template only.
   214  	// It will require modifications to work:
   215  	// - It may require correct/in-range values for request initialization.
   216  	// - It may require specifying regional endpoints when creating the service client as shown in:
   217  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   218  	c, err := analyticshub.NewClient(ctx)
   219  	if err != nil {
   220  		// TODO: Handle error.
   221  	}
   222  	defer c.Close()
   223  
   224  	req := &iampb.GetIamPolicyRequest{
   225  		// TODO: Fill request struct fields.
   226  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
   227  	}
   228  	resp, err := c.GetIamPolicy(ctx, req)
   229  	if err != nil {
   230  		// TODO: Handle error.
   231  	}
   232  	// TODO: Use resp.
   233  	_ = resp
   234  }
   235  
   236  func ExampleClient_GetListing() {
   237  	ctx := context.Background()
   238  	// This snippet has been automatically generated and should be regarded as a code template only.
   239  	// It will require modifications to work:
   240  	// - It may require correct/in-range values for request initialization.
   241  	// - It may require specifying regional endpoints when creating the service client as shown in:
   242  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   243  	c, err := analyticshub.NewClient(ctx)
   244  	if err != nil {
   245  		// TODO: Handle error.
   246  	}
   247  	defer c.Close()
   248  
   249  	req := &analyticshubpb.GetListingRequest{
   250  		// TODO: Fill request struct fields.
   251  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#GetListingRequest.
   252  	}
   253  	resp, err := c.GetListing(ctx, req)
   254  	if err != nil {
   255  		// TODO: Handle error.
   256  	}
   257  	// TODO: Use resp.
   258  	_ = resp
   259  }
   260  
   261  func ExampleClient_GetSubscription() {
   262  	ctx := context.Background()
   263  	// This snippet has been automatically generated and should be regarded as a code template only.
   264  	// It will require modifications to work:
   265  	// - It may require correct/in-range values for request initialization.
   266  	// - It may require specifying regional endpoints when creating the service client as shown in:
   267  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   268  	c, err := analyticshub.NewClient(ctx)
   269  	if err != nil {
   270  		// TODO: Handle error.
   271  	}
   272  	defer c.Close()
   273  
   274  	req := &analyticshubpb.GetSubscriptionRequest{
   275  		// TODO: Fill request struct fields.
   276  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#GetSubscriptionRequest.
   277  	}
   278  	resp, err := c.GetSubscription(ctx, req)
   279  	if err != nil {
   280  		// TODO: Handle error.
   281  	}
   282  	// TODO: Use resp.
   283  	_ = resp
   284  }
   285  
   286  func ExampleClient_ListDataExchanges() {
   287  	ctx := context.Background()
   288  	// This snippet has been automatically generated and should be regarded as a code template only.
   289  	// It will require modifications to work:
   290  	// - It may require correct/in-range values for request initialization.
   291  	// - It may require specifying regional endpoints when creating the service client as shown in:
   292  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   293  	c, err := analyticshub.NewClient(ctx)
   294  	if err != nil {
   295  		// TODO: Handle error.
   296  	}
   297  	defer c.Close()
   298  
   299  	req := &analyticshubpb.ListDataExchangesRequest{
   300  		// TODO: Fill request struct fields.
   301  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListDataExchangesRequest.
   302  	}
   303  	it := c.ListDataExchanges(ctx, req)
   304  	for {
   305  		resp, err := it.Next()
   306  		if err == iterator.Done {
   307  			break
   308  		}
   309  		if err != nil {
   310  			// TODO: Handle error.
   311  		}
   312  		// TODO: Use resp.
   313  		_ = resp
   314  
   315  		// If you need to access the underlying RPC response,
   316  		// you can do so by casting the `Response` as below.
   317  		// Otherwise, remove this line. Only populated after
   318  		// first call to Next(). Not safe for concurrent access.
   319  		_ = it.Response.(*analyticshubpb.ListDataExchangesResponse)
   320  	}
   321  }
   322  
   323  func ExampleClient_ListListings() {
   324  	ctx := context.Background()
   325  	// This snippet has been automatically generated and should be regarded as a code template only.
   326  	// It will require modifications to work:
   327  	// - It may require correct/in-range values for request initialization.
   328  	// - It may require specifying regional endpoints when creating the service client as shown in:
   329  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   330  	c, err := analyticshub.NewClient(ctx)
   331  	if err != nil {
   332  		// TODO: Handle error.
   333  	}
   334  	defer c.Close()
   335  
   336  	req := &analyticshubpb.ListListingsRequest{
   337  		// TODO: Fill request struct fields.
   338  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListListingsRequest.
   339  	}
   340  	it := c.ListListings(ctx, req)
   341  	for {
   342  		resp, err := it.Next()
   343  		if err == iterator.Done {
   344  			break
   345  		}
   346  		if err != nil {
   347  			// TODO: Handle error.
   348  		}
   349  		// TODO: Use resp.
   350  		_ = resp
   351  
   352  		// If you need to access the underlying RPC response,
   353  		// you can do so by casting the `Response` as below.
   354  		// Otherwise, remove this line. Only populated after
   355  		// first call to Next(). Not safe for concurrent access.
   356  		_ = it.Response.(*analyticshubpb.ListListingsResponse)
   357  	}
   358  }
   359  
   360  func ExampleClient_ListOrgDataExchanges() {
   361  	ctx := context.Background()
   362  	// This snippet has been automatically generated and should be regarded as a code template only.
   363  	// It will require modifications to work:
   364  	// - It may require correct/in-range values for request initialization.
   365  	// - It may require specifying regional endpoints when creating the service client as shown in:
   366  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   367  	c, err := analyticshub.NewClient(ctx)
   368  	if err != nil {
   369  		// TODO: Handle error.
   370  	}
   371  	defer c.Close()
   372  
   373  	req := &analyticshubpb.ListOrgDataExchangesRequest{
   374  		// TODO: Fill request struct fields.
   375  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListOrgDataExchangesRequest.
   376  	}
   377  	it := c.ListOrgDataExchanges(ctx, req)
   378  	for {
   379  		resp, err := it.Next()
   380  		if err == iterator.Done {
   381  			break
   382  		}
   383  		if err != nil {
   384  			// TODO: Handle error.
   385  		}
   386  		// TODO: Use resp.
   387  		_ = resp
   388  
   389  		// If you need to access the underlying RPC response,
   390  		// you can do so by casting the `Response` as below.
   391  		// Otherwise, remove this line. Only populated after
   392  		// first call to Next(). Not safe for concurrent access.
   393  		_ = it.Response.(*analyticshubpb.ListOrgDataExchangesResponse)
   394  	}
   395  }
   396  
   397  func ExampleClient_ListSharedResourceSubscriptions() {
   398  	ctx := context.Background()
   399  	// This snippet has been automatically generated and should be regarded as a code template only.
   400  	// It will require modifications to work:
   401  	// - It may require correct/in-range values for request initialization.
   402  	// - It may require specifying regional endpoints when creating the service client as shown in:
   403  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   404  	c, err := analyticshub.NewClient(ctx)
   405  	if err != nil {
   406  		// TODO: Handle error.
   407  	}
   408  	defer c.Close()
   409  
   410  	req := &analyticshubpb.ListSharedResourceSubscriptionsRequest{
   411  		// TODO: Fill request struct fields.
   412  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListSharedResourceSubscriptionsRequest.
   413  	}
   414  	it := c.ListSharedResourceSubscriptions(ctx, req)
   415  	for {
   416  		resp, err := it.Next()
   417  		if err == iterator.Done {
   418  			break
   419  		}
   420  		if err != nil {
   421  			// TODO: Handle error.
   422  		}
   423  		// TODO: Use resp.
   424  		_ = resp
   425  
   426  		// If you need to access the underlying RPC response,
   427  		// you can do so by casting the `Response` as below.
   428  		// Otherwise, remove this line. Only populated after
   429  		// first call to Next(). Not safe for concurrent access.
   430  		_ = it.Response.(*analyticshubpb.ListSharedResourceSubscriptionsResponse)
   431  	}
   432  }
   433  
   434  func ExampleClient_ListSubscriptions() {
   435  	ctx := context.Background()
   436  	// This snippet has been automatically generated and should be regarded as a code template only.
   437  	// It will require modifications to work:
   438  	// - It may require correct/in-range values for request initialization.
   439  	// - It may require specifying regional endpoints when creating the service client as shown in:
   440  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   441  	c, err := analyticshub.NewClient(ctx)
   442  	if err != nil {
   443  		// TODO: Handle error.
   444  	}
   445  	defer c.Close()
   446  
   447  	req := &analyticshubpb.ListSubscriptionsRequest{
   448  		// TODO: Fill request struct fields.
   449  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListSubscriptionsRequest.
   450  	}
   451  	it := c.ListSubscriptions(ctx, req)
   452  	for {
   453  		resp, err := it.Next()
   454  		if err == iterator.Done {
   455  			break
   456  		}
   457  		if err != nil {
   458  			// TODO: Handle error.
   459  		}
   460  		// TODO: Use resp.
   461  		_ = resp
   462  
   463  		// If you need to access the underlying RPC response,
   464  		// you can do so by casting the `Response` as below.
   465  		// Otherwise, remove this line. Only populated after
   466  		// first call to Next(). Not safe for concurrent access.
   467  		_ = it.Response.(*analyticshubpb.ListSubscriptionsResponse)
   468  	}
   469  }
   470  
   471  func ExampleClient_RefreshSubscription() {
   472  	ctx := context.Background()
   473  	// This snippet has been automatically generated and should be regarded as a code template only.
   474  	// It will require modifications to work:
   475  	// - It may require correct/in-range values for request initialization.
   476  	// - It may require specifying regional endpoints when creating the service client as shown in:
   477  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   478  	c, err := analyticshub.NewClient(ctx)
   479  	if err != nil {
   480  		// TODO: Handle error.
   481  	}
   482  	defer c.Close()
   483  
   484  	req := &analyticshubpb.RefreshSubscriptionRequest{
   485  		// TODO: Fill request struct fields.
   486  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#RefreshSubscriptionRequest.
   487  	}
   488  	op, err := c.RefreshSubscription(ctx, req)
   489  	if err != nil {
   490  		// TODO: Handle error.
   491  	}
   492  
   493  	resp, err := op.Wait(ctx)
   494  	if err != nil {
   495  		// TODO: Handle error.
   496  	}
   497  	// TODO: Use resp.
   498  	_ = resp
   499  }
   500  
   501  func ExampleClient_RevokeSubscription() {
   502  	ctx := context.Background()
   503  	// This snippet has been automatically generated and should be regarded as a code template only.
   504  	// It will require modifications to work:
   505  	// - It may require correct/in-range values for request initialization.
   506  	// - It may require specifying regional endpoints when creating the service client as shown in:
   507  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   508  	c, err := analyticshub.NewClient(ctx)
   509  	if err != nil {
   510  		// TODO: Handle error.
   511  	}
   512  	defer c.Close()
   513  
   514  	req := &analyticshubpb.RevokeSubscriptionRequest{
   515  		// TODO: Fill request struct fields.
   516  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#RevokeSubscriptionRequest.
   517  	}
   518  	resp, err := c.RevokeSubscription(ctx, req)
   519  	if err != nil {
   520  		// TODO: Handle error.
   521  	}
   522  	// TODO: Use resp.
   523  	_ = resp
   524  }
   525  
   526  func ExampleClient_SetIamPolicy() {
   527  	ctx := context.Background()
   528  	// This snippet has been automatically generated and should be regarded as a code template only.
   529  	// It will require modifications to work:
   530  	// - It may require correct/in-range values for request initialization.
   531  	// - It may require specifying regional endpoints when creating the service client as shown in:
   532  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   533  	c, err := analyticshub.NewClient(ctx)
   534  	if err != nil {
   535  		// TODO: Handle error.
   536  	}
   537  	defer c.Close()
   538  
   539  	req := &iampb.SetIamPolicyRequest{
   540  		// TODO: Fill request struct fields.
   541  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
   542  	}
   543  	resp, err := c.SetIamPolicy(ctx, req)
   544  	if err != nil {
   545  		// TODO: Handle error.
   546  	}
   547  	// TODO: Use resp.
   548  	_ = resp
   549  }
   550  
   551  func ExampleClient_SubscribeDataExchange() {
   552  	ctx := context.Background()
   553  	// This snippet has been automatically generated and should be regarded as a code template only.
   554  	// It will require modifications to work:
   555  	// - It may require correct/in-range values for request initialization.
   556  	// - It may require specifying regional endpoints when creating the service client as shown in:
   557  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   558  	c, err := analyticshub.NewClient(ctx)
   559  	if err != nil {
   560  		// TODO: Handle error.
   561  	}
   562  	defer c.Close()
   563  
   564  	req := &analyticshubpb.SubscribeDataExchangeRequest{
   565  		// TODO: Fill request struct fields.
   566  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#SubscribeDataExchangeRequest.
   567  	}
   568  	op, err := c.SubscribeDataExchange(ctx, req)
   569  	if err != nil {
   570  		// TODO: Handle error.
   571  	}
   572  
   573  	resp, err := op.Wait(ctx)
   574  	if err != nil {
   575  		// TODO: Handle error.
   576  	}
   577  	// TODO: Use resp.
   578  	_ = resp
   579  }
   580  
   581  func ExampleClient_SubscribeListing() {
   582  	ctx := context.Background()
   583  	// This snippet has been automatically generated and should be regarded as a code template only.
   584  	// It will require modifications to work:
   585  	// - It may require correct/in-range values for request initialization.
   586  	// - It may require specifying regional endpoints when creating the service client as shown in:
   587  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   588  	c, err := analyticshub.NewClient(ctx)
   589  	if err != nil {
   590  		// TODO: Handle error.
   591  	}
   592  	defer c.Close()
   593  
   594  	req := &analyticshubpb.SubscribeListingRequest{
   595  		// TODO: Fill request struct fields.
   596  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#SubscribeListingRequest.
   597  	}
   598  	resp, err := c.SubscribeListing(ctx, req)
   599  	if err != nil {
   600  		// TODO: Handle error.
   601  	}
   602  	// TODO: Use resp.
   603  	_ = resp
   604  }
   605  
   606  func ExampleClient_TestIamPermissions() {
   607  	ctx := context.Background()
   608  	// This snippet has been automatically generated and should be regarded as a code template only.
   609  	// It will require modifications to work:
   610  	// - It may require correct/in-range values for request initialization.
   611  	// - It may require specifying regional endpoints when creating the service client as shown in:
   612  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   613  	c, err := analyticshub.NewClient(ctx)
   614  	if err != nil {
   615  		// TODO: Handle error.
   616  	}
   617  	defer c.Close()
   618  
   619  	req := &iampb.TestIamPermissionsRequest{
   620  		// TODO: Fill request struct fields.
   621  		// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
   622  	}
   623  	resp, err := c.TestIamPermissions(ctx, req)
   624  	if err != nil {
   625  		// TODO: Handle error.
   626  	}
   627  	// TODO: Use resp.
   628  	_ = resp
   629  }
   630  
   631  func ExampleClient_UpdateDataExchange() {
   632  	ctx := context.Background()
   633  	// This snippet has been automatically generated and should be regarded as a code template only.
   634  	// It will require modifications to work:
   635  	// - It may require correct/in-range values for request initialization.
   636  	// - It may require specifying regional endpoints when creating the service client as shown in:
   637  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   638  	c, err := analyticshub.NewClient(ctx)
   639  	if err != nil {
   640  		// TODO: Handle error.
   641  	}
   642  	defer c.Close()
   643  
   644  	req := &analyticshubpb.UpdateDataExchangeRequest{
   645  		// TODO: Fill request struct fields.
   646  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#UpdateDataExchangeRequest.
   647  	}
   648  	resp, err := c.UpdateDataExchange(ctx, req)
   649  	if err != nil {
   650  		// TODO: Handle error.
   651  	}
   652  	// TODO: Use resp.
   653  	_ = resp
   654  }
   655  
   656  func ExampleClient_UpdateListing() {
   657  	ctx := context.Background()
   658  	// This snippet has been automatically generated and should be regarded as a code template only.
   659  	// It will require modifications to work:
   660  	// - It may require correct/in-range values for request initialization.
   661  	// - It may require specifying regional endpoints when creating the service client as shown in:
   662  	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
   663  	c, err := analyticshub.NewClient(ctx)
   664  	if err != nil {
   665  		// TODO: Handle error.
   666  	}
   667  	defer c.Close()
   668  
   669  	req := &analyticshubpb.UpdateListingRequest{
   670  		// TODO: Fill request struct fields.
   671  		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#UpdateListingRequest.
   672  	}
   673  	resp, err := c.UpdateListing(ctx, req)
   674  	if err != nil {
   675  		// TODO: Handle error.
   676  	}
   677  	// TODO: Use resp.
   678  	_ = resp
   679  }
   680  

View as plain text