| // Copyright 2021 Google LLC |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // https://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // Code generated by protoc-gen-go_gapic. DO NOT EDIT. |
| |
| package networksecurity_test |
| |
| import ( |
| "context" |
| |
| networksecurity "cloud.google.com/go/networksecurity/apiv1beta1" |
| "google.golang.org/api/iterator" |
| networksecuritypb "google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1" |
| ) |
| |
| func ExampleNewClient() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| // TODO: Use client. |
| _ = c |
| } |
| |
| func ExampleClient_ListAuthorizationPolicies() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.ListAuthorizationPoliciesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#ListAuthorizationPoliciesRequest. |
| } |
| it := c.ListAuthorizationPolicies(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_GetAuthorizationPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.GetAuthorizationPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#GetAuthorizationPolicyRequest. |
| } |
| resp, err := c.GetAuthorizationPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_CreateAuthorizationPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.CreateAuthorizationPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#CreateAuthorizationPolicyRequest. |
| } |
| op, err := c.CreateAuthorizationPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_UpdateAuthorizationPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.UpdateAuthorizationPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#UpdateAuthorizationPolicyRequest. |
| } |
| op, err := c.UpdateAuthorizationPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_DeleteAuthorizationPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.DeleteAuthorizationPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#DeleteAuthorizationPolicyRequest. |
| } |
| op, err := c.DeleteAuthorizationPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleClient_ListServerTlsPolicies() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.ListServerTlsPoliciesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#ListServerTlsPoliciesRequest. |
| } |
| it := c.ListServerTlsPolicies(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_GetServerTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.GetServerTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#GetServerTlsPolicyRequest. |
| } |
| resp, err := c.GetServerTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_CreateServerTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.CreateServerTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#CreateServerTlsPolicyRequest. |
| } |
| op, err := c.CreateServerTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_UpdateServerTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.UpdateServerTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#UpdateServerTlsPolicyRequest. |
| } |
| op, err := c.UpdateServerTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_DeleteServerTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.DeleteServerTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#DeleteServerTlsPolicyRequest. |
| } |
| op, err := c.DeleteServerTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |
| |
| func ExampleClient_ListClientTlsPolicies() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.ListClientTlsPoliciesRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#ListClientTlsPoliciesRequest. |
| } |
| it := c.ListClientTlsPolicies(ctx, req) |
| for { |
| resp, err := it.Next() |
| if err == iterator.Done { |
| break |
| } |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| } |
| |
| func ExampleClient_GetClientTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.GetClientTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#GetClientTlsPolicyRequest. |
| } |
| resp, err := c.GetClientTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_CreateClientTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.CreateClientTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#CreateClientTlsPolicyRequest. |
| } |
| op, err := c.CreateClientTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_UpdateClientTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.UpdateClientTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#UpdateClientTlsPolicyRequest. |
| } |
| op, err := c.UpdateClientTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| resp, err := op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| // TODO: Use resp. |
| _ = resp |
| } |
| |
| func ExampleClient_DeleteClientTlsPolicy() { |
| ctx := context.Background() |
| c, err := networksecurity.NewClient(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| defer c.Close() |
| |
| req := &networksecuritypb.DeleteClientTlsPolicyRequest{ |
| // TODO: Fill request struct fields. |
| // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#DeleteClientTlsPolicyRequest. |
| } |
| op, err := c.DeleteClientTlsPolicy(ctx, req) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| |
| err = op.Wait(ctx) |
| if err != nil { |
| // TODO: Handle error. |
| } |
| } |