google-cloud-secret_manager-v1 0.20.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,23 @@ module Google
24
24
  module SecretManagerService
25
25
  # Path helper methods for the SecretManagerService API.
26
26
  module Paths
27
+ ##
28
+ # Create a fully-qualified Location resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ #
37
+ # @return [::String]
38
+ def location_path project:, location:
39
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
40
+
41
+ "projects/#{project}/locations/#{location}"
42
+ end
43
+
27
44
  ##
28
45
  # Create a fully-qualified Project resource string.
29
46
  #
@@ -41,37 +58,87 @@ module Google
41
58
  ##
42
59
  # Create a fully-qualified Secret resource string.
43
60
  #
44
- # The resource will be in the following format:
61
+ # @overload secret_path(project:, secret:)
62
+ # The resource will be in the following format:
45
63
  #
46
- # `projects/{project}/secrets/{secret}`
64
+ # `projects/{project}/secrets/{secret}`
47
65
  #
48
- # @param project [String]
49
- # @param secret [String]
66
+ # @param project [String]
67
+ # @param secret [String]
68
+ #
69
+ # @overload secret_path(project:, location:, secret:)
70
+ # The resource will be in the following format:
71
+ #
72
+ # `projects/{project}/locations/{location}/secrets/{secret}`
73
+ #
74
+ # @param project [String]
75
+ # @param location [String]
76
+ # @param secret [String]
50
77
  #
51
78
  # @return [::String]
52
- def secret_path project:, secret:
53
- raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
79
+ def secret_path **args
80
+ resources = {
81
+ "project:secret" => (proc do |project:, secret:|
82
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
83
 
55
- "projects/#{project}/secrets/#{secret}"
84
+ "projects/#{project}/secrets/#{secret}"
85
+ end),
86
+ "location:project:secret" => (proc do |project:, location:, secret:|
87
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
88
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
89
+
90
+ "projects/#{project}/locations/#{location}/secrets/#{secret}"
91
+ end)
92
+ }
93
+
94
+ resource = resources[args.keys.sort.join(":")]
95
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
96
+ resource.call(**args)
56
97
  end
57
98
 
58
99
  ##
59
100
  # Create a fully-qualified SecretVersion resource string.
60
101
  #
61
- # The resource will be in the following format:
102
+ # @overload secret_version_path(project:, secret:, secret_version:)
103
+ # The resource will be in the following format:
62
104
  #
63
- # `projects/{project}/secrets/{secret}/versions/{secret_version}`
105
+ # `projects/{project}/secrets/{secret}/versions/{secret_version}`
64
106
  #
65
- # @param project [String]
66
- # @param secret [String]
67
- # @param secret_version [String]
107
+ # @param project [String]
108
+ # @param secret [String]
109
+ # @param secret_version [String]
110
+ #
111
+ # @overload secret_version_path(project:, location:, secret:, secret_version:)
112
+ # The resource will be in the following format:
113
+ #
114
+ # `projects/{project}/locations/{location}/secrets/{secret}/versions/{secret_version}`
115
+ #
116
+ # @param project [String]
117
+ # @param location [String]
118
+ # @param secret [String]
119
+ # @param secret_version [String]
68
120
  #
69
121
  # @return [::String]
70
- def secret_version_path project:, secret:, secret_version:
71
- raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
72
- raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"
122
+ def secret_version_path **args
123
+ resources = {
124
+ "project:secret:secret_version" => (proc do |project:, secret:, secret_version:|
125
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
126
+ raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"
127
+
128
+ "projects/#{project}/secrets/#{secret}/versions/#{secret_version}"
129
+ end),
130
+ "location:project:secret:secret_version" => (proc do |project:, location:, secret:, secret_version:|
131
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
132
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
133
+ raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"
134
+
135
+ "projects/#{project}/locations/#{location}/secrets/#{secret}/versions/#{secret_version}"
136
+ end)
137
+ }
73
138
 
74
- "projects/#{project}/secrets/#{secret}/versions/#{secret_version}"
139
+ resource = resources[args.keys.sort.join(":")]
140
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
141
+ resource.call(**args)
75
142
  end
76
143
 
77
144
  ##