{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.IAM.CreateInstanceProfile -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates a new instance profile. For information about instance profiles, -- see -- -- in the /IAM User Guide/, and -- -- in the /Amazon EC2 User Guide/. -- -- For information about the number of instance profiles you can create, -- see -- -- in the /IAM User Guide/. module Amazonka.IAM.CreateInstanceProfile ( -- * Creating a Request CreateInstanceProfile (..), newCreateInstanceProfile, -- * Request Lenses createInstanceProfile_path, createInstanceProfile_tags, createInstanceProfile_instanceProfileName, -- * Destructuring the Response CreateInstanceProfileResponse (..), newCreateInstanceProfileResponse, -- * Response Lenses createInstanceProfileResponse_httpStatus, createInstanceProfileResponse_instanceProfile, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.IAM.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newCreateInstanceProfile' smart constructor. data CreateInstanceProfile = CreateInstanceProfile' { -- | The path to the instance profile. For more information about paths, see -- -- in the /IAM User Guide/. -- -- This parameter is optional. If it is not included, it defaults to a -- slash (\/). -- -- This parameter allows (through its -- ) a string of characters -- consisting of either a forward slash (\/) by itself or a string that -- must begin and end with forward slashes. In addition, it can contain any -- ASCII character from the ! (@\\u0021@) through the DEL character -- (@\\u007F@), including most punctuation characters, digits, and upper -- and lowercased letters. path :: Prelude.Maybe Prelude.Text, -- | A list of tags that you want to attach to the newly created IAM instance -- profile. Each tag consists of a key name and an associated value. For -- more information about tagging, see -- -- in the /IAM User Guide/. -- -- If any one of the tags is invalid or if you exceed the allowed maximum -- number of tags, then the entire request fails and the resource is not -- created. tags :: Prelude.Maybe [Tag], -- | The name of the instance profile to create. -- -- This parameter allows (through its -- ) a string of characters -- consisting of upper and lowercase alphanumeric characters with no -- spaces. You can also include any of the following characters: _+=,.\@- instanceProfileName :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateInstanceProfile' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'path', 'createInstanceProfile_path' - The path to the instance profile. For more information about paths, see -- -- in the /IAM User Guide/. -- -- This parameter is optional. If it is not included, it defaults to a -- slash (\/). -- -- This parameter allows (through its -- ) a string of characters -- consisting of either a forward slash (\/) by itself or a string that -- must begin and end with forward slashes. In addition, it can contain any -- ASCII character from the ! (@\\u0021@) through the DEL character -- (@\\u007F@), including most punctuation characters, digits, and upper -- and lowercased letters. -- -- 'tags', 'createInstanceProfile_tags' - A list of tags that you want to attach to the newly created IAM instance -- profile. Each tag consists of a key name and an associated value. For -- more information about tagging, see -- -- in the /IAM User Guide/. -- -- If any one of the tags is invalid or if you exceed the allowed maximum -- number of tags, then the entire request fails and the resource is not -- created. -- -- 'instanceProfileName', 'createInstanceProfile_instanceProfileName' - The name of the instance profile to create. -- -- This parameter allows (through its -- ) a string of characters -- consisting of upper and lowercase alphanumeric characters with no -- spaces. You can also include any of the following characters: _+=,.\@- newCreateInstanceProfile :: -- | 'instanceProfileName' Prelude.Text -> CreateInstanceProfile newCreateInstanceProfile pInstanceProfileName_ = CreateInstanceProfile' { path = Prelude.Nothing, tags = Prelude.Nothing, instanceProfileName = pInstanceProfileName_ } -- | The path to the instance profile. For more information about paths, see -- -- in the /IAM User Guide/. -- -- This parameter is optional. If it is not included, it defaults to a -- slash (\/). -- -- This parameter allows (through its -- ) a string of characters -- consisting of either a forward slash (\/) by itself or a string that -- must begin and end with forward slashes. In addition, it can contain any -- ASCII character from the ! (@\\u0021@) through the DEL character -- (@\\u007F@), including most punctuation characters, digits, and upper -- and lowercased letters. createInstanceProfile_path :: Lens.Lens' CreateInstanceProfile (Prelude.Maybe Prelude.Text) createInstanceProfile_path = Lens.lens (\CreateInstanceProfile' {path} -> path) (\s@CreateInstanceProfile' {} a -> s {path = a} :: CreateInstanceProfile) -- | A list of tags that you want to attach to the newly created IAM instance -- profile. Each tag consists of a key name and an associated value. For -- more information about tagging, see -- -- in the /IAM User Guide/. -- -- If any one of the tags is invalid or if you exceed the allowed maximum -- number of tags, then the entire request fails and the resource is not -- created. createInstanceProfile_tags :: Lens.Lens' CreateInstanceProfile (Prelude.Maybe [Tag]) createInstanceProfile_tags = Lens.lens (\CreateInstanceProfile' {tags} -> tags) (\s@CreateInstanceProfile' {} a -> s {tags = a} :: CreateInstanceProfile) Prelude.. Lens.mapping Lens.coerced -- | The name of the instance profile to create. -- -- This parameter allows (through its -- ) a string of characters -- consisting of upper and lowercase alphanumeric characters with no -- spaces. You can also include any of the following characters: _+=,.\@- createInstanceProfile_instanceProfileName :: Lens.Lens' CreateInstanceProfile Prelude.Text createInstanceProfile_instanceProfileName = Lens.lens (\CreateInstanceProfile' {instanceProfileName} -> instanceProfileName) (\s@CreateInstanceProfile' {} a -> s {instanceProfileName = a} :: CreateInstanceProfile) instance Core.AWSRequest CreateInstanceProfile where type AWSResponse CreateInstanceProfile = CreateInstanceProfileResponse request overrides = Request.postQuery (overrides defaultService) response = Response.receiveXMLWrapper "CreateInstanceProfileResult" ( \s h x -> CreateInstanceProfileResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) Prelude.<*> (x Data..@ "InstanceProfile") ) instance Prelude.Hashable CreateInstanceProfile where hashWithSalt _salt CreateInstanceProfile' {..} = _salt `Prelude.hashWithSalt` path `Prelude.hashWithSalt` tags `Prelude.hashWithSalt` instanceProfileName instance Prelude.NFData CreateInstanceProfile where rnf CreateInstanceProfile' {..} = Prelude.rnf path `Prelude.seq` Prelude.rnf tags `Prelude.seq` Prelude.rnf instanceProfileName instance Data.ToHeaders CreateInstanceProfile where toHeaders = Prelude.const Prelude.mempty instance Data.ToPath CreateInstanceProfile where toPath = Prelude.const "/" instance Data.ToQuery CreateInstanceProfile where toQuery CreateInstanceProfile' {..} = Prelude.mconcat [ "Action" Data.=: ("CreateInstanceProfile" :: Prelude.ByteString), "Version" Data.=: ("2010-05-08" :: Prelude.ByteString), "Path" Data.=: path, "Tags" Data.=: Data.toQuery (Data.toQueryList "member" Prelude.<$> tags), "InstanceProfileName" Data.=: instanceProfileName ] -- | Contains the response to a successful CreateInstanceProfile request. -- -- /See:/ 'newCreateInstanceProfileResponse' smart constructor. data CreateInstanceProfileResponse = CreateInstanceProfileResponse' { -- | The response's http status code. httpStatus :: Prelude.Int, -- | A structure containing details about the new instance profile. instanceProfile :: InstanceProfile } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'CreateInstanceProfileResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'httpStatus', 'createInstanceProfileResponse_httpStatus' - The response's http status code. -- -- 'instanceProfile', 'createInstanceProfileResponse_instanceProfile' - A structure containing details about the new instance profile. newCreateInstanceProfileResponse :: -- | 'httpStatus' Prelude.Int -> -- | 'instanceProfile' InstanceProfile -> CreateInstanceProfileResponse newCreateInstanceProfileResponse pHttpStatus_ pInstanceProfile_ = CreateInstanceProfileResponse' { httpStatus = pHttpStatus_, instanceProfile = pInstanceProfile_ } -- | The response's http status code. createInstanceProfileResponse_httpStatus :: Lens.Lens' CreateInstanceProfileResponse Prelude.Int createInstanceProfileResponse_httpStatus = Lens.lens (\CreateInstanceProfileResponse' {httpStatus} -> httpStatus) (\s@CreateInstanceProfileResponse' {} a -> s {httpStatus = a} :: CreateInstanceProfileResponse) -- | A structure containing details about the new instance profile. createInstanceProfileResponse_instanceProfile :: Lens.Lens' CreateInstanceProfileResponse InstanceProfile createInstanceProfileResponse_instanceProfile = Lens.lens (\CreateInstanceProfileResponse' {instanceProfile} -> instanceProfile) (\s@CreateInstanceProfileResponse' {} a -> s {instanceProfile = a} :: CreateInstanceProfileResponse) instance Prelude.NFData CreateInstanceProfileResponse where rnf CreateInstanceProfileResponse' {..} = Prelude.rnf httpStatus `Prelude.seq` Prelude.rnf instanceProfile