-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
170 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Copyright 2023 Google Inc. | ||
# 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 | ||
# | ||
# http://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. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'Fleet' | ||
base_url: "projects/{{project}}/locations/global/fleets" | ||
create_url: "projects/{{project}}/locations/global/fleets" | ||
update_url: "projects/{{project}}/locations/global/fleets/default" | ||
self_link: "projects/{{project}}/locations/global/fleets/default" | ||
update_verb: :PATCH | ||
update_mask: true | ||
description: | | ||
Fleet contains information about a group of clusters. | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
guides: | ||
'Registering a Cluster to a Fleet': | ||
'https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster' | ||
api: 'https://cloud.google.com/anthos/multicluster-management/reference/rest/v1/projects.locations.fleets' | ||
async: !ruby/object:Api::OpAsync | ||
operation: !ruby/object:Api::OpAsync::Operation | ||
kind: 'gkehub#operation' | ||
path: 'name' | ||
base_url: '{{op_id}}' | ||
wait_ms: 1000 | ||
result: !ruby/object:Api::OpAsync::Result | ||
path: 'response' | ||
resource_inside_response: true | ||
status: !ruby/object:Api::OpAsync::Status | ||
path: 'done' | ||
complete: 'true' | ||
allowed: | ||
- 'true' | ||
- 'false' | ||
error: !ruby/object:Api::OpAsync::Error | ||
path: 'error/errors' | ||
message: 'message' | ||
iam_policy: !ruby/object:Api::Resource::IamPolicy | ||
method_name_separator: ':' | ||
import_format: | ||
[ | ||
'projects/{{project}}/locations/{{location}}/fleets/default', | ||
] | ||
autogen_async: true | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
name: 'gkehub_fleet_basic' | ||
id_format: 'projects/{{project}}/locations/global/fleets/default' | ||
import_format: | ||
['projects/{{project}}/locations/global/fleets/default'] | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
output: true | ||
description: | | ||
The unique identifier of the fleet. | ||
- !ruby/object:Api::Type::String | ||
name: 'displayName' | ||
description: | | ||
A user-assigned display name of the Fleet. When present, it must be between 4 to 30 characters. | ||
Allowed characters are: lowercase and uppercase letters, numbers, hyphen, single-quote, double-quote, space, and exclamation point. | ||
- !ruby/object:Api::Type::Time | ||
name: "createTime" | ||
description: | | ||
The time the fleet was created, in RFC3339 text format. | ||
output: true | ||
- !ruby/object:Api::Type::Time | ||
name: "updateTime" | ||
description: | | ||
The time the fleet was last updated, in RFC3339 text format. | ||
output: true | ||
- !ruby/object:Api::Type::Time | ||
name: "deleteTime" | ||
description: | | ||
The time the fleet was deleted, in RFC3339 text format. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'uid' | ||
output: true | ||
description: | | ||
Google-generated UUID for this resource. This is unique across all | ||
Fleet resources. If a Fleet resource is deleted and another | ||
resource with the same name is created, it gets a different uid. | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'state' | ||
description: The state of the fleet resource. | ||
output: true | ||
properties: | ||
- !ruby/object:Api::Type::Enum | ||
name: 'code' | ||
description: Describes the state of a Fleet resource. | ||
output: true | ||
values: | ||
- CODE_UNSPECIFIED | ||
- CREATING | ||
- READY | ||
- DELETING | ||
- UPDATING | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "google_gkehub_fleet" "default" { | ||
display_name = "my production fleet" | ||
} |
58 changes: 58 additions & 0 deletions
58
mmv1/third_party/terraform/services/gkehub/resource_gke_hub_fleet_test.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<% autogen_exception -%> | ||
package gkehub_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" | ||
) | ||
|
||
func TestAccGKEHubFleet_gkehubFleetBasicExample_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": acctest.RandString(t, 10), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
CheckDestroy: testAccCheckGKEHubFleetDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccGKEHubFleet_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_gke_hub_fleet.default", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccGKEHubFleet_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_gke_hub_fleet.default", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccGKEHubFleet_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gke_hub_fleet" "default" { | ||
display_name = "my production fleet" | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccGKEHubFleet_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gke_hub_fleet" "default" { | ||
display_name = "my staging fleet" | ||
} | ||
`, context) | ||
} |